Monday, August 5, 2013

Generic Queue & Consumer Implementation using Java


Here I have implemented a generic queue and consumer using Java.

Java Implementation Source Code
https://github.com/harsha1979/lightweightqueue.git


 //Create an ExecutionEngine and start.

boolean isAutoStart = false ;
boolean isAutoRestart = false ;


//Time Delay in Millisecond
int timeDelay = 100 ;
int queueLength - 100 ;

//ExecutorImpl is an implementation of the Executor to do the task when the executor do execute.

Executor executor = new ExecutorImpl();

ExecutionEngine executionEngine =  new ExecutionEngine<CustomBean>(executor,isAutoStart,        isAutoRestart,timeDelay,queueLength);

executionEngine.startEngine();

//Put an element to the queue
CustomBean customBean = new CustomBean();
executionEngine.getSynchQueue().put(customBean);

No comments:

Post a Comment