com.antiaction.mayhem.core
Class ThreadPool

java.lang.Object
  extended by com.antiaction.mayhem.core.ThreadPool
All Implemented Interfaces:
IThreadPool

public class ThreadPool
extends java.lang.Object
implements IThreadPool

Advanced ThreadPool manager.

Version:
1.00
Author:
Nicholas Clarke

Constructor Summary
ThreadPool()
           
 
Method Summary
 void checkIn()
          Notify thread pool that a thread has gone inactive.
 void checkOut()
          Notify thread bool that a thread has gone active.
 boolean init(java.util.HashMap props)
          Initialize object with specified properties.
 void register()
          Notify thread pool that a new thread is running.
 void setThreadMold(IThreadWorker _threadWorker)
          Sets the Thread mold for this ThreadPool, which is used either directly or for cloning.
 boolean start()
          Activate the broker.
 boolean stop()
          Callback to let threads know they should shutdown.
 void unregister()
          Notify thread pool that a thread has stopped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadPool

public ThreadPool()
Method Detail

init

public boolean init(java.util.HashMap props)
Description copied from interface: IThreadPool
Initialize object with specified properties.

Specified by:
init in interface IThreadPool
Parameters:
props - init properties.

setThreadMold

public void setThreadMold(IThreadWorker _threadWorker)
Description copied from interface: IThreadPool
Sets the Thread mold for this ThreadPool, which is used either directly or for cloning. The worker object must be initialized and the clone implementation must re-init the clone to an identical state.

Specified by:
setThreadMold in interface IThreadPool
Parameters:
_threadWorker - Set the Thread mold for this broker.

register

public void register()
Description copied from interface: IThreadPool
Notify thread pool that a new thread is running.

Specified by:
register in interface IThreadPool
See Also:
IThreadPool.unregister()

unregister

public void unregister()
Description copied from interface: IThreadPool
Notify thread pool that a thread has stopped.

Specified by:
unregister in interface IThreadPool
See Also:
IThreadPool.register()

checkIn

public void checkIn()
Description copied from interface: IThreadPool
Notify thread pool that a thread has gone inactive.

Specified by:
checkIn in interface IThreadPool
See Also:
IThreadPool.checkOut()

checkOut

public void checkOut()
Description copied from interface: IThreadPool
Notify thread bool that a thread has gone active.

Specified by:
checkOut in interface IThreadPool
See Also:
IThreadPool.checkIn()

stop

public boolean stop()
Description copied from interface: IThreadPool
Callback to let threads know they should shutdown. (random victims)

Specified by:
stop in interface IThreadPool

start

public boolean start()
Description copied from interface: IThreadPool
Activate the broker.

Specified by:
start in interface IThreadPool


Copyright © 2001-2004 Nicholas Clarke. All Rights Reserved.