CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.util
Interface Controllable

All Superinterfaces:
ClassLoaderAware
All Known Subinterfaces:
CacheService, Cluster, DistributedCacheService, InvocationService, PartitionedService, Service

public interface Controllable
extends ClassLoaderAware

Controllable interface represents a Daemon like object, quite oftenly referred to as a service that usually operates on its own thread and has a controllable life cycle.

Author:
gg 2002.02.08, 2003.02.11
See Also:
Cluster, Service

Method Summary
 void configure(XmlElement xml)
          Configure the controllable service.
 ClassLoader getContextClassLoader()
          Retrieve the context ClassLoader for this controllable service.
 boolean isRunning()
          Determine whether or not the controllable service is running.
 void setContextClassLoader(ClassLoader loader)
          Specify the context ClassLoader for this controllable service.
 void shutdown()
          Stop the controllable service.
 void start()
          Start the controllable service.
 void stop()
          Hard-stop the controllable service.
 

Method Detail

configure

void configure(XmlElement xml)
Configure the controllable service.

This method can only be called before the controllable service is started.

Parameters:
xml - an XmlElement carrying configuration information specific to the Controllable object
Throws:
IllegalStateException - thrown if the service is already running
IllegalArgumentException - thrown if the configuration information is invalid

start

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.

Throws:
IllegalStateException - thrown if a service does not support being re-started, and the service was already started and subsequently stopped and then an attempt is made to start the service again; also thrown if the Controllable service has not been configured

isRunning

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.

Returns:
true if the service is running; false otherwise

shutdown

void shutdown()
Stop the controllable service. This is a controlled shut-down, and is preferred to the 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.


stop

void stop()
Hard-stop the controllable service. Use shutdown() for normal service termination. Calling this method for a service that has already stopped has no effect.


getContextClassLoader

ClassLoader getContextClassLoader()
Retrieve the context ClassLoader for this controllable service. The context ClassLoader is provided by the creator of the service for use by code running in its thread when loading classes and resources. If not set, the default is the ContextClassLoader of the thread that this service was created on.

Specified by:
getContextClassLoader in interface ClassLoaderAware
Returns:
the context ClassLoader for this service
Since:
Coherence 2.1
See Also:
Thread.getContextClassLoader()

setContextClassLoader

void setContextClassLoader(ClassLoader loader)
Specify the context ClassLoader for this controllable service. The context ClassLoader can be set when a service is created, and allows the creator to provide the appropriate class loader to code running in its thread when loading classes and resources.

Specified by:
setContextClassLoader in interface ClassLoaderAware
Parameters:
loader - the context ClassLoader for this service
Since:
Coherence 2.1

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation