|
|||||||||
| Home >> All >> org >> gui4j >> [ core overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.gui4j.core
Class Gui4jThreadManager

java.lang.Objectorg.gui4j.core.Gui4jThreadManager
- All Implemented Interfaces:
- org.gui4j.exception.ErrorTags, java.io.Serializable
- public final class Gui4jThreadManager
- extends java.lang.Object
- implements org.gui4j.exception.ErrorTags, java.io.Serializable
- extends java.lang.Object
The Thread Manager deals with worker threads used to perform GUI actions. The intention is to take a thread from a pool, use this thread to perform the necessary action and then put the thread back into the pool.
| Nested Class Summary | |
private static class |
Gui4jThreadManager.InvokerCallStack
|
class |
Gui4jThreadManager.WorkerThread
|
private static class |
Gui4jThreadManager.WorkPackage
|
| Field Summary | |
private int |
mFreeThreadCount
|
protected Gui4jInternal |
mGui4j
|
protected boolean |
mHighPriorityThreadActive
|
protected static org.apache.commons.logging.Log |
mLogger
|
private int |
mMaxNumberOfWorkerThreads
|
private java.util.LinkedList |
mThreadPool
|
private boolean |
mUseWorkerThreads
|
private int |
mWorkerCount
|
private int |
mWorkPackageCount
|
private java.util.LinkedList |
mWorkPackages
|
| Constructor Summary | |
private |
Gui4jThreadManager(Gui4jInternal gui4j,
int numberOfWorkerThreads)
Constructor for Gui4jThreadManager. |
| Method Summary | |
void |
clearThreadsInPool()
|
static void |
executeInSwingThreadAndContinue(java.lang.Runnable run)
The given task is executed in the GUI thread as soon as possible. |
static void |
executeInSwingThreadAndWait(java.lang.Runnable run)
Insertes the given Runnable into the task queue of the GUI Thread. |
static Gui4jThreadManager |
getNewInstance(Gui4jInternal gui4j,
int numberOfWorkerThreads)
|
protected Gui4jThreadManager.WorkerThread |
getWorkerThread(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue[] work,
java.util.Map paramMap,
Gui4jComponentInstance actionHandler,
Gui4jThreadManager.InvokerCallStack callStack,
boolean isHighPriorityThread)
|
void |
performPriorityWork(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue[] work,
java.util.Map paramMap,
Gui4jComponentInstance actionHandler)
|
void |
performPriorityWork(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue[] work,
java.util.Map paramMap,
Gui4jComponentInstance actionHandler,
boolean forceExecutionInCurrentThread)
Performs the given work. |
void |
performWork(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue[] work,
java.util.Map paramMap)
Performs the given work. |
void |
performWork(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue[] work,
java.util.Map paramMap,
boolean forceExecutionInCurrentThread)
Performs the given work. |
void |
performWork(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue[] work,
java.util.Map paramMap,
Gui4jComponentInstance actionHandler)
|
void |
performWork(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue[] work,
java.util.Map paramMap,
Gui4jComponentInstance actionHandler,
boolean forceExecutionInCurrentThread)
Performs the given work. |
private void |
performWork(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue[] work,
java.util.Map paramMap,
Gui4jComponentInstance actionHandler,
boolean forceExecutionInCurrentThread,
boolean isHighPriorityThread)
Performs the given work. |
void |
performWork(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue action,
java.util.Map paramMap)
Perform the given work. |
void |
performWork(org.gui4j.Gui4jCallBase gui4jController,
org.gui4j.Gui4jGetValue action,
java.util.Map paramMap,
boolean forceExecutionInCurrentThread)
Perform the given work. |
protected void |
putThreadBackIntoPool(Gui4jThreadManager.WorkerThread thread)
|
void |
setNumberOfWorkerThreads(int numberOfWorkerThreads)
Sets the maximum number of worker threads. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
mLogger
protected static org.apache.commons.logging.Log mLogger
mThreadPool
private java.util.LinkedList mThreadPool
mWorkPackages
private java.util.LinkedList mWorkPackages
mHighPriorityThreadActive
protected boolean mHighPriorityThreadActive
mGui4j
protected final Gui4jInternal mGui4j
mFreeThreadCount
private int mFreeThreadCount
mWorkPackageCount
private int mWorkPackageCount
mWorkerCount
private int mWorkerCount
mMaxNumberOfWorkerThreads
private int mMaxNumberOfWorkerThreads
mUseWorkerThreads
private boolean mUseWorkerThreads
| Constructor Detail |
Gui4jThreadManager
private Gui4jThreadManager(Gui4jInternal gui4j, int numberOfWorkerThreads)
- Constructor for Gui4jThreadManager.
| Method Detail |
getNewInstance
public static Gui4jThreadManager getNewInstance(Gui4jInternal gui4j, int numberOfWorkerThreads)
setNumberOfWorkerThreads
public void setNumberOfWorkerThreads(int numberOfWorkerThreads)
- Sets the maximum number of worker threads. The value
-1represents an unlimited number of threads. Value0implies always using the Swing GUI Thread. Any number greater than0really sets the maximum number of worker threads. If there is work to do and no worker is free, then the work is put into a FIFO queue and handled when worker gets free.
performWork
public void performWork(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue[] work, java.util.Map paramMap)
- Performs the given work. Dependant of the number of maximum worker threads, the work is either
performed in the same thread, or by a new worker, or put into a FIFO queue.
performWork
public void performWork(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue[] work, java.util.Map paramMap, boolean forceExecutionInCurrentThread)
- Performs the given work. Dependant of the number of maximum worker threads, the work is either
performed in the same thread, or by a new worker, or put into a FIFO queue.
performWork
public void performWork(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue[] work, java.util.Map paramMap, Gui4jComponentInstance actionHandler)
performPriorityWork
public void performPriorityWork(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue[] work, java.util.Map paramMap, Gui4jComponentInstance actionHandler)
performWork
public void performWork(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue[] work, java.util.Map paramMap, Gui4jComponentInstance actionHandler, boolean forceExecutionInCurrentThread)
- Performs the given work. Dependant of the number of maximum worker threads, the work is either
performed in the same thread, or by a new worker, or put into a FIFO queue.
performPriorityWork
public void performPriorityWork(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue[] work, java.util.Map paramMap, Gui4jComponentInstance actionHandler, boolean forceExecutionInCurrentThread)
- Performs the given work. Dependant of the number of maximum worker threads, the work is either
performed in the same thread, or by a new worker, or put into a FIFO queue.
performWork
private void performWork(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue[] work, java.util.Map paramMap, Gui4jComponentInstance actionHandler, boolean forceExecutionInCurrentThread, boolean isHighPriorityThread)
- Performs the given work. Dependant of the number of maximum worker threads, the work is either
performed in the same thread, or by a new worker, or put into a FIFO queue.
performWork
public void performWork(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue action, java.util.Map paramMap)
- Perform the given work.
performWork
public void performWork(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue action, java.util.Map paramMap, boolean forceExecutionInCurrentThread)
- Perform the given work.
getWorkerThread
protected Gui4jThreadManager.WorkerThread getWorkerThread(org.gui4j.Gui4jCallBase gui4jController, org.gui4j.Gui4jGetValue[] work, java.util.Map paramMap, Gui4jComponentInstance actionHandler, Gui4jThreadManager.InvokerCallStack callStack, boolean isHighPriorityThread)
putThreadBackIntoPool
protected void putThreadBackIntoPool(Gui4jThreadManager.WorkerThread thread)
clearThreadsInPool
public void clearThreadsInPool()
executeInSwingThreadAndWait
public static void executeInSwingThreadAndWait(java.lang.Runnable run)
- Insertes the given
Runnableinto the task queue of the GUI Thread. If the calling thread is the GUI thread, this call immediately returns. If the calling thread is not the GUI thread, this call does not return until the GUI thread has completed the task.
executeInSwingThreadAndContinue
public static void executeInSwingThreadAndContinue(java.lang.Runnable run)
- The given task is executed in the GUI thread as soon as possible. There are two cases:
If this thread is not the GUI thread, the givenRunnableis inserted into the task queue of the GUI thread. This call then returns immediately without waiting for the scheduled task to be finished.
If this thread is the GUI thread itself, the given task is executed immediately and synchronously, i.e. this call will not return until the task is completed.
|
|||||||||
| Home >> All >> org >> gui4j >> [ core overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.gui4j.core.Gui4jThreadManager