Hitachi

In-Memory Data Grid Hitachi Elastic Application Data Store


18.1.1 Cache class

Organization of this subsection

(1) Description

This is a class used for manipulating data.

(2) Inheritance relationship

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

(3) Format

public class Cache
extends java.lang.Object

(4) List of methods

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

Method name

Description

getName()

Acquires a cache name associated with an instance of the Cache class.

put()

Associates a value with a key, and then stores it.

putAll()

Using a batch operation, this method stores the keys and values that are associated in a specified map.

create()

Associates a value with a key, and then stores it only when a new key is stored.

update()

Associates a value with a key, and then stores it only if the specified key has already been stored.

replace()

Compares the value associated with a specified key with a value (comparativeValue) specified as a condition. Only if the values match, this method associates the value with the key, and then stores it.

get()

Acquires a value associated with a specified key.

getAll() (set specification)

Using a batch operation, this method acquires the values associated with a specified list of keys. The acquired values are associated with keys and stored in a map specified in the argument.

getAll() (group specification)

Using a batch operation, this method acquires the values associated with the keys that belong to a specified group and its lower hierarchy groups. The acquired values are associated with keys and stored in a map specified in the argument.

remove()

Deletes a specified key and the value associated with that key.

removeAll() (set specification)

Using a batch operation, this method deletes the values associated with a specified list of keys.

removeAll() (group specification)

Using a batch operation, this method deletes the keys and values that belong to a specified group, including the keys and values that belong to lower hierarchy groups.

removeAll() (EADS server specification)

Using a batch operation, this method deletes the keys and values that were copied from a specified EADS server.

getGroupNameSet()

Acquires a list of the group names of the groups in the highest hierarchy that are stored on a specified EADS server.

The group names are listed in ascending order based on their ASCII code values.

getKeySet() (group specification)

Acquires a list of keys that belong to a specified group. The list of keys includes the keys that belong to the groups under the specified group's hierarchy.

The keys are listed in ascending order based on their ASCII code values.

getKeySet() (EADS server specification)

Acquires a list of keys stored on a specified EADS server.

The keys are listed in ascending order based on their ASCII code values.

getGroupCount()

Acquires the number of groups in the highest hierarchy that are stored on a specified EADS server.

getKeyCount() (group specification)

Acquires the number of keys that belong to a specified group. The number of keys that will be acquired includes the keys that belong to the groups under the specified group's hierarchy.

getKeyCount() (EADS server specification)

Acquires the number of keys stored on a specified EADS server.

getFirstKey() (group specification)

Acquires the first key in ascending order based on its ASCII code value from among all the keys that belong to a specified group. The keys that belong to the groups under the specified group's hierarchy are also subject to this acquisition processing.

getFirstKey() (EADS server specification)

Acquires the first key in ascending order based on its ASCII code value from among all the keys that are stored on a specified EADS server.

getNextKey() (group specification and key specification)

Acquires the key that immediately follows a specified key in ascending order based on its ASCII code value from among all the keys that belong to a specified group. The keys that belong to the groups under the specified group's hierarchy are also subject to this acquisition processing.

getNextKey() (EADS server specification and key specification)

Acquires the key that immediately follows a specified key in ascending order based on its ASCII code value from among all the keys that are stored on a specified EADS server.

executeFunction() (key specification or group specification)

Determines from a specified key or group the EADS server on which a user function is to be executed and then executes that user function.

executeFunction() (key specification or group specification, and reception timeout specification)

Determines from a specified key or group the EADS server on which a user function is to be executed and then executes that user function. This method also sets a reception timeout value.

executeFunction() (EADS server specification)

Executes a user function with an EADS server specified.

executeFunction() (EADS server specification and reception timeout specification)

Executes a user function with an EADS server specified and sets a reception timeout value.

(5) getName()

(a) Description

This method acquires a cache name associated with an instance of the Cache class.

You can also use this method after an access to a cache is terminated by removeCache() of the CacheManager class.

