style: format
This commit is contained in:
parent
bff1793697
commit
4b04ea2585
@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.baomidou.dynamic.datasource.annotation;
|
||||
|
||||
|
||||
|
||||
import com.baomidou.dynamic.datasource.tx.DsPropagation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
@ -26,7 +26,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
public enum XADataSourceEnum {
|
||||
ORACLE(DbType.ORACLE,"oracle.jdbc.xa.client.OracleXADataSource"),
|
||||
ORACLE(DbType.ORACLE, "oracle.jdbc.xa.client.OracleXADataSource"),
|
||||
MYSQL(DbType.MYSQL, "com.mysql.cj.jdbc.MysqlXADataSource"),
|
||||
POSTGRE_SQL(DbType.POSTGRE_SQL, "org.postgresql.xa.PGXADataSource"),
|
||||
H2(DbType.H2, "org.h2.jdbcx.JdbcDataSource"),
|
||||
@ -40,7 +40,7 @@ public enum XADataSourceEnum {
|
||||
this.xaDataSourceClassName = xaDataSourceClassName;
|
||||
}
|
||||
|
||||
public static boolean contains(DbType dbType){
|
||||
public static boolean contains(DbType dbType) {
|
||||
for (XADataSourceEnum item : values()) {
|
||||
if (item.getDbType() == dbType) {
|
||||
return true;
|
||||
@ -49,7 +49,7 @@ public enum XADataSourceEnum {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getByDbType(DbType dbType){
|
||||
public static String getByDbType(DbType dbType) {
|
||||
for (XADataSourceEnum item : values()) {
|
||||
if (item.getDbType() == dbType) {
|
||||
return item.getXaDataSourceClassName();
|
||||
|
@ -37,7 +37,7 @@ public class AtomikosTransactionFactory extends SpringManagedTransactionFactory
|
||||
|
||||
// e.g:ConnectionHolder conHolder = (ConnectionHolder) TransactionSynchronizationManager.getResource(dataSource);
|
||||
if (dataSource instanceof DynamicRoutingDataSource) {
|
||||
determineDataSource = ((DynamicRoutingDataSource)dataSource).determineDataSource();
|
||||
determineDataSource = ((DynamicRoutingDataSource) dataSource).determineDataSource();
|
||||
}
|
||||
return new SpringManagedTransaction(determineDataSource);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ public class ConnectionFactory {
|
||||
}
|
||||
|
||||
}
|
||||
savePointMap.put(xid,savePointHolders);
|
||||
savePointMap.put(xid, savePointHolders);
|
||||
} catch (SQLException ex) {
|
||||
throw new CannotCreateTransactionException("Could not create JDBC savepoint", ex);
|
||||
}
|
||||
|
@ -335,8 +335,12 @@ public class ConnectionProxy implements Connection {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {return true;}
|
||||
if (!(o instanceof ConnectionProxy)) {return false;}
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ConnectionProxy)) {
|
||||
return false;
|
||||
}
|
||||
ConnectionProxy that = (ConnectionProxy) o;
|
||||
return Objects.equals(connection, that.connection) && Objects.equals(ds, that.ds);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public final class LocalTxUtil {
|
||||
try {
|
||||
ConnectionFactory.notify(xid, true);
|
||||
} finally {
|
||||
if (!hasSavepoint){
|
||||
if (!hasSavepoint) {
|
||||
log.debug("dynamic-datasource commit local tx [{}]", TransactionContext.getXID());
|
||||
TransactionContext.remove();
|
||||
}
|
||||
@ -67,7 +67,7 @@ public final class LocalTxUtil {
|
||||
try {
|
||||
ConnectionFactory.notify(xid, false);
|
||||
} finally {
|
||||
if (!hasSavepoint){
|
||||
if (!hasSavepoint) {
|
||||
log.debug("dynamic-datasource commit local tx [{}]", TransactionContext.getXID());
|
||||
TransactionContext.remove();
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class TransactionalTemplate {
|
||||
private Object doExecute(TransactionalExecutor transactionalExecutor) throws Throwable {
|
||||
TransactionalInfo transactionInfo = transactionalExecutor.getTransactionInfo();
|
||||
DsPropagation propagation = transactionInfo.propagation;
|
||||
if (!StringUtils.isEmpty(TransactionContext.getXID())&&!propagation.equals(DsPropagation.NESTED)) {
|
||||
if (!StringUtils.isEmpty(TransactionContext.getXID()) && !propagation.equals(DsPropagation.NESTED)) {
|
||||
return transactionalExecutor.execute();
|
||||
}
|
||||
boolean state = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user