Examples of WorkManager


Examples of commonj.work.WorkManager

*/
public class Jsr237WorkSchedulerTestCase extends TestCase {

    public void testSchedule() throws Exception {
        WorkItem item = createMock(WorkItem.class);
        WorkManager mgr = createMock(WorkManager.class);
        mgr.schedule(isA(Work.class));
        expectLastCall().andReturn(item);
        replay(mgr);
        Jsr237WorkScheduler scheduler = new Jsr237WorkScheduler(mgr);
        Work work = createMock(Work.class);
        scheduler.scheduleWork(work);
View Full Code Here

Examples of it.eng.spagobi.utilities.threadmanager.WorkManager

  public void run(WekaEngineInstance engineInstance) {
    WekaKnowledgeFlow knowledgeFlow;
    WekaKnowledgeFlowEnv knowledgeFlowEnv;
    WekaEngineInstanceMonitor wekaEngineInstanceMonitor;
   
    WorkManager wm;
      WekaWork wekaWork;
      WekaWorkListener wekaWorkListener;
          
      logger.debug("IN");
      try {
        Assert.assertNotNull(engineInstance, "Parameter [engineInstance] cannot be null");
       
        // wrap ...
        knowledgeFlowEnv = new WekaKnowledgeFlowEnv(engineInstance.getEnv());
        knowledgeFlow = WekaKnowledgeFlow.load(engineInstance.getTemplate(), knowledgeFlowEnv);
        wekaEngineInstanceMonitor = new WekaEngineInstanceMonitor(engineInstance.getEnv());
       
        WekaEngine.getConfig().getEngineOutputFilesDir();
        File outputFile = new File(WekaEngine.getConfig().getEngineOutputFilesDir(), "out" + System.currentTimeMillis() + ".txt");
        logger.debug("Outputfile set to [" + outputFile + "]");
        knowledgeFlowEnv.setOutputFile( outputFile );
       
        //knowledgeFlowEnv.setOutputFile(new File("C:\\ProgramFiles\\apache-tomcat-6.0.18\\resources\\weka\\outputfiles\\pippo.txt"));
       
        // ...and run
        wm = new WorkManager();
        wekaWork = new WekaWork(knowledgeFlow);
        wekaWorkListener = new WekaWorkListener( wekaEngineInstanceMonitor );
        wm.run(wekaWork, wekaWorkListener);
      } catch (Throwable t) {
        throw new RuntimeException("Impossible to execute command in a new thread", t);
    } finally {
        logger.debug("OUT");
      }
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

                return ((ManagementPool) existingManagementPool);
            }
        }

        // Instance was not found, is there a work manager ?
        WorkManager workManager = getContainer().getConfiguration().getEZBServer().getComponent(EZBWorkManagerComponent.class);

        // There is a work manager
        if (workManager != null) {
            managementReusablePool = ReusableThreadPoolFactory.createWorkManagerThreadPool(workManager,
                    MANAGEMENTPOOL_WORKMANAGER_LIMIT);
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() throws JMSException
   {
      JmsActivation activation = pool.getActivation();
      WorkManager workManager = activation.getWorkManager();
      try
      {
         workManager.scheduleWork(this, 0, null, this);
      } catch (WorkException e)
      {
         log.error("Unable to schedule work", e);
         throw new JMSException("Unable to schedule work: " + e.toString());
      }
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();
      newMsgsWorker = new NewMsgsWorker(mgr);
      try
      {
         mgr.scheduleWork(newMsgsWorker);
      }
      catch (WorkException e)
      {
         throw new ResourceAdapterInternalException(e);
      }
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

            } 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

Examples of javax.resource.spi.work.WorkManager

     */
    public void testGetSetWorkManager() {
        TransactionContextManager transactionContextManager = new TransactionContextManager();
        GeronimoWorkManager manager = new GeronimoWorkManager(pool, pool, pool, transactionContextManager);
        BootstrapContextImpl context = new BootstrapContextImpl(manager);
        WorkManager wm = context.getWorkManager();

        assertSame("Make sure it is the same object", manager, wm);
    }
View Full Code Here

Examples of javax.resource.spi.work.WorkManager

     */
    public void testGetSetWorkManager() {
        TransactionContextManager transactionContextManager = new TransactionContextManager();
        GeronimoWorkManager manager = new GeronimoWorkManager(1, transactionContextManager);
        BootstrapContextImpl context = new BootstrapContextImpl(manager);
        WorkManager wm = context.getWorkManager();

        assertSame("Make sure it is the same object", manager, wm);
    }
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.