(b) Format

public String getName()

(c) Return value

This method returns the name of the cache associated with the instance of the Cache class.

(6) put()

(a) Description

This method associates a value with a key, and then stores it.

If a problem occurs when the value is stored, the method returns an exception.

(b) Format

public void put(String key,
                Object value)
         throws CacheException

(c) Parameters

key

Specifies a key to be associated with the value.

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

value

Specifies the value to be stored

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

(d) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(7) putAll()

(a) Description

Using a batch operation, this method stores the keys and values that are associated in a specified map.

If a problem occurs when a value is stored, the method returns an exception.

(b) Format

public void putAll(java.util.Map<String,? extends Object> map)
            throws CacheException

(c) Parameters

map

Using a batch operation, this parameter specifies a map that associates keys and values that are stored.

If null or a map containing no element is specified, an error results.

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

For details about the values that can be stored in caches, see 15.2.2(3) Data types that can be specified as values.

(d) Exceptions

  • UserOperationException (illegal user operation)

  • AllFailureException (failure of entire batch operation)

  • PartFailureException (failure of part of the batch operation)

  • InternalClientException (EADS client internal error)

(e) Notes

  • If all value storage operations failed, exception AllFailureException and error code CacheException.EAD_ERROR_BATCH_FAILED_ALL are returned.

    If some but not all of the value storage operations failed, exception PartFailureException and error code CacheException.EAD_ERROR_BATCH_FAILED_PART are returned.

    By obtaining information from each exception, you can determine the key operation that failed and the cause of the failure.

  • If some of the cache operations failed, determine the operations that failed from the exception and re-execute this method, if necessary.

  • Because caches are not locked while operations are ongoing, a target value might be changed by another cache operation during batch operation.

  • When batch operations are performed on a large amount of data, a large amount of memory might be required by EADS clients and EADS servers.

  • When batch operations are performed on a large amount of data, it might take a long time to complete the processing. To ensure proper operation, make sure that you design a timeout value that is appropriate for the processing time.

(8) create()

(a) Description

This method associates a value with a key, and then stores it only when a new key is stored.

If a problem occurs when the value is stored, the method returns an exception.

(b) Format

public void create(String key,
                   Object value)
            throws CacheException

(c) Parameters

key

Specifies a key to be associated with the value.

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

value

Specifies the value to be stored.

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

(d) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(9) update()

(a) Description

This method associates a value with a key, and then stores it only when the specified key has already been stored.

If a problem occurs when the value is stored, the method returns an exception.

(b) Format

public void update(String key,
                   Object value)
            throws CacheException

(c) Parameters

key

Specifies a key to be associated with the value.

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

value

Specifies the value to be stored.

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

(d) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(10) replace()

(a) Description

This method compares the value associated with a specified key with a value (comparativeValue) specified as a condition. Only if the values match, this method associates the value with the key, and then stores it.

If a problem occurs when the value is replaced, the method returns an exception.

(b) Format

public void replace(String key,
                    Object value,
                    Object comparativeValue)
             throws CacheException

(c) Parameters

key

Specifies a key that is associated with the value to be replaced.

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

value

Specifies the value to be stored.

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

comparativeValue

Specifies the value to be compared.

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

(d) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(11) get()

(a) Description

This method acquires a value associated with a specified key.

If a problem occurs when the value is acquired, the method returns an exception.

(b) Format

public java.lang.Object get(String key)
                     throws CacheException

(c) Parameters

key

Specifies a key that is associated with the value to be acquired.

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 the value associated with the key.

If nothing is associated with the specified key, it returns null.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

Do not change the context class loader for the thread that executes get(). If the context class loader settings are invalid, deserialization of the return value object fails.

(12) getAll() (set specification)

(a) Description

Using a batch operation, this method acquires the values associated with a specified list of keys. The acquired values are associated with keys and stored in a map specified in the argument.

If a problem occurs when a value is acquired, the method returns an exception.

