Java Code Examples for io.seata.common.util.StringUtils
The following examples show how to use
io.seata.common.util.StringUtils. These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: seata-samples Source File: DubboTccTransactionStarter.java License: Apache License 2.0 | 5 votes |
private static void transactionCommitDemo() throws InterruptedException { String txId = tccTransactionService.doTransactionCommit(); System.out.println(txId); Assert.isTrue(StringUtils.isNotBlank(txId), "事务开启失败"); System.out.println("transaction commit demo finish."); }
Example 2
Source Project: seata-samples Source File: SpringbootTccTransactionApplication.java License: Apache License 2.0 | 5 votes |
private static void transactionCommitDemo() throws InterruptedException { String txId = tccTransactionService.doTransactionCommit(); System.out.println(txId); Assert.isTrue(StringUtils.isNotBlank(txId), "事务开启失败"); System.out.println("transaction commit demo finish."); }
Example 3
Source Project: seata-samples Source File: LocalTccTransactionStarter.java License: Apache License 2.0 | 5 votes |
private static void transactionCommitDemo() throws InterruptedException { String txId = tccTransactionService.doTransactionCommit(); System.out.println(txId); Assert.isTrue(StringUtils.isNotBlank(txId), "事务开启失败"); Thread.sleep(1000L); Assert.isTrue("T".equals(ResultHolder.getActionOneResult(txId)), "tccActionOne commit failed"); Assert.isTrue("T".equals(ResultHolder.getActionTwoResult(txId)), "tccActionTwo commit failed"); System.out.println("transaction commit demo finish."); }
Example 4
Source Project: seata-samples Source File: SofaRPCTccTransactionApplication.java License: Apache License 2.0 | 5 votes |
private static void transactionCommitDemo() throws InterruptedException { String txId = tccTransactionService.doTransactionCommit(); System.out.println(txId); Assert.isTrue(StringUtils.isNotBlank(txId), "事务开启失败"); System.out.println("transaction commit demo finish."); }
Example 5
Source Project: EasyTransaction Source File: EtDataSourceManager.java License: Apache License 2.0 | 5 votes |
@Override public Long branchRegister(BranchType branchType, String resourceId, String clientId, String xid, String applicationData, String lockKey) throws TransactionException { // public Long branchRegister(BranchType branchType, String resourceId, String clientId, String xid, String lockKey) throws TransactionException { Integer callSeq = MetaDataFilter.getMetaData(EasytransConstant.CallHeadKeys.CALL_SEQ); // check locks if (StringUtils.isNullOrEmpty(lockKey)) { return callSeq== null?-1:callSeq.longValue(); } //ET要求使用Spring管控下的事务,因此本方法可以获得对应的当前连接,获取当前连接来执行时为了避免争夺连接词的连接导致死锁 DataSourceProxy dataSourceProxy = get(resourceId); ConnectionProxy cp = (ConnectionProxy) DataSourceUtils.getConnection(dataSourceProxy); Connection targetConnection = cp.getTargetConnection(); if (callSeq != null) { // callSeq != null means it's in ET transaction control try { doLockKeys(xid, lockKey, targetConnection); } catch (SQLException e) { throw new RuntimeException("Obtain Lock failed, Rollback transaction:" + lockKey, e); } } else { // callSeq == null means it's just a local transaction or a master transaction in ET // it need to check lock if(!lockQuery(branchType, resourceId, xid, lockKey)) { throw new RuntimeException("Obtain Lock failed, Rollback transaction:" + lockKey); } // not need to save undolog ,undo will be handle by local transaction, just hack to clean undo log cp.getContext().getUndoItems().clear(); } return callSeq== null?-1:callSeq.longValue(); }
Example 6
Source Project: jboot Source File: SeataGlobalTransactionManager.java License: Apache License 2.0 | 5 votes |
private void initClient() { if (LOGGER.isInfoEnabled()) { LOGGER.info("Initializing Global Transaction Clients ... "); } if (StringUtils.isNullOrEmpty(applicationId) || StringUtils.isNullOrEmpty(txServiceGroup)) { throw new IllegalArgumentException( "applicationId: " + applicationId + ", txServiceGroup: " + txServiceGroup); } //init TM TMClient.init(applicationId, txServiceGroup); if (LOGGER.isInfoEnabled()) { LOGGER.info( "Transaction Manager Client is initialized. applicationId[" + applicationId + "] txServiceGroup[" + txServiceGroup + "]"); } //init RM RMClient.init(applicationId, txServiceGroup); if (LOGGER.isInfoEnabled()) { LOGGER.info("Resource Manager is initialized. applicationId[" + applicationId + "] txServiceGroup[" + txServiceGroup + "]"); } if (LOGGER.isInfoEnabled()) { LOGGER.info("Global Transaction Clients are initialized. "); } registerSpringShutdownHook(); }