You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Sherene <ro...@yahoo.co.in> on 2008/02/07 13:46:15 UTC
Facing issue in ParallelActivity class
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.
Re: Facing issue in ParallelActivity class
Posted by Sherene <ro...@yahoo.co.in>.
hi
please find the below pom.xml of JSR component
<?xml version="1.0" encoding="UTF-8"?>
<project>
<parent>
<artifactId>ParalleExample</artifactId>
<groupId>com.cts.ParallelPOC</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.cts.ParallelPOC.ParalleExample</groupId>
<artifactId>Parallel-JSR-SU</artifactId>
<packaging>jbi-service-unit</packaging>
<name>A custom project</name>
<version>1.0-SNAPSHOT</version>
<url>http://www.myorganization.org</url>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<version>${servicemix-version}</version>
<extensions>true</extensions>
<configuration>
<type>service-unit</type>
<useServiceUnitAnalyzer>false</useServiceUnitAnalyzer>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>apache.incubating</id>
<name>Apache Incubating Repository</name>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>apache.incubating</id>
<name>Apache Incubating Repository</name>
<url>http://people.apache.org/repo/m2-incubating-repository</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.codehaus.xfire</groupId>
<artifactId>xfire-jaxws</artifactId>
<version>${xfire-version}</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-jsr181</artifactId>
<version>${servicemix-version}</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-core</artifactId>
<version>${servicemix-version}</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-beanflow</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
</dependency>
</dependencies>
<properties>
<servicemix-version>3.1-incubating</servicemix-version>
<xfire-version>1.2</xfire-version>
</properties>
</project>
Chris Custine (Apache) wrote:
>
> If you haven't resolved this, could you please post your pom.xml for this
> test project?
>
> On Feb 7, 2008 5:46 AM, Sherene <ro...@yahoo.co.in> wrote:
>
>>
>> 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.
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Facing-issue-in-ParallelActivity-class-tp15333098s12049p15426153.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.
Re: Facing issue in ParallelActivity class
Posted by Chris Custine <cc...@apache.org>.
If you haven't resolved this, could you please post your pom.xml for this
test project?
On Feb 7, 2008 5:46 AM, Sherene <ro...@yahoo.co.in> wrote:
>
> 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.
>
>