Examples of WorkManager


Examples of javax.resource.spi.work.WorkManager

  public void start(BootstrapContext ctx)
    throws ResourceAdapterInternalException
  {
    log.info("WorkResource[] starting");

    WorkManager workManager = ctx.getWorkManager();
   
    Work work = new WorkTask(this);

    try {
      // Submits the work, but does not wait for the result.
      // In other words, it spawns a new thread
      workManager.startWork(work);
    } catch (WorkException e) {
      throw new ResourceAdapterInternalException(e);
    }
  }
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

    }


    private static final class StubBootstrapContext implements BootstrapContext {
        public WorkManager getWorkManager() {
            return new WorkManager() {
                public void doWork(Work work) throws WorkException {
                    new Thread(work).start();
                }

                public void doWork(Work work, long arg1, ExecutionContext arg2, WorkListener arg3) throws WorkException {
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

public class MDBTest extends TestCase {

    private final class StubBootstrapContext implements BootstrapContext {
        public WorkManager getWorkManager() {
            return new WorkManager() {
                public void doWork(Work work) throws WorkException {
                    new Thread(work).start();
                }
       
                public void doWork(Work work, long arg1, ExecutionContext arg2, WorkListener arg3)
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

   * Identify a specific GlassFish thread pool to talk to.
   * <p>The thread pool name matches the resource adapter name
   * in default RAR deployment scenarios.
   */
  public void setThreadPoolName(String threadPoolName) {
    WorkManager wm = (WorkManager)
        ReflectionUtils.invokeMethod(this.getWorkManagerMethod, null, new Object[] {threadPoolName});
    if (wm == null) {
      throw new IllegalArgumentException("Specified thread pool name '" + threadPoolName +
          "' does not correspond to an actual pool definition in GlassFish. Check your configuration!");
    }
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

            } else {
                threadPool = Executors.newFixedThreadPool(threadPoolSize, new ResourceAdapterThreadFactory(serviceInfo.id));
            }

            // WorkManager: the resource adapter can use this to dispatch messages or perform tasks
            WorkManager workManager;
            if (transactionManager instanceof GeronimoTransactionManager) {
                GeronimoTransactionManager geronimoTransactionManager = (GeronimoTransactionManager) transactionManager;
                workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, geronimoTransactionManager);
            } else {
                workManager = new SimpleWorkManager(threadPool);
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

      return results;
   }
  
   public void basicTest() throws Exception
   {
      WorkManager wm = adapter.ctx.getWorkManager();
      TestWork work = new TestWork();
      wm.doWork(work);
      if (work.complete == false)
         throw new Exception("Work was not done");
   }
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

   }
  
   public void basicTest() throws Exception
   {
      XATerminator xt = adapter.ctx.getXATerminator();
      WorkManager wm = adapter.ctx.getWorkManager();
      TestWork work = new TestWork();
      ExecutionContext ec = new ExecutionContext();
      Xid xid = new MyXid(1);
      ec.setXid(xid);

      wm.doWork(work, 0l, ec, null);
      if (work.complete == false)
         throw new Exception("Work was not done");
      if (work.e != null)
         throw work.e;
      if (work.enlisted == false)
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

   public void start(BootstrapContext ctx)
      throws ResourceAdapterInternalException
   {
      log.debug("start");
      this.ctx = ctx;
      WorkManager mgr = ctx.getWorkManager();
   }
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

    SynchronizedBoolean flag = new SynchronizedBoolean(false);
    Object lock = new Object();

    public void testWorkManager() throws Exception {
        WorkManager workManager = (WorkManager) getBean("workManager");
        workManager.scheduleWork(new Work() {
            public void release() {
            }

            public void run() {
                flag.set(true);
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

            } else {
                threadPool = Executors.newFixedThreadPool(threadPoolSize, new ResourceAdapterThreadFactory(serviceInfo.id));
            }

            // WorkManager: the resource adapter can use this to dispatch messages or perform tasks
            WorkManager workManager;
            if (transactionManager instanceof GeronimoTransactionManager) {
                GeronimoTransactionManager geronimoTransactionManager = (GeronimoTransactionManager) transactionManager;
                TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(geronimoTransactionManager);
               
                // use id as default realm name if realm is not specified in service properties
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.