sjt.mgmt
Interface WorkManager
- All Known Implementing Classes:
- SimpleWorkManager
- public interface WorkManager
WorkManager is the public interface for all SJT.Mgmt threading solutions. It is expected
that other parties may wish to implement better or different solutions other than the ones
provided with this library.
- Since:
- SJT 0.1
Method Summary |
void |
addBlockingWork(java.lang.Runnable work)
In contrast with addWork methods, addBlockingWork adds a wait condition
so that the execution halts once the work is added to the thread manager. |
void |
addBlockingWork(java.lang.Runnable work,
java.lang.Object lock)
The Object lock will be used by the thread manager to notify the callers code. |
void |
addWork(java.lang.Runnable work)
The primary interface to all SJT.Mgmt threading solutions. |
void |
addWork(java.lang.Runnable work,
java.lang.Object lock)
The Object lock is used by the thread manager to notify the callers code. |
void |
destroy()
Destroy can be called by the user code in order to prompt joining and cleanup of all
working threads. |
BLOCK
public static final boolean BLOCK
NON_BLOCK
public static final boolean NON_BLOCK
addWork
public void addWork(java.lang.Runnable work)
- The primary interface to all SJT.Mgmt threading solutions.
- Parameters:
work
- The Runnable instance containing executable code.- Throws:
IllegalStateException
- if not accepting new work.
addWork
public void addWork(java.lang.Runnable work,
java.lang.Object lock)
- The Object lock is used by the thread manager to notify the callers code.
- Parameters:
work
- The Runnable instance containing executable code.lock
- The object which is used as a wait, notify lock. if null then
the wait notify is useless.- Throws:
IllegalStateException
- if not accepting new work.
addBlockingWork
public void addBlockingWork(java.lang.Runnable work)
throws java.lang.InterruptedException
- In contrast with addWork methods, addBlockingWork adds a wait condition
so that the execution halts once the work is added to the thread manager.
- Parameters:
work
- The instance containing executable code.
addBlockingWork
public void addBlockingWork(java.lang.Runnable work,
java.lang.Object lock)
throws java.lang.InterruptedException
- The Object lock will be used by the thread manager to notify the callers code.
- Parameters:
work
- The Rnnable instance containing executable code.lock
- The object which is used as a wait, notify lock. if null then
the wait notify is useless.
destroy
public void destroy()
- Destroy can be called by the user code in order to prompt joining and cleanup of all
working threads. Destroy is also called by the finalize method, during garbage collection,
if the user code does not call it explicitly.