private Connection getConnection ( ) { final JdbcTransaction jdbcTransaction = TX . get ( ) ; if ( null != jdbcTransaction && jdbcTransaction . isActive ( ) ) { return jdbcTransaction . getConnection ( ) ; } Connection ret = CONN . get ( ) ; try { if ( null != ret && ! ret . isClosed ( ) ) { return ret ; } ret = Connections . getConnection ( ) ; } catch ( final SQLException e ) { LOGGER . log ( Level . ERROR , "Gets a connection failed" , e ) ; } CONN . set ( ret ) ; return ret ; }
getConnection . default using current JdbcTransaction s connection if null get a new one .