Interface for classes representing transactions supported by the space.
Declaration Syntax
C# | Visual Basic | Visual C++ | J# |
public interface ITransaction : IDisposable
Public Interface ITransaction _ Implements IDisposable
public interface class ITransaction : IDisposable
public interface ITransaction extends IDisposable
Members
All Members | Methods | Properties | |||
Icon | Member | Description |
---|---|---|
Abort()()() |
Abort the transaction.
| |
Abort(Int64) |
Abort the transaction, waiting for participants to be notified of the decision.
| |
Commit()()() |
Commits the transaction.
| |
Commit(Int64) |
Commits the transaction, waiting for participants to be notified of the decision.
| |
Dispose()()() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.) | |
Lease |
Gets the transaction lease time.
| |
Manager |
Gets the transaction manager which created this transaction.
| |
SetAbortOnly()()() |
Sets the transaction state to abort only, as a result a Commit()()() operation will result in an Abort()()() operation.
|
Examples
Transaction usage is divided to 3 steps: creating the transaction, using the transaction
to perform operations, and finally committing/aborting the work being done.
CopyC#
// Find the default embedded space: ISpaceProxy proxy = GigaSpacesFactory.FindSpace("/./MySpace"); // Create an automatically disposed transaction scope: using (ITransaction tx = proxy.CreateLocalTransaction()) { try { // Read a person - use the transaction to lock it: Person p = proxy.Take<Person>(new Person(), tx); // Update the person's name: p.Name = p.Name + " (updated in a transaction)"; // Update the person in space: proxy.Write<Person>(p, tx); // Commit the transaction: tx.Commit(); } catch { // In case of an exception, abort the transaction: tx.Abort(); throw; } }