public interface Cluster extends Controllable
Modifier and Type | Interface and Description |
---|---|
static interface |
Cluster.MemberTimeoutAction
MemberTimeoutAction is taken by the cluster service to remove members from
the cluster who have exceeded a network timeout (e.g. packet-timeout).
|
Modifier and Type | Method and Description |
---|---|
Service |
ensureService(String sName,
String sType)
Obtains a Service object for the specified service name and type.
|
String |
getClusterName()
Determine the configured name for the Cluster.
|
ClusterDependencies |
getDependencies()
Retrieve the Cluster configuration.
|
Member |
getLocalMember()
Returns a Member object representing the local (i.e. this JVM)
member of the cluster.
|
Registry |
getManagement()
Returns the current management registry.
|
Set |
getMemberSet()
Returns a Set of Member objects, one for each Member of
the cluster.
|
Member |
getOldestMember()
Returns a Member object representing the senior cluster member.
|
com.oracle.coherence.common.base.Disposable |
getResource(String sName)
Deprecated.
Use
getResourceRegistry() to manage resources. |
ResourceRegistry |
getResourceRegistry()
Retrieves a Cluster scoped
ResourceRegistry . |
Service |
getService(String sName)
Returns a Service object for the specified service name.
|
ServiceInfo |
getServiceInfo(String sName)
Returns a ServiceInfo object for the specified service name.
|
Enumeration |
getServiceNames()
Returns an Enumeration of String objects, one for each service that
has been previously registered in the cluster.
|
long |
getTimeMillis()
Returns the current "cluster time", which is analogous to the
System.currentTimeMillis() except that the cluster
time is the roughly the same for all Members in the cluster. |
void |
registerResource(String sName,
com.oracle.coherence.common.base.Disposable resource)
Deprecated.
Use
getResourceRegistry() to manage resources. |
void |
resumeService(String sName)
Resume all suspended members of the service identified by the specified
name.
|
void |
setDependencies(ClusterDependencies deps)
Configure the Cluster.
|
void |
setManagement(Registry registry)
Sets the current management registry.
|
void |
suspendService(String sName)
Suspend all members of the service identified by the specified name.
|
com.oracle.coherence.common.base.Disposable |
unregisterResource(String sName)
Deprecated.
Use
getResourceRegistry() to manage resources. |
configure, isRunning, shutdown, start, stop
getContextClassLoader, setContextClassLoader
Enumeration getServiceNames()
For each name, a call to getServiceInfo(String)
will return
a ServiceInfo describing a service. However, the call to
getService(String)
may return null if that service is not
available locally.
IllegalStateException
- thrown if the cluster service
is not running or has stoppedServiceInfo getServiceInfo(String sName)
sName
- the service name, within the cluster, that uniquely
identifies a registered serviceIllegalStateException
- thrown if the cluster service
is not running or has stoppedgetService(String)
Service getService(String sName)
sName
- the service name, within the cluster, that uniquely
identifies a serviceIllegalStateException
- thrown if the cluster service
is not running or has stoppedgetServiceInfo(String)
,
ensureService(String, String)
Service ensureService(String sName, String sType)
If the service with the specified name already exists, a reference to the same service will be returned. Otherwise a new service object will be instantiated and returned. The service's context ClassLoader will be initialized with the Cluster's context ClassLoader.
It is essential to understand that until the service is started using
Controllable.start()
, the cluster doesn't keep a reference to
that service instance. Therefore, the external synchronization on the
cluster object is necessary to prevent creation of a duplicate service.
sName
- the service name, within the cluster, that uniquely
identifies a servicesType
- the service type, that serves as a key to the cluster
configuration info, allowing the cluster instantiate
the corresponding service implementations if the
specified service is not available locallyIllegalStateException
- thrown if the cluster service
is not running or has stoppedIllegalArgumentException
- thrown if the type is illegal or
unknownvoid suspendService(String sName)
resumeService
method.
If "Cluster" is passed for the service name, all services (including the ClusterService) will be suspended.
sName
- the service nameIllegalStateException
- thrown if the cluster service
is not running or has stoppedIllegalArgumentException
- thrown if the name is illegal or
unknownvoid resumeService(String sName)
If "Cluster" is passed for the service name, all services (including the ClusterService) will be resumed.
sName
- the service nameIllegalStateException
- thrown if the cluster service
is not running or has stoppedIllegalArgumentException
- thrown if the name is illegal or
unknownSet getMemberSet()
IllegalStateException
- thrown if the cluster service
is not running or has stoppedMember getLocalMember()
IllegalStateException
- thrown if the cluster service
is not running or has stoppedlong getTimeMillis()
System.currentTimeMillis()
except that the cluster
time is the roughly the same for all Members in the cluster.IllegalStateException
- thrown if the cluster service
is not running or has stoppedMember getOldestMember()
IllegalStateException
- thrown if the cluster service
is not running or has stoppedRegistry getManagement()
void setManagement(Registry registry)
registry
- the management registry to use on this nodeString getClusterName()
@Deprecated com.oracle.coherence.common.base.Disposable getResource(String sName)
getResourceRegistry()
to manage resources.Disposable
resource that was previously registered
using registerResource(String, Disposable)
.sName
- the name of the resource to retrieveDisposable
resource, or null if no such resource is
currently registered@Deprecated void registerResource(String sName, com.oracle.coherence.common.base.Disposable resource)
getResourceRegistry()
to manage resources.Disposable
resource with the Cluster, using
the specified name. There are two reasons to register a resource:
getResource(String)
using the same
name will return the registered resource, andDisposable.dispose()
method of
the resource when the Cluster is shut down; specifically, when the
Cluster is shutting down, after it has shut down all of the
running services, the Cluster calls Disposable.dispose()
on each
registered resource.
If a resource is already registered under the specified name, and the
new resource to register is not the same resource (the same reference)
as the previously registered resource, then the Cluster will throw an
IllegalStateException
.
To unregister a previously registered resource, call the
unregisterResource(String)
method with the name of the
resource to unregister.
Note: It is the responsibility of the caller to manage concurrent access
to the getResource(java.lang.String)
, unregisterResource(String)
and
registerResource methods of the Cluster. Specifically, while
the Cluster manages the registry of resources in a thread-safe manner,
it is possible for a thread to call getResource, get a null
return value because a resource had not yet been registered under the
specified name, but by the time the thread instantiates a resource and
attempts to register it by calling registerResource, another
thread may have already done the same thing.
sName
- the name of the resourceresource
- the Disposable
resource to registerIllegalStateException
- if the resource is null@Deprecated com.oracle.coherence.common.base.Disposable unregisterResource(String sName)
getResourceRegistry()
to manage resources.
Note: It is the responsibility of the caller to manage concurrent access
to the getResource(java.lang.String)
, unregisterResource(String) and
registerResource(java.lang.String, com.oracle.coherence.common.base.Disposable)
methods of the Cluster. Specifically, while
the Cluster manages the registry of resources in a thread-safe manner,
it is possible for a thread to call getResource, get a null
return value because a resource had not yet been registered under the
specified name, but by the time the thread instantiates a resource and
attempts to register it by calling registerResource, another
thread may have already done the same thing.
sName
- the name of the resourceDisposable
resource or null if none
was registered under that nameResourceRegistry getResourceRegistry()
ResourceRegistry
. The resource
registry is used to:
ResourceRegistry
API for details on how to enable
cleanup of resources.
ClusterDependencies getDependencies()
void setDependencies(ClusterDependencies deps)
This method can only be called before the Cluster is started.
deps
- the dependencies object carrying the Cluster configuration
informationIllegalStateException
- thrown if the Cluster is already runningIllegalArgumentException
- thrown if the configuration information
is invalid