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
-
Constructor Summary
ConstructorDescriptionWrapperService
(Service service) Create a new WrapperService that delegates to the given Service instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addMemberListener
(MemberListener listener) Add a Member listener.void
addServiceListener
(ServiceListener listener) Register a ServiceListener that will receive events pertaining to the lifecycle of this Service.void
configure
(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.int
Return 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.boolean
Determine whether or not the controllable service is running.boolean
Returnstrue
if this service is currently suspended.boolean
isVersionCompatible
(int nVersion) Check whether the members of this service run a version that is greater than or equal to the specified version.boolean
isVersionCompatible
(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.boolean
isVersionCompatible
(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.boolean
isVersionCompatible
(IntPredicate predicate) Check whether the members of this service run a minimum service version that matches a specifiedIntPredicate
.void
removeMemberListener
(MemberListener listener) Remove a Member listener.void
removeServiceListener
(ServiceListener listener) Unregister a ServiceListener from this ConnectionManager.void
setContextClassLoader
(ClassLoader loader) Specify the context ClassLoader for this object.void
Configure the Service.void
setUserContext
(Object oCtx) Associate a user context object with this Service.void
shutdown()
Stop the controllable service.void
start()
Start the controllable service.void
stop()
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:
getDependencies
in interfaceService
- Returns:
- the service's dependencies
-
getCluster
Return the Cluster object that this Service is a part of.- Specified by:
getCluster
in 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:
addMemberListener
in interfaceService
- Parameters:
listener
- theMemberListener
to add
-
removeMemberListener
Remove a Member listener.- Specified by:
removeMemberListener
in interfaceService
- Parameters:
listener
- theMemberListener
to 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:
getUserContext
in 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:
setUserContext
in interfaceService
- Parameters:
oCtx
- a user context object
-
getSerializer
Return a Serializer used by this Service.- Specified by:
getSerializer
in interfaceService
- Returns:
- the Serializer object
-
addServiceListener
Register a ServiceListener that will receive events pertaining to the lifecycle of this Service.- Specified by:
addServiceListener
in 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:
removeServiceListener
in 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:
configure
in 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:
start
in 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:
isRunning
in 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:
shutdown
in 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:
stop
in 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:
getContextClassLoader
in 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:
setContextClassLoader
in 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:
setDependencies
in 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
ResourceRegistry
API for details on how to enable cleanup of resources.
- Specified by:
getResourceRegistry
in interfaceService
- Returns:
- a Service scoped resource registry
-
isSuspended
public boolean isSuspended()Description copied from interface:Service
Returnstrue
if this service is currently suspended.- Specified by:
isSuspended
in interfaceService
- Returns:
true
if 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:Service
Check whether the members of this service run a version that is greater than or equal to the specified version.- Specified by:
isVersionCompatible
in 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:
true
if 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:Service
Check whether the members of this service run a version that is greater than or equal to the specified version.- Specified by:
isVersionCompatible
in interfaceService
- Parameters:
nYear
- the year version numbernMonth
- the month version numbernPatch
- the patch version number- Returns:
true
if 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:Service
Check whether the members of this service run a version that is greater than or equal to the specified version.- Specified by:
isVersionCompatible
in interfaceService
- Parameters:
nVersion
- the encoded version to compare- Returns:
true
if 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:Service
Check whether the members of this service run a minimum service version that matches a specifiedIntPredicate
.- Specified by:
isVersionCompatible
in interfaceService
- Parameters:
predicate
- anIntPredicate
to apply to the minimum encoded service version- Returns:
true
if the minimum service version matches the predicate
-
getMinimumServiceVersion
public int getMinimumServiceVersion()Description copied from interface:Service
Return the minimum version for the members in this set.- Specified by:
getMinimumServiceVersion
in interfaceService
- Returns:
- the minimum version for the members in this set
-
toString
-
getService
Return the wrapped Service.- Returns:
- the wrapped Service
-