}
if ( _tmName != null ) {
InitialContext ctx;
Transaction tx;
DatabaseImpl dbImpl;
try {
if(tm == null) {
ctx = new InitialContext();
tm = (TransactionManager) ctx.lookup( _tmName );
}
tx = tm.getTransaction();
if ( _txDbPool != null && _txDbPool.containsTx( tx ) )
return _txDbPool.get( tx );
if ( tx != null && tx.getStatus() == Status.STATUS_ACTIVE ) {
dbImpl = new DatabaseImpl( _dbName, _lockTimeout, _logInterceptor,
_callback, _instanceFactory, tx, _classLoader, _autoStore );
if ( _txDbPool != null )
_txDbPool.put( tx, dbImpl );
tx.registerSynchronization( dbImpl );
return dbImpl;
}
} catch ( NoInitialContextException except ) {
// No initial context. Just ignore.
} catch ( NameNotFoundException except ) {
// No TransactionManager object. Just ignore.
} catch ( Exception except ) {
// NamingException, SystemException, RollbackException
if ( _logInterceptor != null )
_logInterceptor.exception( except );
}
}
return new DatabaseImpl( _dbName, _lockTimeout, _logInterceptor,
_callback, _instanceFactory, null, _classLoader, _autoStore );
}