• 0.26.0

Executing method in multiple threads

Methods annotated with @Parallel will be executed in multiple threads (depending on the threads annotation parameter):

public class FooTest {
  public void canProcessInParallel() {
    final Foo foo = new Foo();
    new Runnable() {
      @Parallel(threads = 15)
      public void run() {

The above code will execute the run() method in 15 threads (15 separate invocations). As a result, the process() method of the Foo class will also be executed in those threads.

The mechanism is implemented with AOP/AspectJ. Read how to integrate it into your pom.xml.