Using transactions to manipulate rows
In a monitor, any changes you make to Row events are local until you commit those changes. In other words, any changes you make actually modify the Row events that represent the in-memory rows. After you commit the changes you have made to your Row events, the updated in-memory rows are available to all monitors in the correlator and to all other members of the distributed cluster if you are using a distributed store.
Note: When you modify a Row event and you want to update the actual row with your changes, you must commit your changes. It does not matter whether or not the table is in a correlator-persistent store.
The Row event defines the following actions for committing changes:
Row.commit() —Tries to commit changes to
Row events to the in-memory table. If nothing else modified the in-memory row in the table since you obtained the
Row event that represents that row the MemoryStore commits the changes and returns. The update is available to all monitors. If the in-memory row in the table has been modified, the monitor instance that called this action dies, leaving the in-memory table unchanged.
Row.tryCommit() — Behaves like
commit() except that it does not kill the monitor instance upon failure. If the in-memory row in the table has been modified, this action returns false and leaves the in-memory table unchanged. If this action is successful, it returns true.
Row.tryCommitOrUpdate() — Behaves like
tryCommit() except that when it returns false it also updates your local
Row event to reflect the current state of the in-memory row. In other words, if the in-memory row has been modified, this action does the following:
Leaves the in-memory row unchanged.
Updates the local
Row event that represents this row to reflect the current state of the table. Any local, uncommitted modifications are lost.
Returns false.
Copyright © 2013
Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, and/or Terracotta Inc., San Francisco, CA, USA, and/or Software AG (Canada) Inc., Cambridge, Ontario, Canada, and/or, Software AG (UK) Ltd., Derby, United Kingdom, and/or Software A.G. (Israel) Ltd., Or-Yehuda, Israel and/or their licensors.