(b) Format

public void getAll(java.util.Set<String> keys,
                   java.util.Map<String, Object> returnMap)
            throws CacheException

(c) Parameters

keys

Specifies a list of keys that are associated with the values to be acquired.

If null or a list of keys that contains no elements is specified, an error results.

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

returnMap

Specifies a map for storing the acquired values.

If null is specified, this parameter is invalid.

(d) Exceptions

  • UserOperationException (illegal user operation)

  • AllFailureException (failure of entire batch operation)

  • PartFailureException (failure of part of the batch operation)

  • InternalClientException (EADS client internal error)

(e) Notes

  • If all value acquisition operations failed, exception AllFailureException and error code CacheException.EAD_ERROR_BATCH_FAILED_ALL are returned.

    If some but not all of the value acquisition operations failed, exception PartFailureException and error code CacheException.EAD_ERROR_BATCH_FAILED_PART are returned.

    By obtaining information from each exception, you can determine the key operation that failed and the cause of the failure.

  • If the map specified in the argument already contains keys and values to be acquired, those keys and values are overwritten by the acquired values.

  • If no value is stored in cache for a specified key, nothing is stored in the map specified in the argument.

  • If some of the cache operations failed, determine the operation that failed from the exception and re-execute this method, if necessary.

  • Because caches are not locked while operations are ongoing, a target value might be changed by another cache operation during batch operation.

  • When batch operations are performed on a large amount of data, a large amount of memory might be required by EADS clients and EADS servers.

  • When batch operations are performed on a large amount of data, it might take a long time to complete the processing. To ensure proper operation, make sure that you design a timeout value that is appropriate for the processing time.

(13) getAll() (group specification)

(a) Description

Using a batch operation, this method acquires the values associated with the keys that belong to a specified group and its lower hierarchy groups. The acquired values are associated with the keys and stored in a map specified in the argument.

If acquisition of a value fails for some reason during batch acquisition of values, only the values that were acquired successfully are stored in the map. The method returns an exception indicating the cause of the failure.

(b) Format

public void getAll(String groupName,
                   java.util.Map<String, Object> returnMap)
            throws CacheException

(c) Parameters

groupName

Specifies the name of the group for which values are to be acquired.

For details about the data that can be specified, see 15.2.2(2) Data that can be specified as group names.

returnMap

Specifies a map for storing the acquired values.

If null is specified, an error results.

(d) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(e) Notes

  • If the map specified in the argument already contains keys and values to be acquired, those keys and values are overwritten by the acquired values.

  • If no value is stored in cache for a specified key, nothing is stored in the map specified in the argument.

  • If some but not all of the cache operations have failed, check the cache operation results, and then re-execute this method, if necessary.

  • Because caches are not locked while operations are ongoing, a target value might be changed by another cache operation during batch operation.

  • When batch operations are performed on a large amount of data, a large amount of memory might be required by EADS clients and EADS servers.

  • When batch operations are performed on a large amount of data, it might take a long time to complete the processing. To ensure proper operation, make sure that you design a timeout value that is appropriate for the processing time.

(14) remove()

(a) Description

This method deletes a specified key and the value associated with that key.

If a problem occurs when a value is deleted, the method returns an exception.

(b) Format

public void remove(String key)
            throws CacheException

(c) Parameters

key

Specifies the key that is associated with the value to be deleted.

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

(d) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(15) removeAll() (set specification)

(a) Description

Using a batch operation, this method deletes the values associated with a specified list of keys.

If a problem occurs when a value is deleted, the method returns an exception.

(b) Format

public void removeAll(java.util.Set<String> keys)
               throws CacheException

(c) Parameters

keys

Specifies a list of keys that are associated with the values that are to be deleted.

If null or a list of keys that contains no elements is specified, an error results.

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

(d) Exceptions

  • UserOperationException (illegal user operation)

  • AllFailureException (failure of entire batch operation)

  • PartFailureException (failure of part of the batch operation)

  • InternalClientException (EADS client internal error)

