hi
i want 2 or 3 methods to be executed in parallel. so i have used the
parallel annotations to each method as below
package com.cts.ParallelPOC.ParalleExample;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.beanflow.annotations.Parallel;
import java.util.concurrent.CountDownLatch;
public class ExampleService{
private static final Log log = LogFactory.getLog(ExampleService.class);
private CountDownLatch latch = new CountDownLatch(3);
public void shouldNotBeRun() {
throw new RuntimeException("Should not be ran");
}
@Parallel
public void methodOne() {
log.info("Called method one");
latch.countDown();
log.info("method one complete");
}
@Parallel
public void methodTwo() {
log.info("Called method two");
latch.countDown();
log.info("method two complete");
}
@Parallel
public void methodThree() {
log.info("Called method three");
latch.countDown();
log.info("method three complete");
}
}
And i have used the parallelactivity to execute the methods as below
package com.cts.ParallelPOC.ParalleExample;
import org.apache.servicemix.beanflow.ParallelActivity;
import org.apache.servicemix.beanflow.util.ActivityTestSupport;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class Parallelactivitytest extends ActivityTestSupport
{
protected Executor executor = Executors.newFixedThreadPool(10);
@SuppressWarnings("unchecked")
public void testParallelWorkflow() throws Exception {
// START SNIPPET: example
ExampleService parallelBean = new ExampleService();
ParallelActivity activity =
ParallelActivity.newParallelMethodActivity(executor, parallelBean);
activity.startWithTimeout(timer, 2000);
// END SNIPPET: example
activity.join(10, TimeUnit.SECONDS);
assertStopped(activity);
}
}
When i deploy i am getiing the following error
Caused by: java.lang.NoClassDefFoundError:
org/apache/servicemix/beanflow/ParallelActivity
at
com.cts.ParallelPOC.ParalleExample.Parallelactivitytest.testParallelWorkflow(Para
llelactivitytest.java:32)
Note: i have included the servicemix-beanflow.jar
--
View this message in context:
http://www.nabble.com/Facing-issue-in-ParallelActivity-class-tp15333098s12049p15333098.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.