|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.levigo.util.swing.PendingOperations
public class PendingOperations
Keep track of pending operations that might inhibit the shutdown of a component or the shutdown of the whole application.
Of course, it can also serve to request if a specific operation is already running in order to avoid starting the same operation twice.
Each instance of this class owns a context. Therefore this class can be used by different application parts to keep track of their running background processes.
Usage:
PendingOperations.getInstance("myApplication").operationStarted(myObject); ... PendingOperations.getInstance("myApplication").operationFinished(myObject);Other application part might want to know if a specific operation is already running:
PendingOperations.getInstance("myApplication").isOperationPending(myObject);or if any operation is running for a given context
PendingOperations.getInstance("myApplication").isOperationPending();
Method Summary | |
---|---|
void |
finished(Object key)
Notify this instance that the operation that was registered as pending under the given key is finished now. |
static PendingOperations |
getInstance(Object context)
The context to add, query or remove an operation for. |
Vector<Object> |
getPendingOperations()
Returns a flat copy of the pendingOperations, mostly for logging purposes. |
boolean |
isPending()
Ask if any operation is still running in the current instance's context. |
boolean |
isPending(Object key)
Ask if the specified operation is still running in the current instance's context. |
void |
started(Object key)
Notify this instance that given operation should be registered as pending. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static PendingOperations getInstance(Object context)
context
- The category or sub-application to inquirepublic void started(Object key)
key
- The object that serves as key for registering a pending
operation.public void finished(Object key)
key
- The object that serves as key for registering a pending
operation.public boolean isPending(Object key)
key
- The key of the operation to look up in the list of pending
operations
public boolean isPending()
public Vector<Object> getPendingOperations()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |