T - as TokenE - as TokenEventpublic interface TokenManager<T extends Token<T>,S extends Shift<T>,E extends TokenEvent<T>> extends ChangeGenerator<E>, TokenContainerService<T,S>
Token and the interactions with the receiving part.TokenManager maybe same or different from a TokenDispatcher in the sense that the Dispatcher is a centralized control system
while the Manager is the local manager of the Q in a de-centralized system. There is a One-To-Many relation from dispatcher to manager.
BatchService are re-mentioned to define their significance. In a token management scenario,
the meaning of a token in a Batch is restricted to only those available/ready in the Q. Not all tokens| Modifier and Type | Method and Description |
|---|---|
List<T> |
add(S shift,
List<T> tokens,
TokenEvent<T> tokenEvent)
Assign tokens to a Shift
|
S |
getShift(Long id)
Fetch a Shift by Id
|
default Date |
getSystemDateTime()
Client systems that access this need to synchronize clocks,
If they want to communicate with server.
|
List<T> |
lookupById(S shift,
Object identifier)
Lookup token(s) in a token container, using any of the following identifiers.
|
T |
lookupBySequence(S shift,
Number sequence)
Lookup a token in a Container by sequence number
in tokens that are
#getReadyToBeProcessed(TokenContainer, Token). |
T |
poll(S shift)
Poll then next token READY to be served.
|
List<T> |
poll(S shift,
Integer size)
An optimized Poll with N number of Tokens in one go.
|
List<T> |
poll(S shift,
Integer size,
T lastToken)
|
T |
poll(S shift,
T lastToken)
Based on Last Token return next
Token in TokenContainer.This is for fail safe to ensure if a Token is lost in network errors, then the server knows last point of rollback. |
<STATUS extends FlowStatus> |
updateStatus(S shift,
List tokens,
STATUS status,
TokenEvent<T> tokenEvent)
Update collection of tokens with status
|
addChangeListener, getListeners, notifyAllListeners, setListenersadd, getAssignedContainer, getMaxResultSize, getPositions, getQStatesStrategy, getSequence, getType, hasNext, init, linkTokens, lookup, lookupBySequence, move, remove, save, size, update, updateStatus<STATUS extends FlowStatus> List<T> updateStatus(S shift, List tokens, STATUS status, TokenEvent<T> tokenEvent) throws TokenProcessingException
updateStatus in interface TokenContainerService<T extends Token<T>,S extends Shift<T>>token - as Id as String or Longstatus - as Status type ObjecttokenEvent - as TokenEventList of tokens affectedTokenProcessingExceptionList<T> add(S shift, List<T> tokens, TokenEvent<T> tokenEvent) throws TokenGenerationException
shift - as Shifttokens - as List of tokenEvent - as TokenEventTokenGenerationExceptionList<T> lookupById(S shift, Object identifier)
List is supported. For all practical purposes this will be a single result.
Lookup token(s) in a token container, using any of the following identifiers.
The types of identifiers supported is implementation dependent.
List is supported. For all practical purposes this will be a single result.lookupById in interface TokenContainerService<T extends Token<T>,S extends Shift<T>>shift - as Shift type identifier - as name String, Id LongList of T lookupBySequence(S shift, Number sequence)
#getReadyToBeProcessed(TokenContainer, Token).
Lookup the Shift for tokens that are waiting to be processed and are in Q;
via sequence number starting 0 (which represents the starting of the Q).
One can also use negative numbers, where -1 is the last element in the Q and -2 is the 2nd from last and so on.
Tokens that are #getReadyToBeProcessed(TokenContainer, Token).lookupBySequence in interface TokenContainerService<T extends Token<T>,S extends Shift<T>>sequence - as Numbershift - as container type T poll(S shift)
QStatesStrategy.getReadyToBeProcessed()
Poll for tokens ready but yet to be processed in the BatchT poll(S shift, T lastToken)
Token in TokenContainer.Token in Shift.List<T> poll(S shift, Integer size)
List<T> poll(S shift, Integer size, T lastToken)
Tokens (of size), in Shift.Tokens (of size), in Shift.Copyright © 2018. All rights reserved.