| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| protected final ContextManager | |
| protected final ContextService | |
| private int | |
| private final List | highPQ
Queues for the work to be done. |
| private boolean | |
| private long | |
| private int | nextService
which subscribed clients to service next? |
| private final List | |
| private int | |
| private static final int | |
| private boolean | |
| private boolean | |
| private boolean | |
| private final Vector | |
| private boolean | waiting
true if I'm waiting, if this is false then I am running and a notify is not required. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | clear()
Implements org. Get rid of all queued up Serviceable tasks. |
| public boolean | enqueue(Serviceable
the object that needs a one time service newClient, boolean if true, this client should be serviced ASAP, as if a
serviceNow has been issued. If false, then this client will be
serviced with the normal scheduled. serviceNow)Implements org. Request a one time service from the Daemon. |
| pack-priv static ModuleFactory | |
| private synchronized boolean | |
| protected ServiceRecord | |
| public void | |
| private boolean | |
| public void | resume()
Implements org. Resume service after a pause |
| public void | |
| protected void | |
| public void | serviceNow(int
the number that uniquely identifies the client clientNumber)Implements org. Service this subscription ASAP. |
| private static void | setThreadPriority(ModuleFactory mf, final int priority)
Change the priority of the current thread, but only if it was created
by |
| public void | stop()
Implements org. Finish what we are doing and at the next convenient moment, get rid of the thread and make the daemon object goes away if possible. |
| private synchronized boolean | |
| public int | subscribe(Serviceable
a Serviceable object this daemon will service from time to time newClient, boolean only service this client when it ask for service with a serviceNow request onDemandOnly)Implements org. Add a new client that this daemon needs to service |
| public void | unsubscribe(int
client identifier clientNumber)Implements org. Removes a client from the list of subscribed clients. |
| public void | |
| protected synchronized void | |
| private void | |
| private void |
| awakened | back to summary |
|---|---|
| private boolean awakened | |
| contextMgr | back to summary |
|---|---|
| protected final ContextManager contextMgr | |
| contextService | back to summary |
|---|---|
| protected final ContextService contextService | |
| earlyWakeupCount | back to summary |
|---|---|
| private int earlyWakeupCount | |
| highPQ | back to summary |
|---|---|
| private final List<ServiceRecord> highPQ Queues for the work to be done. These are synchronized by this object. | |
| inPause | back to summary |
|---|---|
| private boolean inPause | |
| lastServiceTime | back to summary |
|---|---|
| private long lastServiceTime | |
| nextService | back to summary |
|---|---|
| private int nextService which subscribed clients to service next? only accessed by daemon thread | |
| normPQ | back to summary |
|---|---|
| private final List<ServiceRecord> normPQ | |
| numClients | back to summary |
|---|---|
| private int numClients | |
| OPTIMAL_QUEUE_SIZE | back to summary |
|---|---|
| private static final int OPTIMAL_QUEUE_SIZE | |
| running | back to summary |
|---|---|
| private boolean running | |
| stopped | back to summary |
|---|---|
| private boolean stopped | |
| stopRequested | back to summary |
|---|---|
| private boolean stopRequested | |
| subscription | back to summary |
|---|---|
| private final Vector<ServiceRecord> subscription | |
| waiting | back to summary |
|---|---|
| private boolean waiting true if I'm waiting, if this is false then I am running and a notify is not required. | |
| BasicDaemon | back to summary |
|---|---|
| public BasicDaemon(ContextService contextService) make a BasicDaemon | |
| clear | back to summary |
|---|---|
| public synchronized void clear() Implements org. Get rid of all queued up Serviceable tasks. | |
| enqueue | back to summary |
|---|---|
| public boolean enqueue(Serviceable newClient, boolean serviceNow) Implements org. Doc from org. Request a one time service from the Daemon. Unless performWork returns REQUEUE (see Serviceable), the daemon will service this client once and then it will get rid of this client. Since no client number is associated with this client, it cannot request to be serviced or be unsubscribed. The work is always added to the deamon, regardless of the state it returns.
| |
| getMonitor | back to summary |
|---|---|
| pack-priv static ModuleFactory getMonitor() Must be package private so that user code can't call this entry point. | |
| inPause | back to summary |
|---|---|
| private synchronized boolean inPause() | |
| nextAssignment | back to summary |
|---|---|
| protected ServiceRecord nextAssignment(boolean urgent) | |
| pause | back to summary |
|---|---|
| public void pause() Implements org. Doc from org. Pause. No new service is performed until a resume is issued. | |
| rest | back to summary |
|---|---|
| private boolean rest() Returns true if awakened by some notification, false if wake up by timer | |
| resume | back to summary |
|---|---|
| public void resume() Implements org. Doc from org. Resume service after a pause | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation. | |
| serviceClient | back to summary |
|---|---|
| protected void serviceClient(ServiceRecord clientRecord) | |
| serviceNow | back to summary |
|---|---|
| public void serviceNow(int clientNumber) Implements org. Doc from org. Service this subscription ASAP. When this method is called, the
subscriber's
| |
| setThreadPriority | back to summary |
|---|---|
| private static void setThreadPriority(ModuleFactory mf, final int priority) Change the priority of the current thread, but only if it was created
by | |
| stop | back to summary |
|---|---|
| public void stop() Implements org. Finish what we are doing and at the next convenient moment, get rid of the thread and make the daemon object goes away if possible. remember we are calling from another thread | |
| stopRequested | back to summary |
|---|---|
| private synchronized boolean stopRequested() | |
| subscribe | back to summary |
|---|---|
| public int subscribe(Serviceable newClient, boolean onDemandOnly) Implements org. Doc from org. Add a new client that this daemon needs to service
| |
| unsubscribe | back to summary |
|---|---|
| public void unsubscribe(int clientNumber) Implements org. Removes a client from the list of subscribed clients. The call does not
wait for the daemon to finish the work it is currently performing.
Therefore, the client must tolerate that its
| |
| waitUntilQueueIsEmpty | back to summary |
|---|---|
| public void waitUntilQueueIsEmpty() Implements org. | |
| wakeUp | back to summary |
|---|---|
| protected synchronized void wakeUp() | |
| work | back to summary |
|---|---|
| private void work(boolean urgentOnly) | |
| yieldNow | back to summary |
|---|---|
| private void yieldNow() | |