Package org.jgroups.blocks.executor

Examples of org.jgroups.blocks.executor.ExecutionService


   
    public void start() throws Exception {
        ch=new JChannel(props);
        if(name != null)
            ch.setName(name);
        execution_service=new ExecutionService(ch);
        runner=new ExecutionRunner(ch);
        ch.connect("executing-cluster");
        JmxConfigurator.registerChannel(ch, Util.getMBeanServer(),
            "execution-service", ch.getClusterName(), true);
       
View Full Code Here


   
    public void start() throws Exception {
        ch=new JChannel(props);
        if(name != null)
            ch.setName(name);
        execution_service=new ExecutionService(ch);
        runner=new ExecutionRunner(ch);
        ch.connect("executing-cluster");
        JmxConfigurator.registerChannel(ch, Util.getMBeanServer(),
            "execution-service", ch.getClusterName(), true);
       
View Full Code Here

        Util.close(c3,c2,c1);
    }
   
    @BeforeMethod
    protected void createExecutors() {
        e1=new ExecutionService(c1);
        e2=new ExecutionService(c2);
        e3=new ExecutionService(c3);
       
        // Clear out the queue, in case if test doesn't clear it
        SleepingStreamableCallable.canceledThreads.clear();
        // Reset the barrier in case test failed on the barrier
        SleepingStreamableCallable.barrier.reset();
View Full Code Here

   
    public void start() throws Exception {
        ch=new JChannel(props);
        if(name != null)
            ch.setName(name);
        execution_service=new ExecutionService(ch);
        runner=new ExecutionRunner(ch);
        ch.connect("executing-cluster");
        JmxConfigurator.registerChannel(ch, Util.getMBeanServer(),
            "execution-service", ch.getClusterName(), true);
       
View Full Code Here

        channel1.connect("test-cluster");
        channel2.connect("test-cluster");
        Util.waitUntilAllChannelsHaveSameSize(20000, 1000, channel1, channel2);

        final ExecutionService executionService=new ExecutionService(channel1);
        ExecutionRunner executionRunner1=new ExecutionRunner(channel1);
        ExecutionRunner executionRunner2=new ExecutionRunner(channel2);

        Thread runner1=new Thread(executionRunner1);
        threads.add(runner1);
        runner1.start();
        Thread runner2=new Thread(executionRunner2);
        threads.add(runner2);
        runner2.start();

        final AtomicInteger submittedTasks=new AtomicInteger();
        final AtomicInteger finishedTasks=new AtomicInteger();
        final FutureListener<Void> listener=new FutureListener<Void>() {
            @Override
            public void futureDone(Future<Void> future) {
                finishedTasks.incrementAndGet();
                synchronized(ExecutingServiceTest2.this) {
                    ExecutingServiceTest2.this.notify();
                }
            }
        };

        Thread submitter=new Thread(new Runnable() {
            @Override
            public void run() {
                // Two long running tasks that should be sent to each runner
                submit(true);
                submit(true);
                while(!Thread.interrupted()) {
                    submit(false);

                    // Throttle
                    try {
                        Thread.sleep(50);
                    }
                    catch(InterruptedException e) {
                        Thread.currentThread().interrupt();
                    }
                }
            }

            private void submit(boolean wait) {
                Callable<Void> task=new Wait(wait);
                NotifyingFuture<Void> future=executionService.submit(task);
                submittedTasks.incrementAndGet();
                future.setListener(listener);
            }

        });
View Full Code Here

TOP

Related Classes of org.jgroups.blocks.executor.ExecutionService

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.