Class WrapperService
- All Implemented Interfaces:
ClassLoaderAware,Service,Controllable,Service
- Direct Known Subclasses:
WrapperCacheService,WrapperInvocationService
- Author:
- jh 2010.03.17
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tangosol.net.Service
Service.MemberJoinAction -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionWrapperService(Service service) Create a new WrapperService that delegates to the given Service instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMemberListener(MemberListener listener) Add a Member listener.voidaddServiceListener(ServiceListener listener) Register a ServiceListener that will receive events pertaining to the lifecycle of this Service.voidconfigure(XmlElement xml) Configure the controllable service.Return the Cluster object that this Service is a part of.Retrieve the context ClassLoader for this object.Return the service's dependencies.getInfo()Return the ServiceInfo object for this Service.intReturn the minimum version for the members in this set.Retrieves a Service scopedResourceRegistry.Return a Serializer used by this Service.Return the wrapped Service.Return the user context object associated with this Service.booleanDetermine whether or not the controllable service is running.booleanReturnstrueif this service is currently suspended.booleanisVersionCompatible(int nVersion) Check whether the members of this service run a version that is greater than or equal to the specified version.booleanisVersionCompatible(int nYear, int nMonth, int nPatch) Check whether the members of this service run a version that is greater than or equal to the specified version.booleanisVersionCompatible(int nMajor, int nMinor, int nMicro, int nPatchSet, int nPatch) Check whether the members of this service run a version that is greater than or equal to the specified version.booleanisVersionCompatible(IntPredicate predicate) Check whether the members of this service run a minimum service version that matches a specifiedIntPredicate.voidremoveMemberListener(MemberListener listener) Remove a Member listener.voidremoveServiceListener(ServiceListener listener) Unregister a ServiceListener from this ConnectionManager.voidsetContextClassLoader(ClassLoader loader) Specify the context ClassLoader for this object.voidConfigure the Service.voidsetUserContext(Object oCtx) Associate a user context object with this Service.voidshutdown()Stop the controllable service.voidstart()Start the controllable service.voidstop()Hard-stop the controllable service.toString()
-
Field Details
-
m_service
The (wrapped) Service.
-
-
Constructor Details
-
WrapperService
Create a new WrapperService that delegates to the given Service instance.- Parameters:
service- the Service to wrap
-
-
Method Details
-
getDependencies
Return the service's dependencies.- Specified by:
getDependenciesin interfaceService- Returns:
- the service's dependencies
-
getCluster
Return the Cluster object that this Service is a part of.- Specified by:
getClusterin interfaceService- Returns:
- the Cluster object
-
getInfo
Return the ServiceInfo object for this Service. -
addMemberListener
Add a Member listener.MemberListeners will be invoked in the order in which they are registered.
- Specified by:
addMemberListenerin interfaceService- Parameters:
listener- theMemberListenerto add
-
removeMemberListener
Remove a Member listener.- Specified by:
removeMemberListenerin interfaceService- Parameters:
listener- theMemberListenerto remove
-
getUserContext
Return the user context object associated with this Service.The data type and semantics of this context object are entirely application specific and are opaque to the Service itself.
- Specified by:
getUserContextin interfaceService- Returns:
- an associated user context object or null if a context has not been set
-
setUserContext
Associate a user context object with this Service.- Specified by:
setUserContextin interfaceService- Parameters:
oCtx- a user context object
-
getSerializer
Return a Serializer used by this Service.- Specified by:
getSerializerin interfaceService- Returns:
- the Serializer object
-
addServiceListener
Register a ServiceListener that will receive events pertaining to the lifecycle of this Service.- Specified by:
addServiceListenerin interfaceService- Parameters:
listener- the new ServiceListener to register; if the listener has already been registered, this method has no effect
-
removeServiceListener
Unregister a ServiceListener from this ConnectionManager.After a ServiceListener is removed, it will no longer receive events pertaining to the lifecycle of this Service.
- Specified by:
removeServiceListenerin interfaceService- Parameters:
listener- the ServiceListener to deregister; if the listener has not previously been registered, this method has no effect
-
configure
Configure the controllable service.This method can only be called before the controllable service is started.
- Specified by:
configurein interfaceControllable- Parameters:
xml- an XmlElement carrying configuration information specific to the Controllable object
-
start
public void start()Start the controllable service.This method should only be called once per the life cycle of the Controllable service. This method has no affect if the service is already running.
- Specified by:
startin interfaceControllable
-
isRunning
public boolean isRunning()Determine whether or not the controllable service is running. This method returns false before a service is started, while the service is starting, while a service is shutting down and after the service has stopped. It only returns true after completing its start processing and before beginning its shutdown processing.- Specified by:
isRunningin interfaceControllable- Returns:
- true if the service is running; false otherwise
-
shutdown
public void shutdown()Stop the controllable service. This is a controlled shut-down, and is preferred to theControllable.stop()method.This method should only be called once per the life cycle of the controllable service. Calling this method for a service that has already stopped has no effect.
- Specified by:
shutdownin interfaceControllable
-
stop
public void stop()Hard-stop the controllable service. UseControllable.shutdown()for normal service termination. Calling this method for a service that has already stopped has no effect.- Specified by:
stopin interfaceControllable
-
getContextClassLoader
Retrieve the context ClassLoader for this object. The context ClassLoader is provided by the creator of the object for use by the object when loading classes and resources.- Specified by:
getContextClassLoaderin interfaceClassLoaderAware- Returns:
- the context ClassLoader for this object
- See Also:
-
setContextClassLoader
Specify the context ClassLoader for this object. The context ClassLoader can be set when the object is created, and allows the creator to provide the appropriate class loader to be used by the object when when loading classes and resources.- Specified by:
setContextClassLoaderin interfaceClassLoaderAware- Parameters:
loader- the context ClassLoader for this object
-
setDependencies
Configure the Service.This method can only be called before the Service is started.
- Specified by:
setDependenciesin interfaceService- Parameters:
deps- the dependencies object carrying configuration information specific to this Service
-
getResourceRegistry
Retrieves a Service scopedResourceRegistry. The resource registry is used to:- Register resources with the Service and make them accessible to the application code bound to this Service.
- Dispose of resources when the Service is shut down; see
the
ResourceRegistryAPI for details on how to enable cleanup of resources.
- Specified by:
getResourceRegistryin interfaceService- Returns:
- a Service scoped resource registry
-
isSuspended
public boolean isSuspended()Description copied from interface:ServiceReturnstrueif this service is currently suspended.- Specified by:
isSuspendedin interfaceService- Returns:
trueif this service is currently suspended- See Also:
-
isVersionCompatible
public boolean isVersionCompatible(int nMajor, int nMinor, int nMicro, int nPatchSet, int nPatch) Description copied from interface:ServiceCheck whether the members of this service run a version that is greater than or equal to the specified version.- Specified by:
isVersionCompatiblein interfaceService- Parameters:
nMajor- the major version numbernMinor- the minor version numbernMicro- the micro version numbernPatchSet- the patch set version numbernPatch- the patch version number- Returns:
trueif the members of the service are all running a version that is greater than or equal to the specified version
-
isVersionCompatible
public boolean isVersionCompatible(int nYear, int nMonth, int nPatch) Description copied from interface:ServiceCheck whether the members of this service run a version that is greater than or equal to the specified version.- Specified by:
isVersionCompatiblein interfaceService- Parameters:
nYear- the year version numbernMonth- the month version numbernPatch- the patch version number- Returns:
trueif the members of the service are all running a version that is greater than or equal to the specified version
-
isVersionCompatible
public boolean isVersionCompatible(int nVersion) Description copied from interface:ServiceCheck whether the members of this service run a version that is greater than or equal to the specified version.- Specified by:
isVersionCompatiblein interfaceService- Parameters:
nVersion- the encoded version to compare- Returns:
trueif the members of the service are all running a version that is greater than or equal to the specified version
-
isVersionCompatible
Description copied from interface:ServiceCheck whether the members of this service run a minimum service version that matches a specifiedIntPredicate.- Specified by:
isVersionCompatiblein interfaceService- Parameters:
predicate- anIntPredicateto apply to the minimum encoded service version- Returns:
trueif the minimum service version matches the predicate
-
getMinimumServiceVersion
public int getMinimumServiceVersion()Description copied from interface:ServiceReturn the minimum version for the members in this set.- Specified by:
getMinimumServiceVersionin interfaceService- Returns:
- the minimum version for the members in this set
-
toString
-
getService
Return the wrapped Service.- Returns:
- the wrapped Service
-