WebSphere eXtreme Scale Administration Guide > Configure WebSphere eXtreme Scale > WebSphere eXtreme Scale client configuration



Configure the request retry timeout


With reliable maps, you can supply a retry timeout to WebSphere eXtreme Scale for transaction requests.

There are two ways to configure reliable maps. If the value is set to greater than zero, the request is tried until either the timeout condition is met or a permanent failure such as a DuplicateKeyException exception is encountered. A value of zero indicates the fail-fast mode setting and eXtreme Scale does not attempt to retry.

You supply a timeout value in milliseconds on the client properties file or on a session. The session always overrides the client properties setting. During run time, the transaction timeout is used with the retry timeout, ensuring the retry timeout does not exceed the transaction timeout.

Due to variations in how autocommit and non-autocommit transactions (transactions that are using explicit begin and commit methods) are completed, valid exceptions for retry are different.

For transactions that are called within a session, the retry is valid for CORBA SystemExceptions and eXtreme Scale TargetNotAvailable exceptions.

For autocommit transactions, the retry is valid for CORBA SystemExceptions eXtreme Scale Availability Exceptions (ReplicationVotedToRollbackTransactionException, TargetNotAvailable, AvailabilityException, and others).

See Use sessions to access data in the grid for more information on autocommit transactions.

Application or other permanent failures return immediately and the client does not retry the transaction. These permanent failures include the DuplicateKeyException and KeyNotFoundException exceptions.

The fail-fast setting returns all exceptions without retrying for any exceptions.

The following lists show the exceptions in more detail:


Exceptions where the client retries


Other Exceptions


Set the requestRetryTimeout property in a client property file

To set the requestRetryTimeout value on a client, add or modify the requestRetryTimeout property in the Client properties file. The client properties is the objectGridClient.properties file by default. The requestRetryTimeout property is set in milliseconds. Set the value greater than zero for the request to be retried on exceptions for which retry is available. Set the value to 0 to fail without retries on exceptions.

To use the default behavior, remove the property or set the value to -1.

objectGridClient.properties

# eXtreme Scale client config
preferLocalProcess = false
preferLocalhost = false
requestRetryTimeout = 30000

The requestRetryTimeout value is specified in milliseconds. In the previous example, if the value is used on an ObjectGrid instance, the requestRetryTimeout value is 30 seconds.


Set client properties by obtaining an ObjectGrid connection programmatically

To set the client properties programmatically, first create a client properties file in an appropriate <location> for your application. In the following example, the client properties file refers to the objectGridClient.properties snippet in the previous section. After you establish a connection with the ObjectGridManager, set the client properties as described. Then, when you have an ObjectGrid instance, it will have the client properties you defined in the file. If you change the client properties file, explicitly get a new ObjectGrid instance each time.

ObjectGridManager manager = ObjectGridManagerFactory.getObjectGridManager();
String objectGridName = “testObjectGrid”;
URL clientXML = null;
ClientClusterContext ccc = manager.connect("localhost:2809", null, clientXML);
File file = new File("<location>/objectGridClient.properties");
URL url = file.toURI().toURL();
ccc.setClientProperties(objectGridName, url);
ObjectGrid objectGrid = ogManager.getObjectGrid(ccc, objectGridName);


Session override example with autocommit

To set the request retry timeout on a session or to override the requestRetryTimeout client property, call the setRequestRetryTimeout(long) method on the Session interface.

Session sessionA = objectGrid.getSession();
sessionA.setRequestRetryTimeout(30000);
ObjectMap mapA = sessionA.getMap("payroll");
String key = "key:" + j;
mapA.insert(key, "valueA");

This session now uses a requestRetryTimeout value of 30000 milliseconds or 30 seconds, regardless of the value that is set in the client properties file. For more information on the session interface, see Use Sessions to access data in the grid.



Parent topic

WebSphere eXtreme Scale client configuration


+

Search Tips   |   Advanced Search