94 WebSphere eXtreme Scale Best Practices for Operation and Management
Example 5-14 Plug in an ObjectGridEventListener
<?xml version="1.0" encoding="UTF-8"?>
<objectGridConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ibm.com/ws/objectgrid/config ../objectGrid.xsd"
xmlns="http://ibm.com/ws/objectgrid/config">
<objectGrids>
<objectGrid name="grid1">
<bean id="ObjectGridEventListener"
className="com.company.org.CustomObjectGridEventListener" />
<backingMap name="map1" ttlEvictorType="NONE" />
</objectgrid>
</objectGrids>
Depending on which events the custom listener must handle, it can implement one or more of
the interfaces that are listed in Table 5-1.
Table 5-1 List of interfaces and their methods
5.4 BackingMap plug-ins
A BackingMap plug-in is a plug-in that affects the behavior of a map. The following plug-ins
are available for a BackingMap:
Evictor: An evictor plug-in is a mechanism that is provided for evicting cache entries.
There are default evictors and an interface for creating custom evictors.
ObjectTransformer: An ObjectTransformer plug-in allows you to serialize, deserialize, and
copy objects in the cache, either alone or in conjunction with the object’s own Serializable
or Externalizable methods.
OptimisticCallback: An OptimisticCallback plug-in allows you to customize versioning and
comparison operations of cache objects when you are using the optimistic lock strategy.
Class name Method to implement Description
com.ibm.websphere.objectgrid.pl
ugins.ObjectGridEventGroup.Sh
ardLifecycle
initialize()
destroy()
ObjectGrid shard
initialization.
ObjectGrid shard destroy.
com.ibm.websphere.objectgrid.pl
ugins.ObjectGridEventGroup.Sh
ardEvents
shardActivated()
shardDeactivated()
Called when the shard
becomes a primary.
Called when the shard
becomes a replica.
com.ibm.websphere.objectgrid.pl
ugins.ObjectGridEventGroup.Tra
nsactionEvents
transactionBegin()
transactionEnd()
Called at the beginning of a
session transaction.
Called at the end of a
transaction.
Note: Implementing the com.ibm.websphere.objectgrid.plugins.ObjectGridEventListener is
the same as implementing the following interfaces:
com.ibm.websphere.objectgrid.plugins.ObjectGridEventGroup.TransactionEvents
com.ibm.websphere.objectgrid.plugins.ObjectGridEventGroup.ShardLifecycle