Package net.sodacan.core
Interface Scheduler
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
DefaultScheduler
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(Jug jug) A schedulers job is to accept a message for an actorId.voidaddNewMessage(Jug jug) voidclose()voidvoidevictAll()voidvoidvoidvoidvoidvoidvoidvoidvoidsetActiveThreadCount(int count) voidvoidsetCurrentJobQueue(int count) voidWait for the number of in-flight messages to go to zero.
-
Method Details
-
getConfig
Config getConfig() -
waitForMessagesToFinish
void waitForMessagesToFinish()Wait for the number of in-flight messages to go to zero. There is no assurance that the count will stay at zero.
In production, this is used during an orderly shutdown. It is also useful during testing: Add a bunch of message, wait for the messages to clear (with this method), collect/display statistics, if desired, then exit.
-
addMessage
A schedulers job is to accept a message for an actorId. Create the actor and call the actor's processMessage method.
Called from any thread. Usually delegated from actorGroup's addMessage which does more checking before the message arrives here.
Not a good idea to call this method directly.
- Parameters:
jug- The (Jug) message to be processed
-
addNewMessage
-
getActorGroup
ActorGroup getActorGroup() -
setClosing
void setClosing() -
decreaseMessageLoad
void decreaseMessageLoad() -
incrementActorsEvicted
void incrementActorsEvicted() -
increaseMessageLoad
void increaseMessageLoad() -
incrementSleepTime
void incrementSleepTime() -
incrementActorsRealized
void incrementActorsRealized() -
increaseMessageCount
void increaseMessageCount() -
increaseSaveCount
void increaseSaveCount() -
increaseRestoreCount
void increaseRestoreCount() -
increaseErrorCount
void increaseErrorCount() -
setActiveThreadCount
void setActiveThreadCount(int count) -
setCurrentJobQueue
void setCurrentJobQueue(int count) -
getStatistics
Statistics getStatistics() -
evictAll
void evictAll() -
close
void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-