public class GlobalSession extends Object implements SessionLifecycle, SessionStorable
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
GlobalSession.LockCallable<V> |
static interface |
GlobalSession.LockRunnable |
| 构造器和说明 |
|---|
GlobalSession()
Instantiates a new Global session.
|
GlobalSession(String applicationId,
String transactionServiceGroup,
String transactionName,
int timeout)
Instantiates a new Global session.
|
GlobalSession(String applicationId,
String transactionServiceGroup,
String transactionName,
int timeout,
boolean lazyLoadBranch)
Instantiates a new Global session.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(BranchSession branchSession)
Add boolean.
|
void |
addBranch(BranchSession branchSession)
Add branch.
|
void |
addSessionLifecycleListener(SessionLifecycleListener sessionLifecycleListener)
Add session lifecycle listener.
|
void |
asyncCommit() |
void |
begin()
Begin.
|
boolean |
canBeCommittedAsync()
Can be committed async boolean.
|
void |
changeBranchStatus(BranchSession branchSession,
BranchStatus status)
Change branch status.
|
void |
changeGlobalStatus(GlobalStatus status)
Change status.
|
void |
clean() |
void |
close()
Close.
|
void |
closeAndClean()
Close and clean.
|
static GlobalSession |
createGlobalSession(String applicationId,
String txServiceGroup,
String txName,
int timeout)
Create global session global session.
|
void |
decode(byte[] a)
Decode.
|
byte[] |
encode()
Encode byte [ ].
|
void |
end()
end.
|
String |
getApplicationData()
Gets application data.
|
String |
getApplicationId()
Gets application id.
|
long |
getBeginTime()
Gets begin time.
|
BranchSession |
getBranch(long branchId)
Gets branch.
|
List<BranchSession> |
getBranchSessions() |
List<BranchSession> |
getReverseSortedBranches()
Gets reverse sorted branches.
|
List<BranchSession> |
getSortedBranches()
Gets sorted branches.
|
GlobalStatus |
getStatus()
Gets status.
|
int |
getTimeout()
Gets timeout.
|
long |
getTransactionId()
Gets transaction id.
|
String |
getTransactionName()
Gets transaction name.
|
String |
getTransactionServiceGroup()
Gets transaction service group.
|
String |
getXid()
Gets xid.
|
boolean |
hasATBranch()
Has AT branch
|
boolean |
hasBranch()
Has branch boolean.
|
boolean |
isActive()
Is active boolean.
|
boolean |
isDeadSession()
prevent could not handle committing and rollbacking transaction
|
boolean |
isLazyLoadBranch() |
boolean |
isSaga()
Is saga type transaction
|
boolean |
isSuccessEnd() |
boolean |
isTimeout()
Is timeout boolean.
|
void |
loadBranchs() |
void |
lock() |
void |
queueToRetryCommit() |
void |
queueToRetryRollback() |
boolean |
remove(BranchSession branchSession)
Remove boolean.
|
void |
removeBranch(BranchSession branchSession)
Remove branch.
|
void |
removeSessionLifecycleListener(SessionLifecycleListener sessionLifecycleListener)
Remove session lifecycle listener.
|
void |
setActive(boolean active)
Sets active.
|
void |
setApplicationData(String applicationData)
Sets application data.
|
void |
setBeginTime(long beginTime)
Sets begin time.
|
void |
setStatus(GlobalStatus status)
Sets status.
|
void |
setTransactionId(long transactionId)
Sets transaction id.
|
void |
setXid(String xid)
Sets xid.
|
String |
toString() |
void |
unlock() |
public GlobalSession()
public GlobalSession(String applicationId, String transactionServiceGroup, String transactionName, int timeout, boolean lazyLoadBranch)
applicationId - the application idtransactionServiceGroup - the transaction service grouptransactionName - the transaction nametimeout - the timeoutlazyLoadBranch - the lazy load branchpublic GlobalSession(String applicationId, String transactionServiceGroup, String transactionName, int timeout)
applicationId - the application idtransactionServiceGroup - the transaction service grouptransactionName - the transaction nametimeout - the timeoutpublic boolean add(BranchSession branchSession)
branchSession - the branch sessionpublic boolean remove(BranchSession branchSession)
branchSession - the branch sessionpublic boolean canBeCommittedAsync()
public boolean hasATBranch()
public boolean isSaga()
public boolean isTimeout()
public boolean isDeadSession()
public void begin()
throws TransactionException
SessionLifecyclebegin 在接口中 SessionLifecycleTransactionException - the transaction exceptionpublic void changeGlobalStatus(GlobalStatus status) throws TransactionException
SessionLifecyclechangeGlobalStatus 在接口中 SessionLifecyclestatus - the statusTransactionException - the transaction exceptionpublic void changeBranchStatus(BranchSession branchSession, BranchStatus status) throws TransactionException
SessionLifecyclechangeBranchStatus 在接口中 SessionLifecyclebranchSession - the branch sessionstatus - the statusTransactionException - the transaction exceptionpublic boolean isActive()
SessionLifecycleisActive 在接口中 SessionLifecyclepublic void close()
throws TransactionException
SessionLifecycleclose 在接口中 SessionLifecycleTransactionException - the transaction exceptionpublic void end()
throws TransactionException
SessionLifecycleend 在接口中 SessionLifecycleTransactionException - the transaction exceptionpublic boolean isSuccessEnd()
public void clean()
throws TransactionException
public void closeAndClean()
throws TransactionException
TransactionException - the transaction exceptionpublic void addSessionLifecycleListener(SessionLifecycleListener sessionLifecycleListener)
sessionLifecycleListener - the session lifecycle listenerpublic void removeSessionLifecycleListener(SessionLifecycleListener sessionLifecycleListener)
sessionLifecycleListener - the session lifecycle listenerpublic void addBranch(BranchSession branchSession) throws TransactionException
SessionLifecycleaddBranch 在接口中 SessionLifecyclebranchSession - the branch sessionTransactionException - the transaction exceptionpublic void loadBranchs()
public void removeBranch(BranchSession branchSession) throws TransactionException
SessionLifecycleremoveBranch 在接口中 SessionLifecyclebranchSession - the branch sessionTransactionException - the transaction exceptionpublic BranchSession getBranch(long branchId)
branchId - the branch idpublic List<BranchSession> getSortedBranches()
public List<BranchSession> getReverseSortedBranches()
public long getTransactionId()
public void setTransactionId(long transactionId)
transactionId - the transaction idpublic GlobalStatus getStatus()
public void setStatus(GlobalStatus status)
status - the statuspublic String getXid()
public void setXid(String xid)
xid - the xidpublic String getApplicationId()
public String getTransactionServiceGroup()
public String getTransactionName()
public int getTimeout()
public long getBeginTime()
public void setBeginTime(long beginTime)
beginTime - the begin timepublic String getApplicationData()
public void setApplicationData(String applicationData)
applicationData - the application datapublic boolean isLazyLoadBranch()
public static GlobalSession createGlobalSession(String applicationId, String txServiceGroup, String txName, int timeout)
applicationId - the application idtxServiceGroup - the tx service grouptxName - the tx nametimeout - the timeoutpublic void setActive(boolean active)
active - the activepublic byte[] encode()
SessionStorableencode 在接口中 SessionStorablepublic void decode(byte[] a)
SessionStorabledecode 在接口中 SessionStorablea - the srcpublic boolean hasBranch()
public void lock()
throws TransactionException
public void unlock()
public List<BranchSession> getBranchSessions()
public void asyncCommit()
throws TransactionException
public void queueToRetryCommit()
throws TransactionException
public void queueToRetryRollback()
throws TransactionException
Copyright © 2022 Seata. All rights reserved.