Hitachi

In-Memory Data Grid Hitachi Elastic Application Data Store


18.1.2 CacheManager class

Organization of this subsection

(1) Function

This is a class used for managing EADS's caches.

The class executes create() and initializes the EADS client.

Always make sure that you execute destroy() when you stop using the EADS client.

(2) Inheritance relationship

java.lang.Object
 [Figure]com.hitachi.software.xeads.client.api.CacheManager

(3) Format

public class CacheManager
extends java.lang.Object

(4) List of methods

The following table lists and describes the methods provided by the CacheManager class:

Method name

Description

create() (path specification)

Initializes an EADS client according to the client properties.

create() (EADS client name and path specification)

Initializes an EADS client according to the client properties.

create() (input stream specification)

Initializes an EADS client according to the client properties.

create() (EADS client name and input stream specification)

Initializes an EADS client according to the client properties.

create() (client properties specification)

Initializes an EADS client according to the client properties.

create() (EADS client name and client properties specification)

Initializes an EADS client according to the client properties.

getCache()

Acquires an instance of the Cache class.

removeCache()

Terminates accesses to the cache.

destroy()

Terminates usage of the EADS client.

getNodeList()

Acquires information about the connection-target EADS servers maintained by the EADS client.

[Deprecated] getNode()

[Deprecated] Acquires information about the original source EADS server that stores a specified key (or group) (and from which data has been copied).

getSlaveNodeList()

Acquires information about the original target EADS servers to which data stored on a specified EADS server is copied.

getCurrentMasterNode()

Acquires information about the source EADS server that currently stores a specified key (or group).

getOriginalMasterNode()

Acquires information about the original source EADS server that stores a specified key (or group).

(5) create() (path specification)

(a) Description

This method initializes an EADS client according to the client properties.

Each time this method is executed, a thread for monitoring communication timeouts and a thread for monitoring the cluster are generated. These threads are terminated when destroy() is executed.

If a problem occurs when the EADS client is initialized, the method returns an exception.

(b) Format

public static CacheManager create(String fileName)
                           throws CacheException

(c) Parameters

fileName

Specifies the path name of the storage location of the EADS client's client property file.

Specifying null or the null character string is invalid.

(d) Return value

This method returns an instance of the CacheManager class.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InitializeException (CacheManager class initialization failure)

  • InternalClientException (EADS client internal error)

(f) Notes

  • If you will be executing multiple EADS clients concurrently on the same machine, specify a different log output destination for each EADS client. Valid operation cannot be guaranteed if you specify the same log output destination for multiple EADS clients that execute concurrently. For details about specifying the log output destination, see 8.4.2 Specifying the file output destinations.

  • If you execute this method on a Java EE server (uCosminexus Application Server), you must execute destroy() after executing this method. If you fail to do this, a memory leak will occur.

(6) create() (EADS client name and path specification)

(a) Description

This method initializes an EADS client according to the client properties.

Each time this method is executed, a thread for monitoring communication timeouts and a thread for monitoring the cluster are generated. These threads are terminated when destroy() is executed.

If a problem occurs when the EADS client is initialized, the method returns an exception.

(b) Format

public static CacheManager create(String clientName, String fileName)
                           throws CacheException

(c) Parameters

clientName

Specifies an EADS client name.

For details about the data that can be specified, see 15.2.2(5) Data that can be specified as EADS client names.

For the relationships between EADS client names and log file output destinations, see 8.4.2 Specifying the file output destinations.

fileName

Specifies the path name of the client property file storage location on the EADS client.

Specifying null or the null character string is invalid.

(d) Return value

This method returns an instance of the CacheManager class.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InitializeException (CacheManager class initialization failure)

  • InternalClientException (EADS client internal error)

(f) Notes

  • If you will be executing multiple EADS clients concurrently on the same machine, specify a different log output destination for each EADS client. Valid operation cannot be guaranteed if you specify the same log output destination for multiple EADS clients that execute concurrently. For details about specifying the log output destination, see 8.4.2 Specifying the file output destinations.

  • If you execute this method on a Java EE server (uCosminexus Application Server), you must execute destroy() after executing this method. If you fail to do this, a memory leak will occur.

(7) create() (input stream specification)

(a) Description

This method initializes an EADS client according to the client properties.

Each time this method is executed, a thread for monitoring communication timeouts and a thread for monitoring the cluster are generated. These threads are terminated when destroy() is executed.

If a problem occurs when the EADS client is initialized, the method returns an exception.

(b) Format

public static CacheManager create(InputStream in)
                           throws CacheException

(c) Parameters

in

Specifies an input stream for importing the EADS client's client property file.

Specifying null is invalid.

(d) Return value

An instance of the CacheManager class is returned.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InitializeException (CacheManager class initialization failure)

  • InternalClientException (EADS client internal error)

(f) Notes

  • If you will be executing multiple EADS clients concurrently on the same machine, specify a different log output destination for each EADS client. Valid operation cannot be guaranteed if you specify the same log output destination for multiple EADS clients that execute concurrently. For details about specifying the log output destination, see 8.4.2 Specifying the file output destinations.

  • If you execute this method on a Java EE server (uCosminexus Application Server), you must execute destroy() after executing this method. If you fail to do this, a memory leak will occur.

(8) create() (EADS client name and input stream specification)

(a) Description

This method initializes an EADS client according to the client properties.

Each time this method is executed, a thread for monitoring communication timeouts and a thread for monitoring the cluster are generated. These threads are terminated when destroy() is executed.

If a problem occurs when the EADS client is initialized, the method returns an exception.

(b) Format

public static CacheManager create(String clientName, InputStream in)
                           throws CacheException

(c) Parameters

clientName

Specifies an EADS client name.

For details about the data that can be specified, see 15.2.2(5) Data that can be specified as EADS client names.

For the relationships between EADS client names and log file output destinations, see 8.4.2 Specifying the file output destinations.

in

Specifies an input stream for importing the EADS client's client property file.

Specifying null is invalid.

(d) Return value

This method returns an instance of the CacheManager class.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InitializeException (CacheManager class initialization failure)

  • InternalClientException (EADS client internal error)

(f) Notes

  • If you will be executing multiple EADS clients concurrently on the same machine, specify a different log output destination for each EADS client. Valid operation cannot be guaranteed if you specify the same log output destination for multiple EADS clients that execute concurrently. For details about specifying the log output destination, see 8.4.2 Specifying the file output destinations.

  • If you execute this method on a Java EE server (uCosminexus Application Server), you must execute destroy() after executing this method. If you fail to do this, a memory leak will occur.

(9) create() (client properties specification)

(a) Description

This method initializes an EADS client according to the client properties.

Each time this method is executed, a thread for monitoring communication timeouts and a thread for monitoring the cluster are generated. These threads are terminated when destroy() is executed.

If a problem occurs when the EADS client is initialized, the method returns an exception.

(b) Format

public static CacheManager create(Properties properties)
                           throws CacheException

(c) Parameters

properties

Specifies client properties of the EADS client.

Specifying null is invalid.

(d) Return value

This method returns an instance of the CacheManager class.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InitializeException (CacheManager class initialization failure)

  • InternalClientException (EADS client internal error)

(f) Notes

  • If you will be executing multiple EADS clients concurrently on the same machine, specify a different log output destination for each EADS client. Valid operation cannot be guaranteed if you specify the same log output destination for multiple EADS clients that execute concurrently. For details about specifying the log output destination, see 8.4.2 Specifying the file output destinations.

  • If you execute this method on a Java EE server (uCosminexus Application Server), you must execute destroy() after executing this method. If you fail to do this, a memory leak will occur.

(10) create() (EADS client name and client properties specification)

(a) Description

This method initializes an EADS client according to the client properties.

Each time this method is executed, a thread for monitoring communication timeouts and a thread for monitoring the cluster are generated. These threads are terminated when destroy() is executed.

If a problem occurs when the EADS client is initialized, the method returns an exception.

(b) Format

public static CacheManager create(String clientName, Properties properties)
                           throws CacheException

(c) Parameters

