My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

Async Future

An API extension for Java Futures and Non-Blocking + Asynchronous I/O and possibly other use-cases (see below).

Introduction

The first sentence of the Java API Doc for Futures says:

A Future represents the result of an asynchronous computation.

In reality it's the result of an asynchronously scheduled or executed computation while the computation itself is a synchronous process. The process is represented by a Runnable or Callable object. Each computation is utilizing at least one Thread throughout its life-time and the Thread is being released when the run() or call() methods return.

The problem with this system is that it does not scale very well if the computations are non-deterministic in terms of the time they need to complete and it is also wasting resources if the computations are being performed in a distributed environment (i.e. on a remote machine).

AsyncFutures extend the concept of Futures by three simple features to solve these problems.

  1. Timeouts
  2. Callbacks
  3. Asynchronous Processes

Timeouts ensure that all computations are deterministic in terms of the time they need to complete. Callbacks enable the user to receive completion events instead of having to wait for the Futures to complete and Asynchronous Processes allow the user to start a computation and let an another Thread (like a NIO Network Thread) return the result.

NOTE: As of version 0.4 AsyncFutureTask may be used as a drop-in replacement for FutureTasks. Prior versions work slightly differently and are not suitable to replace FutureTasks.

Networking

To be written but see Examples for little examples with HttpCore 4.0.1 + NIO and Apache MINA.

Other

To be written

Powered by Google Project Hosting