com.notuvy.thread
Class ThreadWorker

java.lang.Object
  extended by com.notuvy.thread.ThreadWorker
All Implemented Interfaces:
ThreadControllable

public class ThreadWorker
extends Object
implements ThreadControllable

A separate thread engine that executes a given Runnable. The purpose of this is to avoid doing "new Thread()" an arbitrary number of times. Instead, a single thread is kept and it processes each give Runnable.

Author:
murali

Field Summary
protected static org.apache.log4j.Logger LOG
           
 
Constructor Summary
ThreadWorker(String pName)
           
ThreadWorker(String pName, int pNumberThreads)
           
 
Method Summary
 Future<?> enqueueAsync(Runnable pRunnable)
           
 void enqueueSync(Runnable pRunnable)
           
 ThreadControl getControl()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.log4j.Logger LOG
Constructor Detail

ThreadWorker

public ThreadWorker(String pName)

ThreadWorker

public ThreadWorker(String pName,
                    int pNumberThreads)
Method Detail

getControl

public ThreadControl getControl()
Specified by:
getControl in interface ThreadControllable

enqueueSync

public void enqueueSync(Runnable pRunnable)

enqueueAsync

public Future<?> enqueueAsync(Runnable pRunnable)


Copyright © 2013. All Rights Reserved.