A JavaMap instance is obtained from an ObjectMap object. The JavaMap interface has the same method signatures as ObjectMap, but with different exception handling. JavaMap extends the java.util.Map interface, so all exceptions are instances of the java.lang.RuntimeException class. Because JavaMap extends the java.util.Map interface, it is easy to quickly use WebSphere® eXtreme Scale with an existing application that uses a java.util.Map interface for object caching.
Obtain a JavaMap instance
An application gets a JavaMap instance from an ObjectMap object using the
ObjectMap.getJavaMap method. The following code snippet demonstrates how to obtain a JavaMap instance.
ObjectGrid objectGrid = ...;
BackingMap backingMap = objectGrid.defineMap("mapA");
Session sess = objectGrid.getSession();
ObjectMap objectMap = sess.getMap("mapA");
java.util.Map map = objectMap.getJavaMap();
JavaMap javaMap = (JavaMap) javaMap;
A JavaMap is backed by the ObjectMap from which it was obtained. Calling the
getJavaMap method multiple times using a particular ObjectMap always returns the same JavaMap instance.
Methods
The JavaMap interface only supports a subset of the methods on the java.util.Map interface. The java.util.Map interface supports the following methods:
- containsKey(java.lang.Object) method
- get(java.lang.Object) method
- put(java.lang.Object, java.lang.Object) method
- putAll(java.util.Map) method
- remove(java.lang.Object) method
- clear()
All other methods inherited from the
java.util.Map interface result in a java.lang.UnsupportedOperationException exception.
New! Subscribe to Information Center updates
![rss feed](images/feed_cue.png)
You can now subscribe to updates for the WebSphere eXtreme
Scale Information Center. This feed includes a description of the changes that occur in the monthly refreshes. Use the
RSS feed to subscribe to changes using your favorite feed reader.