rcf.core.concurrent.transactions
Interface Transaction

All Superinterfaces:
Event, EventSource, Task
All Known Subinterfaces:
CompositeTransaction<X>
All Known Implementing Classes:
AbstractTransaction, ExternalTransaction

@Revision(value="$Revision: 1.6 $",
          date="$Date: 2006/11/15 22:13:02 $",
          tag="$Name:  $")
public interface Transaction
extends Event, Task

TODO: Javadoc For each transaction there is only one event: its start. At the start event the transaction Task.taskState() will have state Task.State#Constructed. Anyone interested in being notified of the completion of a transaction must register to receive TaskEvents from the transaction.

This is especially true of a transaction which is caused by another transaction. Typically there will be an EventSink which accepts the TaskEvents from the causing transactions, and commits or aborts the caused transaction accordingly.

TODO: Unit tests, Code review, Javadoc review, Seal/Finalize

Version:
$Revision: 1.6 $
Author:
Greg Gibeling

Nested Class Summary
static interface Transaction.Internal<X extends Transaction>
          TODO: Javadoc TODO: Document the way rcf.core.util.filter.FilterEvent works! TODO: Transaction Composite Trees
 
Nested classes/interfaces inherited from interface rcf.core.concurrent.schedule.Task
Task.State
 
Method Summary
 boolean abort()
          TODO: Javadoc
 boolean commit()
          TODO: Javadoc
 boolean isCancelled()
          TODO: Javadoc
 boolean isLocked()
          TODO: Javadoc TODO: Transactional Locking
 boolean lock()
          TODO: Javadoc TODO: Transactional Locking
 Transactional<? extends Transaction> source()
          Get the EventSource this event was generated from.
 
Methods inherited from interface rcf.core.concurrent.events.Event
getEventSequenceNumber
 
Methods inherited from interface rcf.core.concurrent.schedule.Task
taskState
 
Methods inherited from interface rcf.core.concurrent.events.EventSource
events, getSequenceNumber, incSequenceNumber, isSyndicated, syndicate
 

Method Detail

abort

boolean abort()
TODO: Javadoc

Returns:
true indicates success. false indicates the transaction couldn't be aborted, or already was. if ((state == State.Committed) || (state == State.Interrupted)) throw new TaskStateException("Cannnot abort a transaction in state \"" + temp + "\"!");

commit

boolean commit()
TODO: Javadoc

Returns:
true indicates success. false indicates the transaction couldn't be committed, or already was. if ((state == State.Aborted) || (state == State.Interrupted)) throw new TaskStateException("Cannnot commit a transaction in state \"" + temp + "\"!");

isCancelled

boolean isCancelled()
TODO: Javadoc

Specified by:
isCancelled in interface Event
Returns:
true if the transaction has been aborted or interrupted. (taskState().terminal == Task.State.Aborted) || (taskState().terminal == Task.State.Interrupted)
See Also:
Event.isCancelled()

isLocked

boolean isLocked()
TODO: Javadoc TODO: Transactional Locking

Returns:

lock

boolean lock()
TODO: Javadoc TODO: Transactional Locking

Returns:
true if the lock was acquired for this thread. false if it was already held.

source

Transactional<? extends Transaction> source()
Description copied from interface: Event
Get the EventSource this event was generated from.

Specified by:
source in interface Event
Returns:
The EventSource this event was generated from.