(e) Notes

  • If all value deletion operations failed, exception AllFailureException and error code CacheException.EAD_ERROR_BATCH_FAILED_ALL are returned.

    If some but not all of the value deletion operations failed, exception PartFailureException and error code CacheException.EAD_ERROR_BATCH_FAILED_PART are returned.

    By obtaining information from each exception, you can determine the key operation that failed and the cause of the failure.

  • If an exception is returned, data that was to be deleted might still remain. For this reason, it is important to determine from the exception which operation failed and then take appropriate action. If necessary, re-execute removeAll() (set specification).

  • Because caches are not locked while operations are ongoing, a target value might be changed by another cache operation during batch operation.

  • When batch operations are performed on a large amount of data, a large amount of memory might be required by EADS clients and EADS servers.

  • When batch operations are performed on a large amount of data, it might take a long time to complete the processing. To ensure proper operation, make sure that you design a timeout value that is appropriate for the processing time.

(16) removeAll() (group specification)

(a) Description

Using a batch operation, this method deletes the keys and values that belong to a specified group, including the keys and values that belong to lower hierarchy groups.

If a problem occurs when a value is deleted, the method returns an exception.

(b) Format

public void removeAll(String groupName)
               throws CacheException

(c) Parameters

groupName

Specifies the name of the group to be deleted.

For details about the data that can be specified, see 15.2.2(2) Data that can be specified as group names.

(d) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(e) Notes

  • If an exception is returned, data that was to be deleted might still remain. For this reason, it is important to check the execution results and then take appropriate action. If necessary, re-execute removeAll() (group specification).

  • Because caches are not locked while operations are ongoing, a target value might be changed by another cache operation during batch operation.

  • When batch operations are performed on a large amount of data, a large amount of memory might be required by EADS clients and EADS servers.

  • When batch operations are performed on a large amount of data, it might take a long time to complete the processing. To ensure proper operation, make sure that you design a timeout value that is appropriate for the processing time.

(17) removeAll() (EADS server specification)

(a) Description

Using a batch operation, this method deletes the keys and values that were copied from a specified EADS server.

If a problem occurs when a value is deleted, the method returns an exception.

(b) Format

public void removeAll(Node targetNode)
               throws CacheException

(c) Parameters

targetNode

Specifies the EADS server that will be performing the batch deletion processing.

You can specify only an instance of the Node class that has been acquired from the CacheManager class. If any other instance is specified, valid operation is not guaranteed.

(d) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(e) Notes

  • If an exception is returned, data that was to be deleted might still remain. For this reason, it is important to check the execution results and then take appropriate action. If necessary, re-execute removeAll() (EADS server specification).

  • Because caches are not locked while operations are ongoing, a target value might be changed by another cache operation during batch operation.

  • When batch operations are performed on a large amount of data, a large amount of memory might be required by EADS clients and EADS servers.

  • When batch operations are performed on a large amount of data, it might take a long time to complete the processing. To ensure proper operation, make sure that you design a timeout value that is appropriate for the processing time.

(18) getGroupNameSet()

(a) Description

This method acquires a list of the group names of the groups in the highest hierarchy that are stored on a specified EADS server.

The group names are listed in ascending order based on their ASCII code values.

(b) Format

public java.util.Set<String> getGroupNameSet(Node targetNode)
                                      throws CacheException

(c) Parameters

targetNode

Specifies the EADS server whose group names are to be acquired.

You can specify only an instance of the Node class that has been acquired from the CacheManager class. If any other instance is specified, valid operation is not guaranteed.

(d) Return value

This method returns a list of the group names of the groups in the highest hierarchy that are stored on the specified EADS server.

If the specified EADS server does not contain any keys that belong to the group, the method returns null.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

As the number of groups on the specified EADS server increases, the time required for acquisition processing increases. The amount of resources required for the acquisition processing also increases.

