Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.net
Interface Cluster

All Superinterfaces:
  ClassLoaderAware, Controllable

      public interface Cluster

extends Controllable

The Cluster interface represents a collection of services that operate in a clustered network environment.

Since:
  Coherence 1.1
Author:
  gg 2002.02.08

Nested Class Summary
`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).

Method Summary
`Service` | `ensureService(java.lang.String sName, java.lang.String sType)` Obtains a Service object for the specified service name and type.
`java.lang.String` | `getClusterName()` Determine the configured name for the Cluster.
`Member` | `getLocalMember()` Returns a Member object representing the local (i.e. this JVM) member of the cluster.
`Registry` | `getManagement()` Returns the current management registry.
`java.util.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.
`Service` | `getService(java.lang.String sName)` Returns a Service object for the specified service name.
`ServiceInfo` | `getServiceInfo(java.lang.String sName)` Returns a ServiceInfo object for the specified service name.
`java.util.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` | `setManagement(Registry registry)` Sets the current management registry.

Methods inherited from interface com.tangosol.util.Controllable
`configure, isRunning, shutdown, start, stop`

Methods inherited from interface com.tangosol.io.ClassLoaderAware
`getContextClassLoader, setContextClassLoader`

Method Detail

### getServiceNames

    java.util.Enumeration getServiceNames()

  Returns an Enumeration of String objects, one for each service that has been previously registered in the cluster.

  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.

  Returns:
    Enumeration of service names
  Throws:
    `java.lang.IllegalStateException` - thrown if the cluster service is not running or has stopped

### getServiceInfo

    ServiceInfo getServiceInfo(java.lang.String sName)

  Returns a ServiceInfo object for the specified service name.
  Parameters:
    `sName` - the service name, within the cluster, that uniquely identifies a registered service
  Returns:
    a ServiceInfo for the specified service; null if that service name has not been registered
  Throws:
    `java.lang.IllegalStateException` - thrown if the cluster service is not running or has stopped
  See Also:
    `getService(String)`

### getService

    Service getService(java.lang.String sName)

  Returns a Service object for the specified service name.
  Parameters:
    `sName` - the service name, within the cluster, that uniquely identifies a service
  Returns:
    a Service for the specified name; null if the specified service is not available locally
  Throws:
    `java.lang.IllegalStateException` - thrown if the cluster service is not running or has stopped
  See Also:
    `getServiceInfo(String)`, `ensureService(String, String)`

### ensureService

    Service ensureService(java.lang.String sName,
                          java.lang.String sType)

  Obtains a Service object for the specified service name and type.

  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.

  Parameters:
    `sName` - the service name, within the cluster, that uniquely identifies a service
    `sType` - 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 locally
  Returns:
    a Service object for the specified service name an type
  Throws:
    `java.lang.IllegalStateException` - thrown if the cluster service is not running or has stopped
    `java.lang.IllegalArgumentException` - thrown if the type is illegal or unknown

### getMemberSet

    java.util.Set getMemberSet()

  Returns a Set of Member objects, one for each Member of the cluster.
  Returns:
    Set of cluster members
  Throws:
    `java.lang.IllegalStateException` - thrown if the cluster service is not running or has stopped

### getLocalMember

    Member getLocalMember()

  Returns a Member object representing the local (i.e. this JVM) member of the cluster.
  Returns:
    the local cluster member
  Throws:
    `java.lang.IllegalStateException` - thrown if the cluster service is not running or has stopped

### getTimeMillis

    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.
  Returns:
    the cluster time in milliseconds
  Throws:
    `java.lang.IllegalStateException` - thrown if the cluster service is not running or has stopped

### getOldestMember

    Member getOldestMember()

  Returns a Member object representing the senior cluster member.
  Returns:
    the senior cluster member
  Throws:
    `java.lang.IllegalStateException` - thrown if the cluster service is not running or has stopped

### getManagement

    Registry getManagement()

  Returns the current management registry.
  Returns:
    the current management registry or null if the management is disabled on this node
  Since:
    Coherence 3.0

### setManagement

    void setManagement(Registry registry)

  Sets the current management registry.
  Parameters:
    `registry` - the management registry to use on this node
  Since:
    Coherence 3.0

### getClusterName

    java.lang.String getClusterName()

  Determine the configured name for the Cluster. This name is defined by the application, and can be used for any application-specific purpose. Furthermore, as a safety feature, when joining into a Cluster, a Member will only join it if the Cluster has the same name as the Member was configured to join.
  Returns:
    the configured name for the Cluster or null if none is configured
  Since:
    Coherence 3.2

Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.