Package org.nustaq.kontraktor.routers
Class SingleActiveServiceKrouter<T extends SingleActiveServiceKrouter>
java.lang.Object
org.nustaq.kontraktor.Actors
org.nustaq.kontraktor.Actor<T>
org.nustaq.kontraktor.routers.AbstractKrouter<T>
org.nustaq.kontraktor.routers.SingleActiveServiceKrouter<T>
- All Implemented Interfaces:
java.io.Serializable,java.util.concurrent.Executor,Monitorable,RemotedActor,ServingActor
- Direct Known Subclasses:
HotColdFailoverKrouter,SimpleKrouter
public abstract class SingleActiveServiceKrouter<T extends SingleActiveServiceKrouter> extends AbstractKrouter<T>
Created by ruedi on 13.03.17.
Simply forwards all incoming calls to the registered Service. If a new service registers, it replaces
the previous one.
If a service is 'stateful', clients stick to their initial connected service instance as long
it is available. Only once the initially connected service instance becomes unavailable,
clients receive a failovernotification to re-establish state (e.g. subscriptions).
- See Also:
- Serialized Form
-
Nested Class Summary
-
Field Summary
Fields inherited from class org.nustaq.kontraktor.routers.AbstractKrouter
CLIENT_PING_INTERVAL_MS, clients, lastSwitch, nextAliveRemoteActors, SERVICE_UNAVAILABLE, timeoutMapFields inherited from class org.nustaq.kontraktor.Actor
__cbQueue, __clientConnection, __connections, __currentDispatcher, __mailbox, __mailboxCapacity, __mbCapacity, __publishTarget, __remoteId, __scheduler, __self, __stopped, __ticketMachine, connection, sender, userData, zzRoutingGCEnabled, zzServerMsgCallbackFields inherited from class org.nustaq.kontraktor.Actors
CONT, DEFAULT_TIMOUT, defaultScheduler, delayedCalls, exec, instance, MAX_EXTERNAL_THREADS_POOL_SIZE, version -
Constructor Summary
Constructors Constructor Description SingleActiveServiceKrouter() -
Method Summary
Modifier and Type Method Description protected booleandispatchRemoteCall(RemoteCallEntry rce, ConnectionRegistry clientRemoteRegistry)dispatch call to a service.protected abstract ActorgetRemoteRef()protected java.util.List<Actor>getServices()voidinit()static voidmain(java.lang.String[] args)abstract voidrouter$handleServiceDisconnect(Actor x)IPromiserouter$RegisterService(Actor remoteRef, boolean stateful)protected abstract voidsetRemoteRef(Actor remoteRef)protected voidwillDispatch()Methods inherited from class org.nustaq.kontraktor.routers.AbstractKrouter
__dispatchRemoteCall, checkPingOnClients, clientConnected, clientDisconnected, createErrorPromiseResponse, forwardCall, forwardCallInternal, forwardMultiCall, forwardMultiCallInternal, getClientPingTimeout, getServicePingTimeout, handleServiceDiscon, hasBeenUnpublished, isStateful, pingServices, router$clientPing, sendFailoverNotification, sendFailoverNotificationInternalMethods inherited from class org.nustaq.kontraktor.Actor
__addDeadLetter, __addRemoteConnection, __addStopHandler, __enqueueCall, __getCachedMethod, __removeRemoteConnection, __stop, __stopImpl, __submit, ask, askMsg, asyncstop, checkThread, close, closeCurrentClient, current, cyclic, debounce, delayed, execInThreadPool, execute, getActor, getActorRef, getCallbackSize, getConnections, getCurrentDispatcher, getFactory, getMailboxSize, getQSizes, getReport, getScheduler, getSubMonitorables, getUntypedRef, hasStopped, inside, inThread, isCallbackQPressured, isEmpty, isMailboxPressured, isProxy, isPublished, isRemote, isStopped, ping, self, serialOn, setServerMsgCallback, stop, stopSafeClose, tell, tellMsg, unpublish, zzkrouterLostClient, zzRoutingRefGCMethods inherited from class org.nustaq.kontraktor.Actors
AddDeadLetter, all, all, all, allMapped, AsActor, AsActor, AsActor, AsActor, AsUntypedActor, awaitAll, awaitAll, awaitAll, awaitAll, complete, complete, DeadLetters, flow, InThread, isComplete, isCont, isError, isErrorOrComplete, isResult, isTimeout, kYield, kYield, promise, race, race, reject, resolve, resolve, stream, SubmitDelayed, yieldCallbacks
-
Constructor Details
-
SingleActiveServiceKrouter
public SingleActiveServiceKrouter()
-
-
Method Details
-
getRemoteRef
-
setRemoteRef
-
router$RegisterService
- Overrides:
router$RegisterServicein classAbstractKrouter<T extends SingleActiveServiceKrouter>
-
init
public void init()- Overrides:
initin classAbstractKrouter<T extends SingleActiveServiceKrouter>
-
router$handleServiceDisconnect
- Specified by:
router$handleServiceDisconnectin classAbstractKrouter<T extends SingleActiveServiceKrouter>
-
getServices
- Specified by:
getServicesin classAbstractKrouter<T extends SingleActiveServiceKrouter>
-
dispatchRemoteCall
Description copied from class:AbstractKrouterdispatch call to a service. (use forwardXX to send)- Specified by:
dispatchRemoteCallin classAbstractKrouter<T extends SingleActiveServiceKrouter>- Returns:
- return false in case call could not be dispatched
-
willDispatch
protected void willDispatch() -
main
public static void main(java.lang.String[] args)
-