[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Continuations based Java framework for asynchronous processes development
This message can be considered as kind of follow-up for discussion initiated
by Dan Sugalski about resistance of accepting continuations.
My company just released a Java framework for asynchronous processes
development; http://www.velare.com/product/atct.htm .
It uses Execution Context Reification to implement continuations
functionality in pure Java.
The framework is using an embedded bytecode interpreter to execute
specially marked methods and allows access to execution context as a
serializable Java object. The framework consist of a 60k size jar file
and makes it possible to implement asynchronous method calls in pure
Java.
Although the framework is using continuations internally we decided to
avoid use of the term "continuation" in our documentation, mainly
because it's too much of an advanced concept for average corporate
developers, who are our main target audience. We think that, in our
case, use of traditional Java-thread semantics is more appropriate for
typical application developers.
On the other hand, Java objects representing continuations can be easily
introduced using this framework if you really need it.
The following is a simple code example for asynchronous method call:
public class HelloWorld implements ATCRunnable {
public String getStringToPrint() throws ATCSignal { // this is an
asynchronous method
return null;
}
public void run() throws AISignal {
System.out.println(getStringToPrint());
}
public static void main(String[] args) throws Throwable {
HelloWorld t = new HelloWorld();
ATCThread atct = new ATCThread(t);
//mc represents a call to getStringToPrint
MethodCall mc = atct.start();
//value "Hello World!!!" will be used to continue the execution and will
appear in the print out.
atct.resume("Hello World!!!");
}
}
The framework is available free for download.
Thanks in advance for any feedback.
Serguei Mourachov
www.velare.com