|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.objectwave.transactionalSupport.Session
A utility class to allow multiple threads share a single transaction context. All synchronization issues must explictly be handled by the developer. An easy way to use sessions is to use the static Session.createAndJoin(String name) method.
createAndJoin(String)
Nested Class Summary | |
static class |
Session.Test
Unit Tests |
Field Summary | |
static int |
PARALLEL_IGNORE_SIBLINGS
If one child session is rolled back, the other children will still commit. |
static int |
PARALLEL_ROLLBACK_SIBLINGS
If one child session is rolled back, all will be set to rollback only and will not commit. |
Constructor Summary | |
protected |
Session()
Session is not necessarily created via the constructor. |
|
Session(java.lang.String name)
Session can have names. |
Method Summary | |
void |
addChildSession(Session s)
Adds a child session explicitly to this session. |
void |
commit()
Commit any changes made during this transaction. |
static Session |
createAndJoin(java.lang.String name)
A convience method for creating and joining a session in one step. |
static Session |
createParallelChild(Session parentSession)
This will create a parallel child with a name that is constructed from the parent name. |
static Session |
createParallelChild(java.lang.String name,
Session parentSession)
Creates a child session for a parallel master with the given name and master session. |
static Session |
createParallelMaster(java.lang.String name)
This has been added simply for the uniformity of the API. |
static Session |
createParallelMaster(java.lang.String name,
int parallelPolicy)
Creates a ParallelMaster session with the given name and the given parallelRollbackPolicy. |
int |
getChildSessionCount()
Returns the number of child sessions currently associated to this session. |
TransactionLog |
getCurrentTransaction()
It is probably better to use the commit(), rollback(), and startTransaction(String) methods rather than manually manipulating the transaction. |
java.lang.String |
getName()
All of the threads in the current session. |
java.lang.Object |
getWrap()
|
void |
join()
Have the current thread join this session. |
void |
leave()
Have the current thread leave a session. |
void |
removeChildSession(Session s)
Removes a child session from this parent session. |
void |
rollback()
Undo any changes that this transaction has made to the TransactionalObjects. |
void |
setChildRolledBack(Session childSession)
This method notifies a parent session that a child has rolled back. |
protected void |
setCurrentTransaction(TransactionLog log)
Only the transactionalSupport.TransactionLog should use this method. |
void |
setParentSession(Session parentSession)
Sets the parent session of a session and adds the child to the parent in one step. |
void |
setRollbackOnly()
Set a flag to cause this to be rollback only. |
void |
setWrap(java.lang.Object newValue)
|
void |
startTransaction(java.lang.String transactionType)
Start a root or subtransaction. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int PARALLEL_IGNORE_SIBLINGS
public static final int PARALLEL_ROLLBACK_SIBLINGS
Constructor Detail |
public Session(java.lang.String name)
name
- createAndJoin(String)
protected Session()
createAndJoin(String)
Method Detail |
public static Session createAndJoin(java.lang.String name)
name
- java.lang.String
public static Session createParallelMaster(java.lang.String name, int parallelPolicy)
name
- parallelPolicy
-
public static Session createParallelMaster(java.lang.String name)
name
- The name of the session to create
createAndJoin(String)
public static Session createParallelChild(Session parentSession)
parentSession
-
createParallelChild(String, Session)
public static Session createParallelChild(java.lang.String name, Session parentSession)
name
- parentSession
-
public void setParentSession(Session parentSession)
parentSession
- The parent session of the current session#parentSession
,
addChildSession(Session)
public void setChildRolledBack(Session childSession)
childSession
- The new ChildRolledBack valueparallelRollbackPolicy
,
setRollbackOnly()
public void setRollbackOnly()
public void setWrap(java.lang.Object newValue)
newValue
- java.lang.Objectprotected void setCurrentTransaction(TransactionLog log)
log
- The new CurrentTransaction valuepublic int getChildSessionCount()
public TransactionLog getCurrentTransaction()
public java.lang.String getName()
public java.lang.Object getWrap()
public void addChildSession(Session s)
s
- The child session to be added to this parentpublic void removeChildSession(Session s)
s
- The child session to remove.public void commit() throws UpdateException
UpdateException
public void join()
public void leave()
public void rollback()
public void startTransaction(java.lang.String transactionType)
transactionType
- public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |