IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.plugins
Interface ObjectGridEventListener

All Superinterfaces:
EventListener
All Known Implementing Classes:
JMSObjectGridEventListener, JPATxCallback, TranPropListener

public interface ObjectGridEventListener
extends EventListener

This interface is used to create an implementation of an event listener for an ObjectGrid. Instances of ObjectGridEventListeners are set on the ObjectGrid interface. Any significant events are communicated to the application using the methods outlined below. When using Java 5, this callback also supports new callback annotation mechanism.

Since:
WAS XD 6.0, XC10
See Also:
ObjectGrid.addEventListener(EventListener), ObjectGrid.removeEventListener(EventListener), EventListener

Method Summary
 void destroy()
          Called when the ObjectGrid associated with this listener is destroyed.
 void initialize(Session session)
          Invoked when an ObjectGrid is initialized.
 void transactionBegin(String txid, boolean isWriteThroughEnabled)
          Signals the beginning of a Session transaction.
 void transactionEnd(String txid, boolean isWriteThroughEnabled, boolean committed, Collection changes)
          Signals the ending of a Session transaction.
 

Method Detail

initialize

void initialize(Session session)
Invoked when an ObjectGrid is initialized.

A usable Session instance is passed to this listener to provide all of the necessary access to the various ObjectGrid objects.

Parameters:
session - a Session instance that this listener is associated with.
See Also:
ObjectGrid.initialize()

transactionBegin

void transactionBegin(String txid,
                      boolean isWriteThroughEnabled)
Signals the beginning of a Session transaction.

A stringified version of the TxID is provided for correlating with the end of the transaction, if so desired. The type of transaction is also provided by the isWriteThroughEnabled boolean parameter.

Parameters:
txid - Stringified version of the TxID
isWriteThroughEnabled - boolean flag indicating whether the Session transaction was started using the Session.beginNoWriteThrough(). method. false is passed if beginNoWriteThrough() was used.
See Also:
Session.begin(), Session.beginNoWriteThrough()

transactionEnd

void transactionEnd(String txid,
                    boolean isWriteThroughEnabled,
                    boolean committed,
                    Collection changes)

Signals the ending of a Session transaction.

A string version of the TxID is provided for correlating with the begin of the transaction, if so desired. Map changes are also reported with the collection of LogSequences passed to this method. Typical uses of this event are for customers doing custom peer invalidation or peer commit push. This event listener gives them the changes. Calls to this method are made after commit and are sequenced so that they are delivered one by one, not in parallel. The event order is the commit and rollback order.

For an ObjectGridEventListener receiving changes in an ObjectMap that is configured to use a OutputFormat.RAW for the keys or values, the keys and values objects in the LogSequences will be SerializedKey or SerializedValue objects respectively. If required, you can use the SerializedEntry.getObject() method to retrieve (possibly inflating the serialized object) the original key or value object.

To override the map's output format configuration, use the PluginOutputFormat annotation in the implementation class.

Parameters:
txid - string version of the TxID
isWriteThroughEnabled - boolean flag indicating whether the Session transaction was started using the Session.beginNoWriteThrough(). method. false is passed if beginNoWriteThrough() was used.
committed - a boolean flag indicating whether the transaction was committed (true) or rolled back (false)
changes - a Collection of LogSequences representing the changes that were committed or rolled back.
See Also:
LogSequence.isRollback(), Session.begin(), Session.beginNoWriteThrough(), Session.commit(), Session.rollback()

destroy

void destroy()

Called when the ObjectGrid associated with this listener is destroyed.

This method is the opposite of the initialize method. When it is called, the listener can free up any resources it uses.

See Also:
ObjectGrid.destroy()

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.