public class WrapperService extends Object implements Service
Service.MemberJoinAction| Modifier and Type | Field and Description |
|---|---|
protected Service |
m_service
The (wrapped) Service.
|
| Constructor and Description |
|---|
WrapperService(Service service)
Create a new WrapperService that delegates to the given Service instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
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.
|
Cluster |
getCluster()
Return the Cluster object that this Service is a part of.
|
ClassLoader |
getContextClassLoader()
Retrieve the context ClassLoader for this object.
|
ServiceDependencies |
getDependencies()
Return the service's dependencies.
|
ServiceInfo |
getInfo()
Return the ServiceInfo object for this Service.
|
ResourceRegistry |
getResourceRegistry()
Retrieves a Service scoped
ResourceRegistry. |
Serializer |
getSerializer()
Return a Serializer used by this Service.
|
Service |
getService()
Return the wrapped Service.
|
Object |
getUserContext()
Return the user context object associated with this Service.
|
boolean |
isRunning()
Determine whether or not the controllable service is running.
|
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 |
setDependencies(ServiceDependencies deps)
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.
|
String |
toString() |
protected Service m_service
public WrapperService(Service service)
service - the Service to wrappublic ServiceDependencies getDependencies()
public Cluster getCluster()
public ServiceInfo getInfo()
public void addMemberListener(MemberListener listener)
MemberListeners will be invoked in the order in which they are registered.
listener - the MemberListener to addpublic void removeMemberListener(MemberListener listener)
listener - the MemberListener to removepublic Object getUserContext()
The data type and semantics of this context object are entirely application specific and are opaque to the Service itself.
public void setUserContext(Object oCtx)
oCtx - a user context objectpublic Serializer getSerializer()
public void addServiceListener(ServiceListener listener)
addServiceListener in interface Servicelistener - the new ServiceListener to register; if the listener has already been registered, this method has no effectpublic void removeServiceListener(ServiceListener listener)
After a ServiceListener is removed, it will no longer receive events pertaining to the lifecycle of this Service.
removeServiceListener in interface Servicelistener - the ServiceListener to deregister; if the listener has not previously been registered, this method has no effectpublic void configure(XmlElement xml)
This method can only be called before the controllable service is started.
configure in interface Controllablexml - an XmlElement carrying configuration information specific to the Controllable objectpublic void start()
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.
start in interface Controllablepublic boolean isRunning()
isRunning in interface Controllablepublic void shutdown()
Controllable.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.
shutdown in interface Controllablepublic void stop()
Controllable.shutdown() for normal service termination. Calling this method for a service that has already stopped has no effect.stop in interface Controllablepublic ClassLoader getContextClassLoader()
getContextClassLoader in interface ClassLoaderAwareThread.getContextClassLoader()public void setContextClassLoader(ClassLoader loader)
setContextClassLoader in interface ClassLoaderAwareloader - the context ClassLoader for this objectpublic void setDependencies(ServiceDependencies deps)
This method can only be called before the Service is started.
deps - the dependencies object carrying configuration information specific to this Servicepublic ResourceRegistry getResourceRegistry()
ResourceRegistry. The resource registry is used to:
ResourceRegistry API for details on how to enable cleanup of resources.public Service getService()