You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/11/22 05:10:09 UTC

[GitHub] [shardingsphere] lwclover opened a new issue #13730: JDBCBackendDataSource.createConnection may occurs NullPointException when changing datasource metadata

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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] menghaoranss closed issue #13730: JDBCBackendDataSource.createConnection occurs NullPointException when changing datasource metadata

Posted by GitBox <gi...@apache.org>.
menghaoranss closed issue #13730:
URL: https://github.com/apache/shardingsphere/issues/13730


   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org