public class DefaultResourceManager extends Object implements ResourceManager
| Modifier and Type | Field and Description |
|---|---|
protected static Map<BranchType,ResourceManager> |
resourceManagers
all resource managers
|
| Modifier and Type | Method and Description |
|---|---|
BranchStatus |
branchCommit(BranchType branchType,
String xid,
long branchId,
String resourceId,
String applicationData) |
Long |
branchRegister(BranchType branchType,
String resourceId,
String clientId,
String xid,
String applicationData,
String lockKeys) |
void |
branchReport(BranchType branchType,
String xid,
long branchId,
BranchStatus status,
String applicationData) |
BranchStatus |
branchRollback(BranchType branchType,
String xid,
long branchId,
String resourceId,
String applicationData) |
static DefaultResourceManager |
get()
Get resource manager.
|
BranchType |
getBranchType() |
Map<String,Resource> |
getManagedResources() |
ResourceManager |
getResourceManager(BranchType branchType)
get ResourceManager by Resource Type
|
protected void |
initResourceManagers() |
boolean |
lockQuery(BranchType branchType,
String resourceId,
String xid,
String lockKeys) |
static void |
mockResourceManager(BranchType branchType,
ResourceManager rm)
only for mock
|
void |
registerResource(Resource resource) |
void |
unregisterResource(Resource resource) |
protected static Map<BranchType,ResourceManager> resourceManagers
public static DefaultResourceManager get()
public static void mockResourceManager(BranchType branchType, ResourceManager rm)
branchType - branchTyperm - resource managerprotected void initResourceManagers()
public BranchStatus branchCommit(BranchType branchType, String xid, long branchId, String resourceId, String applicationData) throws TransactionException
branchCommit in interface ResourceManagerInboundTransactionExceptionpublic BranchStatus branchRollback(BranchType branchType, String xid, long branchId, String resourceId, String applicationData) throws TransactionException
branchRollback in interface ResourceManagerInboundTransactionExceptionpublic Long branchRegister(BranchType branchType, String resourceId, String clientId, String xid, String applicationData, String lockKeys) throws TransactionException
branchRegister in interface ResourceManagerOutboundTransactionExceptionpublic void branchReport(BranchType branchType, String xid, long branchId, BranchStatus status, String applicationData) throws TransactionException
branchReport in interface ResourceManagerOutboundTransactionExceptionpublic boolean lockQuery(BranchType branchType, String resourceId, String xid, String lockKeys) throws TransactionException
lockQuery in interface ResourceManagerOutboundTransactionExceptionpublic void registerResource(Resource resource)
registerResource in interface ResourceManagerpublic void unregisterResource(Resource resource)
unregisterResource in interface ResourceManagerpublic Map<String,Resource> getManagedResources()
getManagedResources in interface ResourceManagerpublic ResourceManager getResourceManager(BranchType branchType)
branchType - branch typepublic BranchType getBranchType()
getBranchType in interface ResourceManagerCopyright © 2023 Seata. All rights reserved.