public interface ProcessManager extends ProcessManagerStatusProvider
A ProcessManager delivers:
ProcessManagerStatusProvider#completeStartup() method has been called)FileMonitorService at well-defined timesCommandCallbacks for user-requested
operations
Once constructed, all methods in ProcessManager operate in a
"transaction-like" manner. This is achieved by use of a FileManager
that shares the same UndoManager.
Once available, a ProcessManager will ordinarily wait for either
#backgroundScan() or execute(CommandCallback). It will block
until the state of the ProcessManager returns to
ProcessManagerStatus.AVAILABLE.
ProcessManager guarantees:
ProcessManagerStatus.STARTING until
#completeStartup() has been called. This is intended to allow objects
depending on ProcessManager or other MetadataServices to be
constructed and register for events. The initial monitoring requests will
only be registered during #completeStartup(), which therefore
simplifies the design of dependent objects as they generally (i) don't need
to retrieve metadata produced before they were listening and (ii) can freely
modify the file system pursuant to FileManager with assurance of
correct "transaction" behaviour.UndoManager.reset() method will be called.UndoManager.undo() to be called
(before re-throwing the exception).FileMonitorService.scanAll() will be called after a command is
executed, and will continue to be called until such time as it does not
return any further changes. Such calls will occur within the scope of the
same "transaction" as used for the command.
ProcessManager implementations also guarantee to update
ActiveProcessManager whenever running an operation, and clear it when
an operation completes.
| Modifier and Type | Method and Description |
|---|---|
<T> T |
execute(CommandCallback<T> callback)
Execute a user command within a "transaction".
|
long |
getLastScanDuration() |
long |
getMinimumDelayBetweenScan() |
boolean |
isDevelopmentMode() |
void |
setDevelopmentMode(boolean developmentMode) |
void |
setMinimumDelayBetweenScan(long minimumDelayBetweenScan) |
void |
terminate()
Allows the process manager to terminate gracefully.
|
void |
timerBasedScan() |
addProcessManagerStatusListener, getProcessManagerStatus, removeProcessManagerStatusListener<T> T execute(CommandCallback<T> callback)
ProcessManagerStatus.AVAILABLE.
This method may throw RuntimeExceptions that occurred while
executing.
T - the class of the object that
CommandCallback.callback() will return (required)callback - the callback to actually executed (required)long getLastScanDuration()
long getMinimumDelayBetweenScan()
boolean isDevelopmentMode()
void setDevelopmentMode(boolean developmentMode)
void setMinimumDelayBetweenScan(long minimumDelayBetweenScan)
void terminate()
void timerBasedScan()
Copyright © 2009–2016. All rights reserved.