C
- public abstract class EfferentCommandManager<C extends IEfferentCommand>
extends java.lang.Object
newCommand(IEfferentObject, Object...)
request changes (
request(DeltaTracker, org.commonreality.efferent.IEfferentCommand.RequestedState)
, execute and abort (execute(DeltaTracker)
abort(DeltaTracker)
), and upon completion (typically called from
commandCompleted(IEfferentCommand)
and
#commandAborted(IEfferentCommand)
), the ability to remove the
command.Constructor and Description |
---|
EfferentCommandManager(java.util.concurrent.Executor executor) |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.Future<C> |
abort(DeltaTracker<? extends IMutableObject> commandChange)
request that the command be aborted
|
void |
clear()
explicitly request that executing commands are aborted, and issue a remove
for all the other commands.
|
protected abstract void |
commandAborted(C command,
boolean wasRequested)
call back executed on the CR executor
|
protected abstract void |
commandAccepted(C command)
call back executed on the CR executor
|
protected abstract void |
commandCompleted(C command)
call back executed on the CR executor
|
protected abstract void |
commandRejected(C command)
call back executed on the CR executor
|
protected void |
commandRemoved(C command)
call back executed on the CR executor
|
protected abstract void |
commandRunning(C command)
call back executed on the CR executor
|
protected abstract C |
createCommand(IEfferentObject object,
java.lang.Object... parameters)
create the command using the provided efferent object, from which a
template should be extracted and instantiated
|
java.util.concurrent.Future<C> |
execute(DeltaTracker<? extends IMutableObject> commandChange)
request that the command be executed
|
IAgent |
getAgent() |
C |
getCommand(IIdentifier commandId) |
java.util.Set<IIdentifier> |
getExecutingCommandIds(java.util.Set<IIdentifier> container) |
java.util.Collection<C> |
getExecutingCommands(java.util.Collection<C> container)
return all the commands that are currently executing
|
protected IndividualCommandManager<C> |
getIndividualManager(IIdentifier commandId) |
protected java.util.concurrent.locks.ReentrantReadWriteLock |
getLock() |
IEfferentObject |
getMuscle(IIdentifier muscleId) |
void |
install(IAgent agent) |
boolean |
isAutoDeleteEnabled() |
boolean |
isExecuting() |
protected boolean |
isInterestedIn(IEfferentCommand command) |
java.util.concurrent.Future<C> |
newCommand(IEfferentObject object,
java.lang.Object... parameters)
create and submit a new command.
|
protected C |
newCommandInternal(IEfferentObject object,
java.lang.Object... parameters)
creates and submits the command, w/o using the future..
|
void |
remove(C command)
request removal
|
protected java.util.concurrent.Future<C> |
request(DeltaTracker<? extends IMutableObject> commandChange,
IEfferentCommand.RequestedState requestedState) |
protected void |
send(DeltaTracker<? extends IMutableObject> commandUpdate) |
void |
setAutoDeleteEnabled(boolean enabled) |
void |
uninstall(IAgent agent) |
public EfferentCommandManager(java.util.concurrent.Executor executor)
protected java.util.concurrent.locks.ReentrantReadWriteLock getLock()
public void install(IAgent agent)
public void uninstall(IAgent agent)
protected IndividualCommandManager<C> getIndividualManager(IIdentifier commandId)
public IAgent getAgent()
public IEfferentObject getMuscle(IIdentifier muscleId)
public C getCommand(IIdentifier commandId)
public boolean isAutoDeleteEnabled()
public void setAutoDeleteEnabled(boolean enabled)
public void clear()
public final boolean isExecuting()
public final java.util.Set<IIdentifier> getExecutingCommandIds(java.util.Set<IIdentifier> container)
container
- public final java.util.Collection<C> getExecutingCommands(java.util.Collection<C> container)
container
- protected final C newCommandInternal(IEfferentObject object, java.lang.Object... parameters)
object
- parameters
- public final java.util.concurrent.Future<C> newCommand(IEfferentObject object, java.lang.Object... parameters)
createCommand(IEfferentObject, Object...)
and can be used in
anyway desired. object
- parameters
- public java.util.concurrent.Future<C> execute(DeltaTracker<? extends IMutableObject> commandChange)
commandChange
- public java.util.concurrent.Future<C> abort(DeltaTracker<? extends IMutableObject> commandChange)
commandChange
- protected java.util.concurrent.Future<C> request(DeltaTracker<? extends IMutableObject> commandChange, IEfferentCommand.RequestedState requestedState)
protected void send(DeltaTracker<? extends IMutableObject> commandUpdate)
public final void remove(C command)
command
- protected boolean isInterestedIn(IEfferentCommand command)
protected abstract C createCommand(IEfferentObject object, java.lang.Object... parameters)
object
- protected abstract void commandAccepted(C command)
command
- protected abstract void commandRejected(C command)
command
- protected abstract void commandRunning(C command)
command
- protected abstract void commandAborted(C command, boolean wasRequested)
command
- protected abstract void commandCompleted(C command)
command
- protected void commandRemoved(C command)
command
-