Skip to content

Commit

Permalink
for checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Aug 14, 2018
1 parent 596f10a commit f19a293
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,17 @@ public final class JDBCXABackendDataSourceFactory implements JDBCBackendDataSour
public DataSource build(final String dataSourceName, final DataSourceParameter dataSourceParameter) throws Exception {
XATransactionManager xaTransactionManager = (XATransactionManager) ShardingTransactionManagerRegistry.getInstance().getShardingTransactionManager(TransactionType.XA);
Class<XADataSource> xaDataSourceClass = loadClass(XA_DRIVER_CLASS_NAME);
XADataSource xaDataSource = xaDataSourceClass.newInstance();
return xaTransactionManager.wrapDataSource(xaDataSource, dataSourceName, dataSourceParameter);
return xaTransactionManager.wrapDataSource(xaDataSourceClass.newInstance(), dataSourceName, dataSourceParameter);
}

private <T> Class<T> loadClass(String className) throws ClassNotFoundException {
Class clazz;

@SuppressWarnings("unchecked")
private <T> Class<T> loadClass(final String className) throws ClassNotFoundException {
Class result;
try {
clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
} catch (ClassNotFoundException e) {
clazz = Class.forName(className);
result = Thread.currentThread().getContextClassLoader().loadClass(className);
} catch (final ClassNotFoundException ignored) {
result = Class.forName(className);
}
return clazz;
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ public DataSource wrapDataSource(final XADataSource xaDataSource, final String d
result.setUniqueResourceName(dataSourceName);
result.setMaxPoolSize(dataSourceParameter.getMaximumPoolSize());
result.setTestQuery("SELECT 1");
Properties properties = getXAProperties(dataSourceParameter);
PropertyUtils.setProperties(xaDataSource, properties);
Properties xaProperties = getXAProperties(dataSourceParameter);
PropertyUtils.setProperties(xaDataSource, xaProperties);
result.setXaDataSource(xaDataSource);
result.setXaProperties(properties);
result.setXaProperties(xaProperties);
return result;
}

Expand Down

0 comments on commit f19a293

Please sign in to comment.