(19) getKeySet() (group specification)

(a) Description

This method acquires a list of the keys that belong to a specified group. The list of keys includes the keys that belong to the groups under the specified group's hierarchy.

The keys are listed in ascending order based on their ASCII code values.

(b) Format

public java.util.Set<String> getKeySet(String groupName)
                                throws CacheException

(c) Parameters

groupName

Specifies a group name.

For details about the data that can be specified, see 15.2.2(2) Data that can be specified as group names.

(d) Return value

The method returns a list of keys that belong to the specified group.

If no keys belong to the specified group, the method returns null.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

As the number of keys in the specified group increases, the time required for acquisition processing increases. The amount of resources required for the acquisition processing also increases.

(20) getKeySet() (EADS server specification)

(a) Description

This method acquires a list of the keys that are stored on a specified EADS server.

The keys are listed in ascending order based on their ASCII code values.

(b) Format

public java.util.Set<String> getKeySet(Node targetNode)
                                throws CacheException

(c) Parameters

targetNode

Specifies the EADS server from which a list of keys is to be acquired.

You can specify only an instance of the Node class that has been acquired from the CacheManager class. If any other instance is specified, valid operation is not guaranteed.

(d) Return value

This method returns a list of keys stored on the specified EADS server.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

As the number of keys on the specified EADS server increases, the time required for acquisition processing increases. The amount of resources required for the acquisition processing also increases.

(21) getGroupCount()

(a) Description

This method acquires the number of groups in the highest hierarchy that are stored on a specified EADS server.

(b) Format

public int getGroupCount(Node targetNode)
                  throws CacheException

(c) Parameters

targetNode

Specifies the EADS server from which the number of groups is to be acquired.

You can specify only an instance of the Node class that has been acquired from the CacheManager class. If any other instance is specified, valid operation is not guaranteed.

(d) Return value

This method returns the number of groups in the highest hierarchy that are stored on the specified EADS server.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(22) getKeyCount() (group specification)

(a) Description

This method acquires the number of keys that belong to a specified group. The number of keys that will be acquired includes the keys that belong to the groups under the specified group's hierarchy.

(b) Format

public int getKeyCount(String groupName)
                throws CacheException

(c) Parameters

groupName

Specifies a group name.

For details about the data that can be specified, see 15.2.2(2) Data that can be specified as group names.

(d) Return value

This method returns the number of keys that belong to the specified group.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(23) getKeyCount() (EADS server specification)

(a) Description

This method acquires the number of keys stored on a specified EADS server.

(b) Format

public int getKeyCount(Node targetNode)
                throws CacheException

(c) Parameters

targetNode

Specifies the EADS server from which the number of keys is to be acquired.

You can specify only an instance of the Node class that has been acquired from the CacheManager class. If any other instance is specified, valid operation is not guaranteed.

(d) Return value

This method returns the number of keys that belong to the specified EADS server.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(24) getFirstKey() (group specification)

(a) Description

This method acquires the first key in ascending order based on its ASCII code value from among all the keys that belong to a specified group. The keys that belong to the groups under the specified group's hierarchy are also subject to this acquisition processing.

(b) Format

public String getFirstKey(String groupName)
                   throws CacheException

(c) Parameters

groupName

Specifies a group name.

For details about the data that can be specified, see 15.2.2(2) Data that can be specified as group names.

(d) Return value

This method returns the first key in ascending order based on its ASCII code value from among all the keys that belong to the specified group.

If no keys belong to the specified group, the method returns null.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(25) getFirstKey() (EADS server specification)

(a) Description

This method acquires the first key in ascending order based on its ASCII code value from among all the keys that are stored on a specified EADS server.

(b) Format

public String getFirstKey(Node targetNode)
                   throws CacheException

(c) Parameters

targetNode

Specifies the EADS server from which a key is to be acquired.

You can specify only an instance of the Node class that has been acquired from the CacheManager class. If any other instance is specified, valid operation is not guaranteed.

