Package org.apache.tuscany.core.async.work

Examples of org.apache.tuscany.core.async.work.DefaultWorkManager


    }

    protected void setUp() throws Exception {
        hello = SimpleTarget.class.getMethod("hello", String.class);
       
        workManager=new DefaultWorkManager();
        workManager.setScheduledMaximumPoolSize(5);
        workManager.init();
    }
View Full Code Here


    private Set<Thread> done;
    private int count;
   
    public void testScheduleWork() throws Exception {

        DefaultWorkManager workManager = new DefaultWorkManager();
        workManager.setScheduledMaximumPoolSize(3);
        workManager.init();
       
        int max=workManager.getScheduledMaximumPoolSize()*5;
        done=Collections.synchronizedSet(new HashSet<Thread>());
        count=0;
       
        CountDownLatch startSignal = new CountDownLatch(1);
        CountDownLatch doneSignal = new CountDownLatch(max);
        for (int i = 0; i < max; ++i) {
            workManager.scheduleWork(new Worker(startSignal, doneSignal));
        }
        startSignal.countDown();
        doneSignal.await();
       
        assertFalse(done.contains(Thread.currentThread()));
        assert(done.size()==workManager.getScheduledMaximumPoolSize());
        assert(count==max);
       
        done=null;
        count=0;

        workManager.destroy();

    }
View Full Code Here

TOP

Related Classes of org.apache.tuscany.core.async.work.DefaultWorkManager

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.