clientName

Specifies an EADS client name.

For details about the data that can be specified, see 15.2.2(5) Data that can be specified as EADS client names.

For the relationships between EADS client names and log file output destinations, see 8.4.2 Specifying the file output destinations.

properties

Specifies client properties of the EADS client.

Specifying null is invalid.

(d) Return value

This method returns an instance of the CacheManager class.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InitializeException (CacheManager class initialization failure)

  • InternalClientException (EADS client internal error)

(f) Notes

  • If you will be executing multiple EADS clients concurrently on the same machine, specify a different log output destination for each EADS client. Valid operation cannot be guaranteed if you specify the same log output destination for multiple EADS clients that execute concurrently. For details about specifying the log output destination, see 8.4.2 Specifying the file output destinations.

  • If you execute this method on a Java EE server (uCosminexus Application Server), you must execute destroy() after executing this method. If you fail to do this, a memory leak will occur.

(11) getCache()

(a) Description

This method starts access to a cache and acquires an instance of the Cache class.

The method also places the instance of the cache whose access was terminated by removeCache() in active status again.

If a problem occurs when access to the cache begins, the method returns an exception.

(b) Format

public Cache getCache(String name)
               throws CacheException

(c) Parameters

name

Specifies the cache name of the Cache class that is to be acquired.

For details about the data types that can be specified, see 15.2.2(4) Data types that can be specified as cache names.

(d) Return value

This method returns an instance of the Cache class that is associated with the specified cache name.

If getCache() has already been executed with the same cache name specified, it returns the same instance as for the initial execution.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(12) removeCache()

(a) Description

This method terminates cache access.

If a problem occurs when access to the cache terminates, the method returns an exception.

(b) Format

public void removeCache(String name)
                 throws CacheException

(c) Parameters

name

Specifies the Cache class cache name that is to be terminated.

For details about the data types that can be specified, see 15.2.2(4) Data types that can be specified as cache names.

(d) Exceptions

  • UserOperationException (illegal user operation)

  • InternalClientException (EADS client internal error)

(e) Notes

Use this method carefully, especially when multiple threads are running, because this method terminates accesses to all caches (instances of the Cache class) that were acquired by specifying the same cache name.

(13) destroy()

(a) Description

This method performs termination processing on all caches and terminates usage of the EADS client.

If the EADS client has already been terminated by executing destroy(), this method returns CacheException.EAD_ERROR_CLIENT_FINALIZED.

(b) Format

public void destroy()
             throws CacheException

(c) Exceptions

  • UserOperationException (illegal user operation)

  • InternalClientException (EADS client internal error)

(d) Notes

  • Execute destroy() paired with create(). Execute destroy() only once for an instance acquired by create().

  • In the case of a Java EE server (uCosminexus Application Server), you must execute this method. If you fail to do so, a memory leak will occur.

(14) getNodeList()

(a) Description

This method acquires information about the connection-target EADS servers maintained by the EADS client.

If a problem occurs when information about the connection-target EADS server is acquired, the method returns an exception.

(b) Format

public Node[] getNodeList()
                   throws CacheException

(c) Return value

This method returns information about the connection-target EADS servers maintained by the EADS client.

The method returns information about all the EADS servers regardless of their EADS server status.

(d) Exceptions

  • UserOperationException (illegal user operation)

  • InternalClientException (EADS client internal error)

(e) Notes

  • Execution of this method does not establish communication with the EADS servers. Therefore, the acquired information might not be the most recent information.

  • When this method is executed, whether the EADS servers are connected is not checked. Therefore, the acquired information might contain EADS servers that cannot be connected (because, for example, EADS servers are isolated). If you plan to use an acquired EADS server as a connection target, use isEnable() of the Node class to check whether a connection can be established with that EADS server.

    For details about isEnable() of the Node class, see 18.1.3(6) isEnable().

(15) [Deprecated] getNode()

Reference note

This method is deprecated. Instead, use the getOriginalMasterNode() method of the CacheManager class.

(a) Description

This method acquires information about the original source EADS server that stores a specified key (or group).

