You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by sachin2008 <es...@gmail.com> on 2008/03/20 09:56:39 UTC

problem in servicemix bean-flow example

Hi , i have witten a simple program for parallel processing using servicemix
bean-flow.

Here is my program...
public class ParallelActivityTest {
	public static void main(String args[]){
		System.out.println("hi");
		Timer timer = new Timer();
			
		 Executor executor = Executors.newFixedThreadPool(10);
	     ExampleParallelBean parallelBean = new ExampleParallelBean();
	     ParallelActivity activity =
ParallelActivity.newParallelMethodActivity(executor, parallelBean);
	     activity.startWithTimeout(timer, 8000);
	     
	    
		}
}
	
class ExampleParallelBean extends ParallelBean
	{
		private CountDownLatch latch = new CountDownLatch(3);

	    public void shouldNotBeRun() {
	        throw new RuntimeException("Should not be ran");
	    }

	    @Parallel
	    public void methodOne() {
	        System.out.println("Called method one");
	        try{Thread.sleep(3000);
	        }catch(Exception exc){
	        	exc.printStackTrace();
	        }
	        latch.countDown();
	        System.out.println("method one complete");
	    }

	    @Parallel
	    public void methodTwo() {
	        System.out.println("Called method two");
	        try{Thread.sleep(3000);
	        }catch(Exception exc){
	        	exc.printStackTrace();
	        }
	        latch.countDown();
	        System.out.println("method two complete");
	    }

	    @Parallel
	    public void methodThree() {
	        System.out.println("Called method three");
	        latch.countDown();
	        System.out.println("method three complete");
	    }
	}

But when i run the program, 3 parallel methods are not being invoked.  what
else i have missed here.  
what i changes i need to mode to run the above program. 



-----
Cheers
Praveen Oruganti
"Think before you act and act on what you believe"
-- 
View this message in context: http://www.nabble.com/problem-in-servicemix-bean-flow-example-tp16174576s12049p16174576.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.