Package org.nustaq.kontraktor.services
Class ServiceActor<T extends ServiceActor>
java.lang.Object
org.nustaq.kontraktor.Actors
org.nustaq.kontraktor.Actor<T>
org.nustaq.kontraktor.services.ServiceActor<T>
- All Implemented Interfaces:
Serializable,Executor,org.nustaq.kontraktor.monitoring.Monitorable
- Direct Known Subclasses:
DataShard,DynDataShard,PlainService,RLJsonServerService
public abstract class ServiceActor<T extends ServiceActor>
extends org.nustaq.kontraktor.Actor<T>
Created by ruedi on 12.08.2015.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.nustaq.kontraktor.Actor
org.nustaq.kontraktor.Actor.ActorReport -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ServiceArgsprotected ClusterCfgprotected org.nustaq.reallive.server.dynamic.DynClusterDistributionprotected DataClientstatic intstatic final Stringstatic final Stringprotected org.nustaq.kontraktor.remoting.base.ServiceDescriptionprotected org.nustaq.kontraktor.remoting.base.ReconnectableRemoteRef<ServiceRegistry>static final StringFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoidruns on client side, receives forwarded service event received from service actorprotected org.nustaq.kontraktor.IPromise<Void>protected voidawaitRequiredServicesInternal(org.nustaq.kontraktor.IPromise<Void> p) org.nustaq.kontraktor.IPromisetry to connect required (unconnected) services, in case of failur UNCONNECTED is put into service hashmap insteadprotected org.nustaq.kontraktor.IPromise<org.nustaq.kontraktor.Actor>connectService(org.nustaq.kontraktor.remoting.base.ServiceDescription serviceDescription) protected org.nustaq.kontraktor.remoting.base.ConnectableActorprotected abstract org.nustaq.kontraktor.remoting.base.ServiceDescriptionprotected voidfireServiceEvent(String ev, Object arg) protected String[]protected ServiceArgsorg.nustaq.kontraktor.IPromise<ClusterCfg>org.nustaq.kontraktor.IPromise<DataClient>protected StringgetHost()protected intgetPort()protected abstract String[]protected <T extends org.nustaq.kontraktor.Actor>
TgetService(String name) protected org.nustaq.kontraktor.remoting.base.ServiceDescriptionprotected Serializableprotected voidvoidorg.nustaq.kontraktor.IPromise<Void>init(org.nustaq.kontraktor.remoting.base.ConnectableActor registryConnectable, ServiceArgs options, boolean autoRegister) protected voidstatic DynDataClientInitRealLiveDynamic(org.nustaq.reallive.server.dynamic.DynClusterDistribution currentDistribution, ServiceRegistry serviceRegistry, Function<String, DynDataShard> serviceMapper, ServiceActor hostingService, DataCfg schema) protected voidprotected booleanprotected booleanprotected voidoverride, config contains updated ClusterCfgprotected voidprotected voidonRegistryConnected(boolean autoRegister) protected voidprotected voidprotected voidprotected voidregister at service registryvoidprotected voidrequiredSerivceWentDown(org.nustaq.kontraktor.remoting.base.ServiceDescription cdr) static ServiceActorRunTCP(String[] args, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceArgs> argsClazz) static ServiceActorRunTCP(String[] args, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceArgs> argsClazz, long timeout) static ServiceActorRunTCP(String[] args, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceArgs> argsClazz, Class<? extends ServiceRegistry> serviceRegistryClass) static ServiceActorRunTCP(String[] args, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceArgs> argsClazz, Class<? extends ServiceRegistry> serviceRegistryClass, long timeout) run & connect a service with given cmdline args and classesstatic ServiceActorRunTCP(ServiceArgs options, Class<? extends ServiceActor> serviceClazz, long timeout) static ServiceActorRunTCP(ServiceArgs options, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceRegistry> serviceRegistryClass, long timeout) protected voidserviceDisconnected(org.nustaq.kontraktor.Actor act) protected voidserviceEvent(String eventId, Object cdr, Object err) Methods inherited from class org.nustaq.kontraktor.Actor
__addDeadLetter, __addRemoteConnection, __addStopHandler, __dispatchRemoteCall, __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, router$clientPing, 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
-
Field Details
-
REGISTRY_DISCONNECTED
- See Also:
-
REGISTRY_RECONNECTED
- See Also:
-
DEFAULT_START_TIMEOUT
public static int DEFAULT_START_TIMEOUT -
UNCONNECTED
- See Also:
-
serviceRegistry
protected org.nustaq.kontraktor.remoting.base.ReconnectableRemoteRef<ServiceRegistry> serviceRegistry -
requiredServices
-
config
-
serviceDescription
protected org.nustaq.kontraktor.remoting.base.ServiceDescription serviceDescription -
cmdline
-
dclient
-
currentDistribution
protected org.nustaq.reallive.server.dynamic.DynClusterDistribution currentDistribution
-
-
Constructor Details
-
ServiceActor
public ServiceActor()
-
-
Method Details
-
RunTCP
public static ServiceActor RunTCP(String[] args, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceArgs> argsClazz) -
RunTCP
public static ServiceActor RunTCP(String[] args, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceArgs> argsClazz, Class<? extends ServiceRegistry> serviceRegistryClass) -
RunTCP
public static ServiceActor RunTCP(String[] args, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceArgs> argsClazz, long timeout) -
RunTCP
public static ServiceActor RunTCP(String[] args, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceArgs> argsClazz, Class<? extends ServiceRegistry> serviceRegistryClass, long timeout) run & connect a service with given cmdline args and classes- Parameters:
args-serviceClazz-argsClazz-- Returns:
- Throws:
IllegalAccessExceptionInstantiationException
-
RunTCP
public static ServiceActor RunTCP(ServiceArgs options, Class<? extends ServiceActor> serviceClazz, long timeout) -
RunTCP
public static ServiceActor RunTCP(ServiceArgs options, Class<? extends ServiceActor> serviceClazz, Class<? extends ServiceRegistry> serviceRegistryClass, long timeout) -
init
public org.nustaq.kontraktor.IPromise<Void> init(org.nustaq.kontraktor.remoting.base.ConnectableActor registryConnectable, ServiceArgs options, boolean autoRegister) -
addServiceEventListener
runs on client side, receives forwarded service event received from service actor- Parameters:
l-
-
removeServiceEventListener
-
getServiceRegistry
-
fireServiceEvent
-
onRegistryDisconnected
protected void onRegistryDisconnected() -
onRegistryConnected
protected void onRegistryConnected(boolean autoRegister) -
onServiceRegistryReconnected
protected void onServiceRegistryReconnected() -
awaitRequiredServices
-
awaitRequiredServicesInternal
-
initRealLiveDynamic
protected void initRealLiveDynamic() -
old_initRealLiveDynamic
protected void old_initRealLiveDynamic() -
InitRealLiveDynamic
public static DynDataClient InitRealLiveDynamic(org.nustaq.reallive.server.dynamic.DynClusterDistribution currentDistribution, ServiceRegistry serviceRegistry, Function<String, DynDataShard> serviceMapper, ServiceActor hostingService, DataCfg schema) -
initRealLiveFixed
protected void initRealLiveFixed() -
getConfig
-
getDataClient
-
registerSelf
protected void registerSelf()register at service registry -
publishSelf
protected void publishSelf() -
getPort
protected int getPort()- Returns:
- port this service wants to expose (with default tcp exposure)
-
getHost
- Returns:
- host this service wants to expose on (with default tcp exposure)
-
getCmdline
-
getAllServiceNames
-
isFixedDataCluster
protected boolean isFixedDataCluster() -
isDynamicDataCluster
protected boolean isDynamicDataCluster() -
getRequiredServiceNames
-
serviceEvent
-
notifyConfigChanged
protected void notifyConfigChanged()override, config contains updated ClusterCfg -
requiredSerivceWentDown
protected void requiredSerivceWentDown(org.nustaq.kontraktor.remoting.base.ServiceDescription cdr) -
getService
-
connectRequiredServices
public org.nustaq.kontraktor.IPromise connectRequiredServices()try to connect required (unconnected) services, in case of failur UNCONNECTED is put into service hashmap instead- Returns:
-
connectService
protected org.nustaq.kontraktor.IPromise<org.nustaq.kontraktor.Actor> connectService(org.nustaq.kontraktor.remoting.base.ServiceDescription serviceDescription) -
serviceDisconnected
protected void serviceDisconnected(org.nustaq.kontraktor.Actor act) -
heartBeat
public void heartBeat() -
getStatus
-
gravityDisconnected
protected void gravityDisconnected() -
createServiceDescription
protected abstract org.nustaq.kontraktor.remoting.base.ServiceDescription createServiceDescription() -
getServiceDescription
protected org.nustaq.kontraktor.remoting.base.ServiceDescription getServiceDescription() -
createDefaultConnectable
protected org.nustaq.kontraktor.remoting.base.ConnectableActor createDefaultConnectable()
-