Package javax.resource.spi.work

Examples of javax.resource.spi.work.Work


     }

     public void run() {
   while (true) {
       try {
     Work run = null;
     boolean haswait = false;
     synchronized (workList) {
         while (workList.isEmpty()) {
       if ((haswait && freeThreads > minpoolsz) || !valid) {
           poolsz--;
View Full Code Here


    }
   
    @Test public void testSchedule() throws Exception {
      ThreadReuseExecutor pool = new ThreadReuseExecutor("test", 5); //$NON-NLS-1$
        final ArrayList<String> result = new ArrayList<String>();
      pool.schedule(new Work() {
     
      @Override
      public void run() {
          result.add("hello"); //$NON-NLS-1$
      }
View Full Code Here

    }
   
    @Test public void testFailingWork() throws Exception {
      ThreadReuseExecutor pool = new ThreadReuseExecutor("test", 5); //$NON-NLS-1$
      final AtomicInteger count = new AtomicInteger();
      pool.execute(new Work() {
        @Override
        public void run() {
          count.getAndIncrement();
          throw new RuntimeException();
        }
View Full Code Here

        final ModuleContext currentModuleContext=CurrentModuleContext.getContext();
       
        // Schedule the invocation of the next interceptor in a new Work instance
        try {
            workManager.scheduleWork(new Work() {
               
                public void run() {
                    ModuleContext oldModuleContext=CurrentModuleContext.getContext();
                    try {
                        BINDER.setContext(currentModuleContext);
View Full Code Here

   private void setup(WorkWrapper wrapper, WorkListener workListener) throws WorkCompletedException, WorkException
   {
      if (trace)
         log.tracef("Setting up work: %s, work listener: %s", wrapper, workListener);

      Work work = wrapper.getWork();
     
      //If work is an instanceof ResourceAdapterAssociation
      if (resourceAdapter != null && work instanceof ResourceAdapterAssociation)
      {
         try
         {
            ResourceAdapterAssociation raa = (ResourceAdapterAssociation)work;
            raa.setResourceAdapter(resourceAdapter);
         }
         catch (Throwable t)
         {
            throw new WorkException(bundle.resourceAdapterAssociationFailed(work.getClass().getName()), t);
         }
      }

      //If work is an instanceof WorkContextProvider
      if (work instanceof WorkContextProvider)
View Full Code Here

    /* (non-Javadoc)
     * @see javax.resource.spi.work.WorkManager#startWork(javax.resource.spi.work.Work)
     */
    public long startWork(final Work work) throws WorkException {
        final CountDownLatch latch = new CountDownLatch(1);
        executor.execute(new Work() {
            public void release() {
                work.release();
            }
            public void run() {
                latch.countDown();
View Full Code Here

   private void setup(WorkWrapper wrapper, WorkListener workListener) throws WorkCompletedException, WorkException
   {
      if (trace)
         log.tracef("Setting up work: %s, work listener: %s", wrapper, workListener);

      Work work = wrapper.getWork();
     
      //If work is an instanceof ResourceAdapterAssociation
      if (resourceAdapter != null && work instanceof ResourceAdapterAssociation)
      {
         try
         {
            ResourceAdapterAssociation raa = (ResourceAdapterAssociation)work;
            raa.setResourceAdapter(resourceAdapter);
         }
         catch (Throwable t)
         {
            throw new WorkException(bundle.resourceAdapterAssociationFailed(work.getClass().getName()), t);
         }
      }

      //If work is an instanceof WorkContextProvider
      if (work instanceof WorkContextProvider)
View Full Code Here

            this.transacted = endpointFactory.isDeliveryTransacted(ON_MESSAGE_METHOD);
        } catch (NoSuchMethodException e) {
            throw new ResourceException("Endpoint does not implement the onMessage method.");
        }

        connectWork = new Work() {
            long currentReconnectDelay = INITIAL_RECONNECT_DELAY;

            public void release() {
                //
            }
View Full Code Here

      // Try to set inACC correctly depending on workMgr availability
      if (workMgr != null) {
        // System.out.println("MQJMSRA:RA:AIACC:WorkMgr is NOT null!!");
        // Try to do work
        try {
          workMgr.doWork(new Work() {
            public void run() {
              // System.out.println("MQJMSRA:RA:AIACC:Working...!");
              return;
            }
View Full Code Here

            this.transacted = endpointFactory.isDeliveryTransacted(ON_MESSAGE_METHOD);
        } catch (NoSuchMethodException e) {
            throw new ResourceException("Endpoint does not implement the onMessage method.");
        }

        connectWork = new Work() {
            long currentReconnectDelay = INITIAL_RECONNECT_DELAY;

            public void release() {
                //
            }
View Full Code Here

TOP

Related Classes of javax.resource.spi.work.Work

Copyright © 2018 www.massapicom. 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.