|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmome.Executor
public class Executor
Executor is a class where actual command events dispatching occurs. It
encapsulates a thread in which commands processing occurs. The Thread can be
started and stopped via start()
, stop()
respectively. It
maintains the command events queue. So any number of commands can be
activated while another command is processed. It also maintains a heap of
used command events, so new CommandEvent object need not to be created if
there is used one.
Nested Class Summary | |
---|---|
(package private) class |
Executor.CommandEvent
Command - Source association. |
Field Summary | |
---|---|
static int |
DEFAULT_COMMAND_EVENTS_HEAP_SIZE
Default size of CommandEvents heap. |
Constructor Summary | |
---|---|
Executor()
Instantiates Executor. |
|
Executor(int commandEventsHeapSize)
Instantiates Executor. |
Method Summary | |
---|---|
protected Executor.CommandEvent |
getCommandEvent(Object cmd,
Object src)
Returns CommandEvent instance populated with values. |
XCommandListener |
getXCommandListener()
Returns XCommandListener whose xCommanAction method is called for
processing commands in execution thread. |
void |
pushCommand(Object cmd,
Object src)
Pushes command event (command and source) to the commands execution thread. |
protected void |
releaseCommandEvent(Executor.CommandEvent cmdRec)
If heap is not full, populates it with specified CommandEvent. |
void |
run()
Processes command events serially by dispatching to XCommandListener.xCommandAction(Object, Object) . |
void |
setXCommandListener(XCommandListener commandListener)
Sets the XCommandListener for processing command events in the
commands execution thread. |
void |
start()
Starts the execution thread. |
void |
stop()
Stops the execution thread. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_COMMAND_EVENTS_HEAP_SIZE
Executor class to omit needless creating and garbage-collecting of CommandEvent instances maintains the heap of used CommandEvents
Constructor Detail |
---|
public Executor()
public Executor(int commandEventsHeapSize)
commandEventsHeapSize
- Size of CommandEvents heap. If commandEventsHeapSize is not
positive the default value (8) is used.
Executor class to omit needless creating and garbage-collecting of CommandEvent instances maintains the heap of used CommandEvents. Heap is dynamically populated.
Note This is not a number of commands, that can be simultaneously activated - this number is unlimited.
Note This constructor should be used in extra situations.
Method Detail |
---|
protected Executor.CommandEvent getCommandEvent(Object cmd, Object src)
cmd
- Object identifying the command.src
- Object on which this event has occurred.
protected void releaseCommandEvent(Executor.CommandEvent cmdRec)
cmdRec
- CommandEvent to be saved in heap.public void pushCommand(Object cmd, Object src)
cmd
- An object identifying the command.src
- An object on which this event has occurred. Either Displayable or
Item or can be used as parameter for any user command.public void start()
public void stop()
public XCommandListener getXCommandListener()
XCommandListener
whose xCommanAction method is called for
processing commands in execution thread.
null
otherwise.public void setXCommandListener(XCommandListener commandListener)
XCommandListener
for processing command events in the
commands execution thread.
commandListener
- XCommandListener for processing command eventspublic void run()
XCommandListener.xCommandAction(Object, Object)
.
run
in interface Runnable
Runnable.run()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |