Latest News

July 9, 2011
Version 0.9.2-beta has been released.

Check out the project updates page.

Presentations

View the slides from the Oct 26th presentation to the Wellington Java User Group (WJUG).

Quickstart

Jump to the quickstart guide.

Velai Threads for Java is an open source framework to simplify the creation of threaded code within Java applications.

Features

Velai Threads for Java makes use of annotations and reflection to enable you to easily support all of the features below, with minimal coding effort.

Cancellation

Request the task to cancel. Check for cancellation requests.

Pausing

Pause a task in the middle of its operation and then unpause when you wish.

Timing

Know how long a task has taken to execute. Know how long ago a task completed.

Exceptions

You don't have to write any special code to record exceptions thrown by threads.

State

Monitor the state of any task. Attach listeners to state changes.

Extend

Uses interfaces and annotations. Subclass your tasks without Velai getting in the way.

Patterns

Out-of-box support for barrier, parallel and sequential patterns.

Example

Check out the simple example below. That is all you need to do to enable out-of-the-box support for:

  • executing it synchronously (in the same thread) or asynchronously (in a thread of its own)
  • task cancellation
  • pausing and unpausing the task
  • timing how long it takes to execute
  • monitoring its state
  • and so many other things with only a small amount of additional code
public class MyTask implements Callable<Void> {
  @Context
  private ExecutionContext execution;

  public Void call() throws Exception {
    while (!execution.isCancellationRequested(true)) {
      // do stuff
    }
    return null;
  }
}