lwclover opened a new issue #13730:
URL: https://github.com/apache/shardingsphere/issues/13730
Before report a bug, make sure you have:
NullPointException occurs when changing datasource metadata and executing
sql at sametime.
```
private Connection createConnection(final String schemaName, final
String dataSourceName, final DataSource dataSource, final TransactionType
transactionType) throws SQLException {
ShardingSphereTransactionManager transactionManager
=
ProxyContext.getInstance().getContextManager().getTransactionContexts().getEngines().get(schemaName).getTransactionManager(transactionType);
return isInTransaction(transactionManager) ?
transactionManager.getConnection(dataSourceName) : dataSource.getConnection();
}
```
```
private void renewTransactionContext(final String schemaName, final
ShardingSphereResource resource) {
closeTransactionEngine(schemaName);
transactionContexts.getEngines().put(schemaName,
createNewEngine(resource.getDatabaseType(), resource.getDataSources()));
}
private void closeTransactionEngine(final String schemaName) {
ShardingSphereTransactionManagerEngine staleEngine =
transactionContexts.getEngines().remove(schemaName);
if (null != staleEngine) {
try {
staleEngine.close();
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
log.error("Close transaction engine failed", ex);
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]