(d) Return value

This method acquires the first key in ascending order based on its ASCII code value from among all the keys that are stored on the specified EADS server.

If the specified EADS server contains no keys, the method returns null.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(26) getNextKey() (group specification and key specification)

(a) Description

This method acquires the key that immediately follows a specified key in ascending order based on its ASCII code value from among all the keys that belong to a specified group. The keys that belong to the groups under the specified group's hierarchy are also subject to this acquisition processing.

If the specified key does not exist on the connection-target EADS server, the method similarly acquires the key that immediately follows the specified key.

(b) Format

public String getNextKey(String groupName, String key)
                  throws CacheException

(c) Parameters

groupName

Specifies a group name.

For details about the data that can be specified, see 15.2.2(2) Data that can be specified as group names.

key

Specifies the reference key.

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 the key that immediately follows the specified key in ascending order based on its ASCII code value from among all the keys that belong to the specified group.

If no key follows the specified key, the method returns null.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

  • This method determines the connection-target EADS server based on the specified group.

  • The EADS server that stores the keys belonging to the specified group might have changed due to isolation, restoration, or addition (scale-out) processing on EADS servers other than the connection-target EADS server. Therefore, if you have obtained the reference key by executing getFirstKey() (group specification), a connection might be established with a different EADS server.

  • Because groups are not locked on EADS servers, keys that belong to groups might be inserted or deleted by another process after getFirstKey() (group specification) or getNextKey() (group specification and key specification) was executed.

(27) getNextKey() (EADS server specification and key specification)

(a) Description

This method acquires the key that immediately follows a specified key in ascending order based on its ASCII code value from among all the keys that are stored on a specified EADS server.

If the specified key does not exist on the connection-target EADS server, the method similarly acquires the key that immediately follows the specified key.

(b) Format

public String getNextKey(Node targetNode, String key)
                  throws CacheException

(c) Parameters

targetNode

Specifies the EADS server from which a key is to be acquired.

You can specify only an instance of the Node class that has been acquired from the CacheManager class. If any other instance is specified, operation is not guaranteed.

key

Specifies the reference key.

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 the key that immediately follows the specified key in ascending order based on its ASCII code value from among all the keys that are stored on the specified EADS server.

If no key follows the specified key, the method returns null.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

  • The EADS server that stores the specified key might have changed due to isolation, restoration, or addition (scale-out) processing on EADS servers other than the connection-target EADS server.

  • Because groups are not locked on EADS servers, keys that belong to groups might be inserted or deleted by another process after getFirstKey() (EADS server specification) or getNextKey() (EADS server specification and key specification) was executed.

(28) executeFunction() (key specification or group specification)

(a) Description

This method determines from a specified key or group the EADS server on which a user function is to be executed and then executes that user function.

If a problem occurs when the user function executes, the method returns an exception.

(b) Format

public Object executeFunction(String keyOrGroupName,
                              String funcName,
                              Object arg)
                       throws CacheException

(c) Parameters

keyOrGroupName

Specifies a key or a group name.

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

funcName

Specifies a user function name.

A user function name can consist of single-byte alphanumeric characters (0 to 9, A to Z, and a to z), underscores (_), periods (.), and dollar signs ($).

There is no limit to the number of characters.

Specifying null or the null character string is invalid.

arg

Specifies the arguments to be passed to the user function.

If the object cannot be serialized, an error results.

There is no limit to the size of the object.

If no argument is passed, specify null.

(d) Return value

This method returns the execution results set by the user function.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

Do not change the context class loader for the thread that executes executeFunction(). If the context class loader settings are invalid, deserialization of the return value object fails.

(29) executeFunction() (key specification or group specification, and reception timeout specification)

(a) Description

This method determines from a specified key or group the EADS server on which a user function is to be executed and then executes that user function. This method also sets a reception timeout value.

The value specified in the recvTimeout argument is used as the reception timeout value, not the value of the eads.client.connection.receive.timeout parameter in the client properties.

