Map Exceptions

  Search Here
Searching XAP 6.0 Documentation

                                               

Summary: The two main exceptions thrown for cache problems: EntryVersionConflictException and CacheTimeoutException.

Overview

com.j_spaces.core.client.CacheException is a runtime exception class. This exception is thrown when any kind of cache-related exception occurs. It is mostly used to wrap JavaSpaces exceptions, such as RemoteException or TransactionException. This class extends the RuntimeException, since the IMap implements java.util.Map methods that don't throw exceptions.
The CacheException class wraps the actual exception that caused the error. You may get the cause for the low level exception using the CacheException.getCause() method.

EntryVersionConflictException

Concurrent updates on the same data-instance from multiple cache proxies may create a situation in which several clients attempt to update an old entry version. To avoid such situations, the cache throws a CacheException with EntryVersionConflictException when calling the IMap.put method.

This exception can be retrieved from the generic CacheException in the following manner:

boolean completed = false;
while (!completed) {
       try {
              cache.put("key", value2);
              completed = true;
              System.out.println("updated key OK!");
       } catch (CacheException e) {
       if (e.getCause() instanceof EntryVersionConflictException) {
              System.out.println(e.getCause().getMessage());
                    System.out.println("Reading key again!");
                    value2 = (MyData) cache.get("key");
              }
       }
}

CacheTimeoutException

The CacheTimeoutException extends the CacheException. This exception is thrown when one client is trying to update an Entry which is already blocked by another client, and the wait time has expired. If so, try to call the IMap.put method again. You can also change the default timeout using the IMap.setWaitForResponse() method. The CacheTimeoutException is thrown by: get(), remove(), put() and putAll() operations.


GigaSpaces 6.0 Documentation Contents (Current Page in Bold)

    Java

    C++

    .NET

    Middleware Capabilities

    Configuration and Management

Add GigaSpaces wiki search to your browser search engines!
(works on Firefox 2 and Internet Explorer 7)

Labels

 
(None)