By original source EADS server is meant the EADS server that stores the original data of a specified key (or group) when all EADS servers making up the cluster can be connected successfully.

(b) Format

public Node getNode(String key)
             throws CacheException

(c) Parameters

key

Specifies a key (or a group).

For details about the data types that can be specified, see 15.2.2(1) Data types that can be specified as keys.

(d) Return value

This method returns an instance of the Node class that indicates the EADS server from which the specified key (or group) was copied.

Whether the connection-target EADS server can be connected has no effect on the return value.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InternalClientException (EADS client internal error)

(f) Notes

  • Execution of this method does not establish communication with the EADS server. Therefore, the acquired information might not be the most recent information.

  • If there have been no changes to the cluster configuration, information about the same EADS server will always be acquired, regardless of whether that EADS server can be connected.

  • If you plan to use the acquired EADS server as a connection target, use isEnable() of the Node class to check whether a connection can be established with that EADS server.

    For details about isEnable() of the Node class, see 18.1.3(6) isEnable().

(16) getSlaveNodeList()

(a) Description

This method acquires information about the original target EADS servers to which data stored on a specified EADS server is copied.

By original target EADS server is meant an EADS server to which data stored on a specified EADS server (source EADS server) is copied when all EADS servers making up the cluster can be connected successfully.

(b) Format

public Node[] getSlaveNodeList(Node masterNode)
                        throws CacheException

(c) Parameters

masterNode

Specifies the EADS server (an instance of the Node class obtained from the CacheManager class) that stores the copy source data. If any other instance is specified, correct operation is not guaranteed.

This parameter is invalid in the following cases:

  • null is specified.

  • The address information managed by the specified Node class (IP address and port number) does not match any EADS server address information maintained by the EADS client.

(d) Return value

This method returns information about the original target EADS servers as an array of the Node class.

Whether a connection-target EADS server can be connected has no effect on the return value.

If the data multiplicity is 1, the method returns an array containing no elements.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InternalClientException (EADS client internal error)

(f) Notes

  • Execution of this method does not establish communication with the EADS servers. Therefore, the acquired information might not be the most recent information.

  • When this method is executed, whether the specified EADS server and the target EADS servers for information acquisition are connected is not checked. Therefore, the acquired information might contain EADS servers that cannot be connected (because, for example, the EADS servers are isolated).

(17) getCurrentMasterNode()

(a) Description

This method acquires information about the source EADS server that currently stores a specified key (or group).

(b) Format

public Node getCurrentMasterNode(String key)
                          throws CacheException

(c) Parameters

key

Specifies a key (or a group).

For details about the data that can be specified, see 15.2.2(1) Data types that can be specified as keys.

(d) Return value

This method returns an instance of the Node class that indicates the source EADS server that currently stores the specified key (or group).

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

Execution of this method does not establish communication with the EADS server. Therefore, the acquired information might not be the most recent information.

(18) getOriginalMasterNode()

(a) Description

This method acquires information about the original source EADS server that stores a specified key (or group).

By original source EADS server is meant the EADS server that stores the master copy (source data) of a specified key (or group) when all EADS servers making up the cluster can be connected successfully. This EADS server might be different from the current source EADS server.

If there have been no changes to the cluster configuration, information about the same EADS server will always be acquired, regardless of whether the EADS server can be connected.

(b) Format

public Node getOriginalMasterNode(String key)
                           throws CacheException

(c) Parameters

key

Specifies a key (or a group).

For details about the data that can be specified, see 15.2.2(1) Data types that can be specified as keys.

(d) Return value

This method returns an instance of the Node class that indicates the original source EADS server that stores the specified key (or group).

Whether the connection-target EADS server can be connected has no effect on the return value.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • InternalClientException (EADS client internal error)

(f) Notes

  • Execution of this method does not establish communication with the EADS server. Therefore, the acquired information might not be the most recent information.

  • If you plan to use the acquired EADS server as a connection target, use isEnable() of the Node class to check whether a connection can be established with that EADS server.

    For details about isEnable() of the Node class, see 18.1.3(6) isEnable().