Download GemBuilder for Smalltalk User`s Guide

Transcript
Managing Transactions
Operating Inside a Transaction
In order to commit, the session must be operating within a transaction. An attempt
to commit while outside a transaction raises an exception.
Aborting a Transaction
A session refreshes its view of the shared object repository by aborting its
transaction. Despite the terminology, a session need not be operating inside a
transaction in order to abort. To abort, send the message:
aGbsSession abortTransaction
(to abort a specific session)
GBSM abortTransaction
(to abort the current session)
or:
or, in the Session Browser, select a logged-in session and click on the Abort...
button; or in the Class Browser, use the pop up menu on the SymbolDictionary
pane to select abort.
Aborting has these effects:
• The transaction (if any) ends. If the session’s transaction mode is automatic,
GemBuilder starts a new transaction. If the session’s transaction mode is
manual, the session is left outside of a transaction.
• Temporary Smalltalk objects remain unchanged.
• The session’s private view of the GemStone shared object repository is
updated to match the current state of the repository.
Avoiding or Handling Commit Failures
You can use the GemBuilder method GbsSession >> hasConflicts to determine
if any concurrency conflicts exist that would cause a subsequent commit operation
to fail. It returns false if it finds no conflicts with other concurrent transactions,
true otherwise. You can then determine how best to proceed.
If an attempt to commit fails because of a concurrency conflict, the
commitTransaction method returns false.
Following a commit failure, the client’s view of persistent objects may differ from
their precommit state:
• The current transaction is still in effect. However, you must end the transaction
and start a new one before you can successfully commit.
• Temporary Smalltalk objects remain unchanged.
March 2006
GemStone Systems, Inc.
7-5