JASF (Java Asynchronous Server Framework) - A first approach
 
Overview :
This is a very basic and experimental framework that help to build asinchronous server applications.
Developers can use it to forget write thread pools, Reactor handlers and memory management in ours applications.
 
Structure :
click to enlarge
The framework can be viewed as three main component.
 
Reactor Manager :
Is the responsible of balance the IOHandlers registrations on the existing Reactors.
Reactor are implementation of the Reactor dessign pattern. This handle the service of request that are deliver concurrently to an application by one or more clients.
The reactor implementation invoke the method defined in the IOHanler Class.
 
Event Dispatcher :
Is a simple thread pool that dispatch the events generated by the IOHanlder.
This can be used by the application to dispatch owns events or completion events (like a Proactor).
 
Buffer Pool Manager :
This facilitates the allocation and management of a buffer poll related to IO operations (very incomplete yet).
 
USE :
To implement a server you need write three component.
IOHandler: their function is service the IO event of a selectable channel. When a channel is ready for some IO operation the reactor invoke the appropiated method.
If the IOHandler determinate that has receive a request then create a ProtocolEvent and dispatch it.
Protocol Event. : This event carries information of the new incomming request and how to proccess.
ProtocolHandler: This component handle the request and generate the response (if any).
In the most cases we contruct a NioServer , then contruct a ProtocolHandler and this registrate ours IOHandlers.
click to enlarge
 
Sample:

"Micro Minimalistic Web Server"

MMWS is a very limitated sample of implementing a protocol whit JASF.
Their only accept the HTTP GET method and service the uri related filed using MMF (Memory mapped files).

Usage:

  1. Modify the CLASSPATH environment variable to include directory /Jasf/classes
    or the file jasf.jar.
  2. Do java org.aonik.jasf.mmws.Mmws DOCROOT
    where DOCROOT is the document root of the site.
 
JavaDoc API Documentation
Consult the API documentation here
 
Links :
POSA (Pattern-Oriented Software Architecture)
http://www.posa.uci.edu/
SEDA (An Architecture for Highly Concurrent Server Applications)
http://www.cs.berkeley.edu/~mdw/proj/sandstorm/
 
Download :
you can download here
 
TO DO :
Enhance the Buffer pool management: This can manage brigades of buffers like apache 1.3 and must implement method to write data to this brigades.
Build a bridge that join old Input and Output Streams with new non-bloking IO.
Write a decent documentation ;-)
Solve plataform bugs of 1.4.1 . (sun).
Add Log features.

SourceForge Logo