de.netseeker.ejoe.concurrent
Interface ThreadService

All Known Implementing Classes:
Jdk15ThreadPool, ThreadPool

public interface ThreadService

A ThreadService is a wrapper around an implementation of a ThreadPool. It's just a unique, abstract interface for controlling all kinds of possible ThreadPools, which can be used by EJOE.

Since:
0.3.9.1
Author:
netseeker

Method Summary
 int getActiveWorkerCount()
          Returns the amount of worker threads which are active.
 int getCurrentPoolsize()
          Returns the amount of workers which are really usable in the underlying ThreadPool.
 int getExpectedPoolsize()
          Returns the amount of workers the ThreadService expects to to have in the underlying ThreadPool according to the currently active pool size.
 void invokeLater(java.lang.Runnable task)
          Queues a new task for asynchronous execution in the underlying ThreadPool
 void resize(int poolSize)
          Resizes the amount of worker threads in the ThreadService to the given size.
 void stop()
          Shutdown the underlying ThreadPool
 

Method Detail

invokeLater

void invokeLater(java.lang.Runnable task)
Queues a new task for asynchronous execution in the underlying ThreadPool

Parameters:
task - a task to execute within one of the available worker threads

stop

void stop()
Shutdown the underlying ThreadPool


getActiveWorkerCount

int getActiveWorkerCount()
Returns the amount of worker threads which are active. Hereby "active" means the worker is currently executing a task.

Returns:
the amount of currently active workers in the underlying ThreadPool

getCurrentPoolsize

int getCurrentPoolsize()
Returns the amount of workers which are really usable in the underlying ThreadPool. The amount can differ from getExpectedPoolsize() caused by crashed (or due to too less memory unstarted) worker threads.

Returns:
the amount of really usable worker threads in the underlying ThreadPool

getExpectedPoolsize

int getExpectedPoolsize()
Returns the amount of workers the ThreadService expects to to have in the underlying ThreadPool according to the currently active pool size.

Returns:
the amount of workers which should be started in the underlying ThreadPool

resize

void resize(int poolSize)
Resizes the amount of worker threads in the ThreadService to the given size.

Parameters:
poolSize - the new amount of worker threads in the ThreadService


Copyright © 2005-2007 netseeker. All Rights Reserved.