If a problem occurs when the user function executes, the method returns an exception.

If a timeout occurs, the method returns CacheException.EAD_ERROR_NET_TIMEOUT.

(b) Format

public Object executeFunction(String keyOrGroupName,
                              String funcName,
                              Object arg,
                              int recvTimeout)
                       throws CacheException

(c) Parameters

keyOrGroupName

Specifies a key or a group name.

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

funcName

Specifies a user function name.

A user function name can consist of single-byte alphanumeric characters (0 to 9, A to Z, and a to z), underscores (_), periods (.), and dollar signs ($).

There is no limit to the number of characters.

Specifying null or the null character string is invalid.

arg

Specifies the arguments to be passed to the user function.

If the object cannot be serialized, an error results.

There is no limit to the size of the object.

If no argument is passed, specify null.

recvTimeout

Specifies a data reception timeout value (in milliseconds).

For details about the data that can be specified, see 9.3.3(3)(b) eads.client.connection.receive.timeout.

(d) Return value

This method returns the execution results set by the user function.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

Do not change the context class loader for the thread that executes executeFunction(). If any context class loader settings are invalid, deserialization of the return value object will fail.

(30) executeFunction() (EADS server specification)

(a) Description

This method executes a user function with an EADS server specified.

If a problem occurs when the user function executes, the method returns an exception.

(b) Format

public Object executeFunction(Node targetNode,
                              String funcName,
                              Object arg)
                       throws CacheException

(c) Parameters

targetNode

Specifies an EADS server (an instance of the Node class obtained from the CacheManager class). 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.

funcName

Specifies a user function name.

A user function name can consist of single-byte alphanumeric characters (0 to 9, A to Z, and a to z), underscores (_), periods (.), and dollar signs ($).

There is no limit to the number of characters.

Specifying null or the null character string is invalid.

arg

Specifies the arguments to be passed to the user function.

If the object cannot be serialized, an error results.

There is no limit to the size of the object.

If no argument is passed, specify null.

(d) Return value

This method returns the execution results set by the user function.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

Do not change the context class loader for the thread that executes executeFunction(). If the context class loader settings are invalid, deserialization of the return value object fails.

(31) executeFunction() (EADS server specification and reception timeout specification)

(a) Description

This method executes a user function with an EADS server specified and sets a reception timeout value.

The value specified in the recvTimeout argument is used as the reception timeout value, not the value of the eads.client.connection.receive.timeout parameter in the client properties.

If a problem occurs when the user function executes, the method returns an exception.

If a timeout occurs, the method returns CacheException.EAD_ERROR_NET_TIMEOUT.

(b) Format

public Object executeFunction(Node targetNode,
                              String funcName,
                              Object arg,
                              int recvTimeout)
                       throws CacheException

(c) Parameters

targetNode

Specifies an EADS server (an instance of the Node class obtained from the CacheManager class). If any other instance is specified, valid 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.

funcName

Specifies a user function name.

A user function name can consist of single-byte alphanumeric characters (0 to 9, A to Z, and a to z), underscores (_), periods (.), and dollar signs ($).

There is no limit to the number of characters.

Specifying null or the null character string is invalid.

arg

Specifies the arguments to be passed to the user function.

If the object cannot be serialized, an error results.

There is no limit to the size of the object.

If no argument is passed, specify null.

recvTimeout

Specifies a data reception timeout value (in milliseconds).

For details about the data that can be specified, see 9.3.3(3)(b) eads.client.connection.receive.timeout.

(d) Return value

This method returns the execution results set by the user function.

(e) Exceptions

  • UserOperationException (illegal user operation)

  • ServerCommunicationException (communication error)

  • InternalServerException (EADS server internal error)

  • InternalClientException (EADS client internal error)

(f) Notes

Do not change the context class loader for the thread that executes executeFunction(). If any context class loader settings are invalid, deserialization of the return value object will fail.