HHH-5615 Converted logging framework from slf4j to jboss logging for a few class that fell through the cracks
This commit is contained in:
parent
4b130da83e
commit
97a310d26d
|
@ -1260,7 +1260,7 @@ public interface HibernateLogger extends BasicLogger {
|
|||
void unableToCloseInitialContext( String string );
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "Error closing imput files: %s", id = 286 )
|
||||
@Message( value = "Error closing input files: %s", id = 286 )
|
||||
void unableToCloseInputFiles( String name,
|
||||
@Cause IOException e );
|
||||
|
||||
|
@ -1814,4 +1814,44 @@ public interface HibernateLogger extends BasicLogger {
|
|||
String valueOf,
|
||||
String name2,
|
||||
String valueOf2 );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Closing un-released batch", id = 420 )
|
||||
void closingUnreleasedBatch();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Disabling contextual LOB creation as %s is true", id = 421 )
|
||||
void disablingContextualLOBCreation( String nonContextualLobCreation );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Disabling contextual LOB creation as connection was null", id = 422 )
|
||||
void disablingContextualLOBCreationSinceConnectionNull();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Disabling contextual LOB creation as JDBC driver reported JDBC version [%s] less than 4", id = 423 )
|
||||
void disablingContextualLOBCreationSinceOldJdbcVersion( int jdbcMajorVersion );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Disabling contextual LOB creation as createClob() method threw error : %s", id = 424 )
|
||||
void disablingContextualLOBCreationSinceCreateClobFailed( Throwable t );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Could not close session; swallowing exception as transaction completed", id = 425 )
|
||||
void unableToCloseSessionButSwallowingError( HibernateException e );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "You should set hibernate.transaction.manager_lookup_class if cache is enabled", id = 426 )
|
||||
void setManagerLookupClass();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Using deprecated %s strategy [%s], use newer %s strategy instead [%s]", id = 427 )
|
||||
void deprecatedTransactionManagerStrategy( String name,
|
||||
String transactionManagerStrategy,
|
||||
String name2,
|
||||
String jtaPlatform );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Encountered legacy TransactionManagerLookup specified; convert to newer %s contract specified via %s setting", id = 428 )
|
||||
void legacyTransactionManagerStrategy( String name,
|
||||
String jtaPlatform );
|
||||
}
|
||||
|
|
|
@ -23,7 +23,13 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.internal;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.jdbc.batch.spi.Batch;
|
||||
import org.hibernate.engine.jdbc.batch.spi.BatchBuilder;
|
||||
|
@ -38,14 +44,7 @@ import org.hibernate.engine.transaction.spi.TransactionCoordinator;
|
|||
import org.hibernate.engine.transaction.spi.TransactionEnvironment;
|
||||
import org.hibernate.jdbc.ReturningWork;
|
||||
import org.hibernate.jdbc.Work;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Standard Hibernate implementation of {@link JdbcCoordinator}
|
||||
|
@ -55,7 +54,8 @@ import java.sql.SQLException;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
||||
private static final Logger log = LoggerFactory.getLogger( JdbcCoordinatorImpl.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JdbcCoordinatorImpl.class.getName());
|
||||
|
||||
private transient TransactionCoordinatorImpl transactionCoordinator;
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
|||
@Override
|
||||
public Connection close() {
|
||||
if ( currentBatch != null ) {
|
||||
log.warn( "Closing un-released batch" );
|
||||
LOG.closingUnreleasedBatch();
|
||||
currentBatch.release();
|
||||
}
|
||||
return logicalConnection.close();
|
||||
|
@ -200,7 +200,7 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
|||
}
|
||||
}
|
||||
catch (SQLException e) {
|
||||
log.debug( "Error closing connection proxy", e );
|
||||
LOG.debug("Error closing connection proxy", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
|||
}
|
||||
}
|
||||
catch (SQLException e) {
|
||||
log.debug( "Error closing connection proxy", e );
|
||||
LOG.debug("Error closing connection proxy", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,21 +23,19 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.internal;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.engine.jdbc.ContextualLobCreator;
|
||||
import org.hibernate.engine.jdbc.LobCreationContext;
|
||||
import org.hibernate.engine.jdbc.LobCreator;
|
||||
import org.hibernate.engine.jdbc.NonContextualLobCreator;
|
||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Builds {@link LobCreator} instances based on the capabilities of the environment.
|
||||
|
@ -45,8 +43,10 @@ import org.slf4j.LoggerFactory;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class LobCreatorBuilder {
|
||||
private static final Logger log = LoggerFactory.getLogger( LobCreatorBuilder.class );
|
||||
private boolean useContextualLobCreation;
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, LobCreatorBuilder.class.getName());
|
||||
|
||||
private boolean useContextualLobCreation;
|
||||
|
||||
/**
|
||||
* The public factory method for obtaining the appropriate (according to given JDBC {@link java.sql.Connection}.
|
||||
|
@ -76,11 +76,11 @@ public class LobCreatorBuilder {
|
|||
boolean isNonContextualLobCreationRequired =
|
||||
ConfigurationHelper.getBoolean( Environment.NON_CONTEXTUAL_LOB_CREATION, configValues );
|
||||
if ( isNonContextualLobCreationRequired ) {
|
||||
log.info( "Disabling contextual LOB creation as " + Environment.NON_CONTEXTUAL_LOB_CREATION + " is true" );
|
||||
LOG.disablingContextualLOBCreation(Environment.NON_CONTEXTUAL_LOB_CREATION);
|
||||
return false;
|
||||
}
|
||||
if ( jdbcConnection == null ) {
|
||||
log.info( "Disabling contextual LOB creation as connection was null" );
|
||||
LOG.disablingContextualLOBCreationSinceConnectionNull();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -89,10 +89,7 @@ public class LobCreatorBuilder {
|
|||
DatabaseMetaData meta = jdbcConnection.getMetaData();
|
||||
// if the jdbc driver version is less than 4, it shouldn't have createClob
|
||||
if ( meta.getJDBCMajorVersion() < 4 ) {
|
||||
log.info(
|
||||
"Disabling contextual LOB creation as JDBC driver reported JDBC version [" +
|
||||
meta.getJDBCMajorVersion() + "] less than 4"
|
||||
);
|
||||
LOG.disablingContextualLOBCreationSinceOldJdbcVersion(meta.getJDBCMajorVersion());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -113,12 +110,12 @@ public class LobCreatorBuilder {
|
|||
freeMethod.invoke( clob, NO_ARGS );
|
||||
}
|
||||
catch ( Throwable ignore ) {
|
||||
log.trace( "Unable to free CLOB created to test createClob() implementation : " + ignore );
|
||||
LOG.tracef("Unable to free CLOB created to test createClob() implementation : %s", ignore);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch ( Throwable t ) {
|
||||
log.info( "Disabling contextual LOB creation as createClob() method threw error : " + t );
|
||||
LOG.disablingContextualLOBCreationSinceCreateClobFailed(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,8 @@
|
|||
package org.hibernate.engine.transaction.internal;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory;
|
||||
import org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory;
|
||||
|
@ -37,6 +34,7 @@ import org.hibernate.engine.transaction.spi.TransactionFactory;
|
|||
import org.hibernate.service.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.service.spi.ServiceInitiator;
|
||||
import org.hibernate.service.spi.ServiceRegistry;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Standard instantiator for the standard {@link TransactionFactory} service.
|
||||
|
@ -44,7 +42,9 @@ import org.hibernate.service.spi.ServiceRegistry;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class TransactionFactoryInitiator implements ServiceInitiator<TransactionFactory> {
|
||||
private static final Logger log = LoggerFactory.getLogger( TransactionFactoryInitiator.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
TransactionFactoryInitiator.class.getName());
|
||||
|
||||
public static final TransactionFactoryInitiator INSTANCE = new TransactionFactoryInitiator();
|
||||
|
||||
|
@ -61,12 +61,12 @@ public class TransactionFactoryInitiator implements ServiceInitiator<Transaction
|
|||
}
|
||||
|
||||
if ( strategy == null ) {
|
||||
log.info( "Using default transaction strategy (direct JDBC transactions)" );
|
||||
LOG.usingDefaultTransactionStrategy();
|
||||
return new JdbcTransactionFactory();
|
||||
}
|
||||
|
||||
final String strategyClassName = mapLegacyNames( strategy.toString() );
|
||||
log.info( "Transaction strategy: " + strategyClassName );
|
||||
LOG.transactionStrategy(strategyClassName);
|
||||
|
||||
ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
|
||||
try {
|
||||
|
|
|
@ -23,20 +23,17 @@
|
|||
*/
|
||||
package org.hibernate.engine.transaction.internal.jdbc;
|
||||
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.engine.transaction.spi.TransactionCoordinator;
|
||||
import org.hibernate.jdbc.ReturningWork;
|
||||
import org.hibernate.jdbc.Work;
|
||||
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* The isolation delegate for JDBC {@link Connection} based transactions
|
||||
|
@ -44,7 +41,8 @@ import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JdbcIsolationDelegate implements IsolationDelegate {
|
||||
private static final Logger log = LoggerFactory.getLogger( JdbcIsolationDelegate.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JdbcIsolationDelegate.class.getName());
|
||||
|
||||
private final TransactionCoordinator transactionCoordinator;
|
||||
|
||||
|
@ -87,7 +85,7 @@ public class JdbcIsolationDelegate implements IsolationDelegate {
|
|||
}
|
||||
}
|
||||
catch ( Exception ignore ) {
|
||||
log.info( "unable to rollback connection on exception [" + ignore + "]" );
|
||||
LOG.unableToRollbackConnection(ignore);
|
||||
}
|
||||
|
||||
if ( e instanceof HibernateException ) {
|
||||
|
@ -106,14 +104,14 @@ public class JdbcIsolationDelegate implements IsolationDelegate {
|
|||
connection.setAutoCommit( true );
|
||||
}
|
||||
catch ( Exception ignore ) {
|
||||
log.trace( "was unable to reset connection back to auto-commit" );
|
||||
LOG.trace("was unable to reset connection back to auto-commit");
|
||||
}
|
||||
}
|
||||
try {
|
||||
connectionProvider().closeConnection( connection );
|
||||
}
|
||||
catch ( Exception ignore ) {
|
||||
log.info( "Unable to release isolated connection [" + ignore + "]" );
|
||||
LOG.unableToReleaseIsolatedConnection(ignore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +149,7 @@ public class JdbcIsolationDelegate implements IsolationDelegate {
|
|||
}
|
||||
}
|
||||
catch ( Exception ignore ) {
|
||||
log.info( "unable to rollback connection on exception [" + ignore + "]" );
|
||||
LOG.unableToRollbackConnection(ignore);
|
||||
}
|
||||
|
||||
if ( e instanceof HibernateException ) {
|
||||
|
@ -170,14 +168,14 @@ public class JdbcIsolationDelegate implements IsolationDelegate {
|
|||
connection.setAutoCommit( true );
|
||||
}
|
||||
catch ( Exception ignore ) {
|
||||
log.trace( "was unable to reset connection back to auto-commit" );
|
||||
LOG.trace("was unable to reset connection back to auto-commit");
|
||||
}
|
||||
}
|
||||
try {
|
||||
connectionProvider().closeConnection( connection );
|
||||
}
|
||||
catch ( Exception ignore ) {
|
||||
log.info( "Unable to release isolated connection [" + ignore + "]" );
|
||||
LOG.unableToReleaseIsolatedConnection(ignore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,18 +23,17 @@
|
|||
*/
|
||||
package org.hibernate.engine.transaction.internal.jdbc;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.TransactionException;
|
||||
import org.hibernate.engine.transaction.spi.AbstractTransactionImpl;
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.engine.transaction.spi.JoinStatus;
|
||||
import org.hibernate.engine.transaction.spi.LocalStatus;
|
||||
import org.hibernate.engine.transaction.spi.TransactionCoordinator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* {@link org.hibernate.Transaction} implementation based on transaction management through a JDBC {@link java.sql.Connection}.
|
||||
|
@ -46,7 +45,8 @@ import java.sql.SQLException;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JdbcTransaction extends AbstractTransactionImpl {
|
||||
private static final Logger log = LoggerFactory.getLogger( JdbcTransaction.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JdbcTransaction.class.getName());
|
||||
|
||||
private Connection managedConnection;
|
||||
private boolean wasInitiallyAutoCommit;
|
||||
|
@ -64,11 +64,9 @@ public class JdbcTransaction extends AbstractTransactionImpl {
|
|||
}
|
||||
managedConnection = transactionCoordinator().getJdbcCoordinator().getLogicalConnection().getConnection();
|
||||
wasInitiallyAutoCommit = managedConnection.getAutoCommit();
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debug( "initial autocommit status: " + wasInitiallyAutoCommit );
|
||||
}
|
||||
LOG.debug("initial autocommit status: " + wasInitiallyAutoCommit);
|
||||
if ( wasInitiallyAutoCommit ) {
|
||||
log.debug( "disabling autocommit" );
|
||||
LOG.debug("disabling autocommit");
|
||||
managedConnection.setAutoCommit( false );
|
||||
}
|
||||
}
|
||||
|
@ -110,7 +108,7 @@ public class JdbcTransaction extends AbstractTransactionImpl {
|
|||
protected void doCommit() throws TransactionException {
|
||||
try {
|
||||
managedConnection.commit();
|
||||
log.debug( "committed JDBC Connection" );
|
||||
LOG.debug("committed JDBC Connection");
|
||||
}
|
||||
catch( SQLException e ) {
|
||||
throw new TransactionException( "unable to commit against JDBC connection", e );
|
||||
|
@ -123,13 +121,13 @@ public class JdbcTransaction extends AbstractTransactionImpl {
|
|||
private void releaseManagedConnection() {
|
||||
try {
|
||||
if ( wasInitiallyAutoCommit ) {
|
||||
log.debug( "re-enabling autocommit" );
|
||||
LOG.debug("re-enabling autocommit");
|
||||
managedConnection.setAutoCommit( true );
|
||||
}
|
||||
managedConnection = null;
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
log.debug( "Could not toggle autocommit", e );
|
||||
LOG.debug("Could not toggle autocommit", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,7 +145,7 @@ public class JdbcTransaction extends AbstractTransactionImpl {
|
|||
transactionCoordinator().getTransactionContext().managedClose();
|
||||
}
|
||||
catch (HibernateException e) {
|
||||
log.info( "Could not close session; swallowing exception as transaction completed", e );
|
||||
LOG.unableToCloseSessionButSwallowingError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +159,7 @@ public class JdbcTransaction extends AbstractTransactionImpl {
|
|||
protected void doRollback() throws TransactionException {
|
||||
try {
|
||||
managedConnection.rollback();
|
||||
log.debug( "rolled JDBC Connection" );
|
||||
LOG.debug("rolled JDBC Connection");
|
||||
}
|
||||
catch( SQLException e ) {
|
||||
throw new TransactionException( "unable to rollback against JDBC connection", e );
|
||||
|
|
|
@ -29,17 +29,15 @@ import javax.transaction.NotSupportedException;
|
|||
import javax.transaction.SystemException;
|
||||
import javax.transaction.Transaction;
|
||||
import javax.transaction.TransactionManager;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.engine.transaction.spi.TransactionCoordinator;
|
||||
import org.hibernate.jdbc.ReturningWork;
|
||||
import org.hibernate.jdbc.Work;
|
||||
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* An isolation delegate for JTA environments.
|
||||
|
@ -47,7 +45,8 @@ import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JtaIsolationDelegate implements IsolationDelegate {
|
||||
private static final Logger log = LoggerFactory.getLogger( JtaIsolationDelegate.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JtaIsolationDelegate.class.getName());
|
||||
|
||||
private final TransactionCoordinator transactionCoordinator;
|
||||
|
||||
|
@ -83,9 +82,7 @@ public class JtaIsolationDelegate implements IsolationDelegate {
|
|||
try {
|
||||
// First we suspend any current JTA transaction
|
||||
Transaction surroundingTransaction = transactionManager.suspend();
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debug( "surrounding JTA transaction suspended [" + surroundingTransaction + "]" );
|
||||
}
|
||||
LOG.debugf("Surrounding JTA transaction suspended [%s]", surroundingTransaction);
|
||||
|
||||
boolean hadProblems = false;
|
||||
try {
|
||||
|
@ -104,9 +101,7 @@ public class JtaIsolationDelegate implements IsolationDelegate {
|
|||
finally {
|
||||
try {
|
||||
transactionManager.resume( surroundingTransaction );
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debug( "surrounding JTA transaction resumed [" + surroundingTransaction + "]" );
|
||||
}
|
||||
LOG.debugf("Surrounding JTA transaction resumed [%s]", surroundingTransaction);
|
||||
}
|
||||
catch( Throwable t ) {
|
||||
// if the actually work had an error use that, otherwise error based on t
|
||||
|
@ -137,7 +132,7 @@ public class JtaIsolationDelegate implements IsolationDelegate {
|
|||
transactionManager.rollback();
|
||||
}
|
||||
catch ( Exception ignore ) {
|
||||
log.info( "Unable to rollback isolated transaction on error [" + e + "] : [" + ignore + "]" );
|
||||
LOG.unableToRollbackIsolatedTransaction(e, ignore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -173,7 +168,7 @@ public class JtaIsolationDelegate implements IsolationDelegate {
|
|||
connectionProvider().closeConnection( connection );
|
||||
}
|
||||
catch ( Throwable ignore ) {
|
||||
log.info( "Unable to release isolated connection [" + ignore + "]" );
|
||||
LOG.unableToReleaseIsolatedConnection(ignore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,9 +184,7 @@ public class JtaIsolationDelegate implements IsolationDelegate {
|
|||
try {
|
||||
// First we suspend any current JTA transaction
|
||||
Transaction surroundingTransaction = transactionManager.suspend();
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debug( "surrounding JTA transaction suspended [" + surroundingTransaction + "]" );
|
||||
}
|
||||
LOG.debugf("Surrounding JTA transaction suspended [%s]", surroundingTransaction);
|
||||
|
||||
boolean hadProblems = false;
|
||||
try {
|
||||
|
@ -210,9 +203,7 @@ public class JtaIsolationDelegate implements IsolationDelegate {
|
|||
finally {
|
||||
try {
|
||||
transactionManager.resume( surroundingTransaction );
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debug( "surrounding JTA transaction resumed [" + surroundingTransaction + "]" );
|
||||
}
|
||||
LOG.debugf("Surrounding JTA transaction resumed [%s]", surroundingTransaction);
|
||||
}
|
||||
catch( Throwable t ) {
|
||||
// if the actually work had an error use that, otherwise error based on t
|
||||
|
@ -244,7 +235,7 @@ public class JtaIsolationDelegate implements IsolationDelegate {
|
|||
transactionManager.rollback();
|
||||
}
|
||||
catch ( Exception ignore ) {
|
||||
log.info( "Unable to rollback isolated transaction on error [" + e + "] : [" + ignore + "]" );
|
||||
LOG.unableToRollbackIsolatedTransaction(e, ignore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -281,7 +272,7 @@ public class JtaIsolationDelegate implements IsolationDelegate {
|
|||
connectionProvider().closeConnection( connection );
|
||||
}
|
||||
catch ( Throwable ignore ) {
|
||||
log.info( "Unable to release isolated connection [" + ignore + "]" );
|
||||
LOG.unableToReleaseIsolatedConnection(ignore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,20 +23,19 @@
|
|||
*/
|
||||
package org.hibernate.engine.transaction.internal.jta;
|
||||
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.UserTransaction;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.TransactionException;
|
||||
import org.hibernate.engine.transaction.spi.AbstractTransactionImpl;
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.engine.transaction.spi.JoinStatus;
|
||||
import org.hibernate.engine.transaction.spi.LocalStatus;
|
||||
import org.hibernate.engine.transaction.spi.TransactionCoordinator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.UserTransaction;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Implements a transaction strategy based on transaction management through a JTA {@link UserTransaction}.
|
||||
|
@ -46,7 +45,8 @@ import javax.transaction.UserTransaction;
|
|||
* @author Les Hazlewood
|
||||
*/
|
||||
public class JtaTransaction extends AbstractTransactionImpl {
|
||||
private static final Logger log = LoggerFactory.getLogger( JtaTransaction.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JtaTransaction.class.getName());
|
||||
|
||||
private UserTransaction userTransaction;
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class JtaTransaction extends AbstractTransactionImpl {
|
|||
|
||||
@Override
|
||||
protected void doBegin() {
|
||||
log.debug( "begin" );
|
||||
LOG.debug("begin");
|
||||
|
||||
userTransaction = jtaPlatform().retrieveUserTransaction();
|
||||
if ( userTransaction == null ) {
|
||||
|
@ -75,7 +75,7 @@ public class JtaTransaction extends AbstractTransactionImpl {
|
|||
if ( userTransaction.getStatus() == Status.STATUS_NO_TRANSACTION ) {
|
||||
userTransaction.begin();
|
||||
isInitiator = true;
|
||||
log.debug( "Began a new JTA transaction" );
|
||||
LOG.debug("Began a new JTA transaction");
|
||||
}
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
|
@ -108,7 +108,7 @@ public class JtaTransaction extends AbstractTransactionImpl {
|
|||
}
|
||||
}
|
||||
else {
|
||||
log.debug( "Unable to apply requested transaction timeout; no UserTransaction. Will try later" );
|
||||
LOG.debug("Unable to apply requested transaction timeout; no UserTransaction. Will try later");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public class JtaTransaction extends AbstractTransactionImpl {
|
|||
try {
|
||||
if ( isInitiator ) {
|
||||
userTransaction.commit();
|
||||
log.debug( "Committed JTA UserTransaction" );
|
||||
LOG.debug("Committed JTA UserTransaction");
|
||||
}
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
|
@ -167,7 +167,7 @@ public class JtaTransaction extends AbstractTransactionImpl {
|
|||
// this method is a noop if there is a Synchronization!
|
||||
if ( isDriver ) {
|
||||
if ( !isInitiator ) {
|
||||
log.warn( "You should set hibernate.transaction.manager_lookup_class if cache is enabled" );
|
||||
LOG.setManagerLookupClass();
|
||||
}
|
||||
try {
|
||||
transactionCoordinator().afterTransaction( this, userTransaction.getStatus() );
|
||||
|
@ -190,7 +190,7 @@ public class JtaTransaction extends AbstractTransactionImpl {
|
|||
// failed commits automatically rollback the transaction per JTA spec
|
||||
if ( getLocalStatus() != LocalStatus.FAILED_COMMIT ) {
|
||||
userTransaction.rollback();
|
||||
log.debug( "Rolled back JTA UserTransaction" );
|
||||
LOG.debug("Rolled back JTA UserTransaction");
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -204,13 +204,13 @@ public class JtaTransaction extends AbstractTransactionImpl {
|
|||
|
||||
@Override
|
||||
public void markRollbackOnly() {
|
||||
log.trace( "Marking transaction for rollback only" );
|
||||
LOG.trace("Marking transaction for rollback only");
|
||||
try {
|
||||
userTransaction.setRollbackOnly();
|
||||
log.debug( "set JTA UserTransaction to rollback only" );
|
||||
LOG.debug("set JTA UserTransaction to rollback only");
|
||||
}
|
||||
catch (SystemException e) {
|
||||
log.debug( "Unable to mark transaction for rollback only", e );
|
||||
LOG.debug("Unable to mark transaction for rollback only", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,13 @@
|
|||
*/
|
||||
package org.hibernate.engine.transaction.spi;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.TransactionException;
|
||||
import org.hibernate.service.jta.platform.spi.JtaPlatform;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.transaction.Status;
|
||||
import javax.transaction.Synchronization;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.TransactionException;
|
||||
import org.hibernate.service.jta.platform.spi.JtaPlatform;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Abstract support for creating {@link TransactionImplementor transaction} implementations
|
||||
|
@ -38,7 +37,9 @@ import javax.transaction.Synchronization;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public abstract class AbstractTransactionImpl implements TransactionImplementor {
|
||||
private static final Logger log = LoggerFactory.getLogger( AbstractTransactionImpl.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
AbstractTransactionImpl.class.getName());
|
||||
|
||||
private final TransactionCoordinator transactionCoordinator;
|
||||
|
||||
|
@ -147,7 +148,7 @@ public abstract class AbstractTransactionImpl implements TransactionImplementor
|
|||
throw new TransactionException( "reuse of Transaction instances not supported" );
|
||||
}
|
||||
|
||||
log.debug( "begin" );
|
||||
LOG.debug("begin");
|
||||
|
||||
doBegin();
|
||||
|
||||
|
@ -162,7 +163,7 @@ public abstract class AbstractTransactionImpl implements TransactionImplementor
|
|||
throw new TransactionException( "Transaction not successfully started" );
|
||||
}
|
||||
|
||||
log.debug( "committing" );
|
||||
LOG.debug("committing");
|
||||
|
||||
beforeTransactionCommit();
|
||||
|
||||
|
@ -192,7 +193,7 @@ public abstract class AbstractTransactionImpl implements TransactionImplementor
|
|||
throw new TransactionException( "Transaction not successfully started" );
|
||||
}
|
||||
|
||||
log.debug( "rolling back" );
|
||||
LOG.debug("rolling back");
|
||||
|
||||
beforeTransactionRollBack();
|
||||
|
||||
|
|
|
@ -23,11 +23,10 @@
|
|||
*/
|
||||
package org.hibernate.engine.transaction.synchronization.internal;
|
||||
|
||||
import org.hibernate.engine.transaction.synchronization.spi.SynchronizationCallbackCoordinator;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.transaction.Synchronization;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.engine.transaction.synchronization.spi.SynchronizationCallbackCoordinator;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* The JTA {@link javax.transaction.Synchronization} Hibernate registers when needed for JTA callbacks
|
||||
|
@ -35,7 +34,9 @@ import javax.transaction.Synchronization;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class RegisteredSynchronization implements Synchronization {
|
||||
private static final Logger log = LoggerFactory.getLogger( RegisteredSynchronization.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
RegisteredSynchronization.class.getName());
|
||||
|
||||
private final SynchronizationCallbackCoordinator synchronizationCallbackCoordinator;
|
||||
|
||||
|
@ -47,7 +48,7 @@ public class RegisteredSynchronization implements Synchronization {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
public void beforeCompletion() {
|
||||
log.trace( "JTA sync : beforeCompletion()" );
|
||||
LOG.trace("JTA sync : beforeCompletion()");
|
||||
synchronizationCallbackCoordinator.beforeCompletion();
|
||||
}
|
||||
|
||||
|
@ -55,7 +56,7 @@ public class RegisteredSynchronization implements Synchronization {
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
public void afterCompletion(int status) {
|
||||
log.trace( "JTA sync : afterCompletion({})", status );
|
||||
LOG.tracef("JTA sync : afterCompletion(%s)", status);
|
||||
synchronizationCallbackCoordinator.afterCompletion( status );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.service.jta.platform.internal;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.internal.util.jndi.JndiHelper;
|
||||
import org.hibernate.service.classloading.spi.ClassLoaderService;
|
||||
|
@ -32,8 +33,7 @@ import org.hibernate.service.jta.platform.spi.JtaPlatformException;
|
|||
import org.hibernate.service.spi.ServiceInitiator;
|
||||
import org.hibernate.service.spi.ServiceRegistry;
|
||||
import org.hibernate.transaction.TransactionManagerLookup;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Standard initiator for the standard {@link org.hibernate.service.jta.platform.spi.JtaPlatform}
|
||||
|
@ -44,7 +44,7 @@ public class JtaPlatformInitiator implements ServiceInitiator<JtaPlatform> {
|
|||
public static final JtaPlatformInitiator INSTANCE = new JtaPlatformInitiator();
|
||||
public static final String JTA_PLATFORM = "hibernate.jta.platform";
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger( JtaPlatformInitiator.class );
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JtaPlatformInitiator.class.getName());
|
||||
|
||||
@Override
|
||||
public Class<JtaPlatform> getServiceInitiated() {
|
||||
|
@ -72,7 +72,7 @@ public class JtaPlatformInitiator implements ServiceInitiator<JtaPlatform> {
|
|||
final String platformImplName = platform.toString();
|
||||
final ClassLoaderService classLoaderService = registry.getService( ClassLoaderService.class );
|
||||
try {
|
||||
jtaPlatformImplClass = (Class<JtaPlatform>) classLoaderService.classForName( platformImplName );
|
||||
jtaPlatformImplClass = classLoaderService.classForName( platformImplName );
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
throw new HibernateException( "Unable to locate specified JtaPlatform class [" + platformImplName + "]", e );
|
||||
|
@ -92,14 +92,12 @@ public class JtaPlatformInitiator implements ServiceInitiator<JtaPlatform> {
|
|||
if ( platform == null ) {
|
||||
final String transactionManagerLookupImplName = (String) configVales.get( Environment.TRANSACTION_MANAGER_STRATEGY );
|
||||
if ( transactionManagerLookupImplName != null ) {
|
||||
log.warn(
|
||||
"Using deprecated " + TransactionManagerLookup.class.getName() + " strategy [" +
|
||||
Environment.TRANSACTION_MANAGER_STRATEGY +
|
||||
"], use newer " + JtaPlatform.class.getName() +
|
||||
" strategy instead [" + JTA_PLATFORM + "]"
|
||||
);
|
||||
LOG.deprecatedTransactionManagerStrategy(TransactionManagerLookup.class.getName(),
|
||||
Environment.TRANSACTION_MANAGER_STRATEGY,
|
||||
JtaPlatform.class.getName(),
|
||||
JTA_PLATFORM);
|
||||
platform = mapLegacyClasses( transactionManagerLookupImplName, configVales, registry );
|
||||
log.debug( "Mapped {} -> {}", transactionManagerLookupImplName, platform );
|
||||
LOG.debugf("Mapped %s -> %s", transactionManagerLookupImplName, platform);
|
||||
}
|
||||
}
|
||||
return platform;
|
||||
|
@ -113,11 +111,7 @@ public class JtaPlatformInitiator implements ServiceInitiator<JtaPlatform> {
|
|||
return null;
|
||||
}
|
||||
|
||||
log.info(
|
||||
"Encountered legacy TransactionManagerLookup specified; convert to newer " +
|
||||
JtaPlatform.class.getName() + " contract specified via " +
|
||||
JTA_PLATFORM + "setting"
|
||||
);
|
||||
LOG.legacyTransactionManagerStrategy(JtaPlatform.class.getName(), JTA_PLATFORM);
|
||||
|
||||
if ( "org.hibernate.transaction.BESTransactionManagerLookup".equals( transactionManagerLookupImplName ) ) {
|
||||
return new BorlandEnterpriseServerJtaPlatform();
|
||||
|
|
|
@ -23,13 +23,12 @@
|
|||
*/
|
||||
package org.hibernate.service.jta.platform.internal;
|
||||
|
||||
import org.hibernate.service.jta.platform.spi.JtaPlatformException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.UserTransaction;
|
||||
import java.lang.reflect.Method;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.service.jta.platform.spi.JtaPlatformException;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* JTA platform implementation for WebSphere (versions 4, 5.0 and 5.1)
|
||||
|
@ -38,7 +37,8 @@ import java.lang.reflect.Method;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class WebSphereJtaPlatform extends AbstractJtaPlatform {
|
||||
private static final Logger log = LoggerFactory.getLogger( WebSphereJtaPlatform.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, WebSphereJtaPlatform.class.getName());
|
||||
|
||||
public static final String VERSION_5_UT_NAME = "java:comp/UserTransaction";
|
||||
public static final String VERSION_4_UT_NAME = "jta/usertransaction";
|
||||
|
@ -55,18 +55,18 @@ public class WebSphereJtaPlatform extends AbstractJtaPlatform {
|
|||
try {
|
||||
clazz = Class.forName( "com.ibm.ws.Transaction.TransactionManagerFactory" );
|
||||
version = 5;
|
||||
log.debug( "WebSphere 5.1" );
|
||||
LOG.debug("WebSphere 5.1");
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
try {
|
||||
clazz = Class.forName( "com.ibm.ejs.jts.jta.TransactionManagerFactory" );
|
||||
version = 5;
|
||||
log.debug( "WebSphere 5.0" );
|
||||
LOG.debug("WebSphere 5.0");
|
||||
}
|
||||
catch ( Exception e2 ) {
|
||||
clazz = Class.forName( "com.ibm.ejs.jts.jta.JTSXA" );
|
||||
version = 4;
|
||||
log.debug( "WebSphere 4" );
|
||||
LOG.debug("WebSphere 4");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,34 +23,28 @@
|
|||
*/
|
||||
package org.hibernate.test.common.jta;
|
||||
|
||||
import com.atomikos.icatch.jta.UserTransactionImp;
|
||||
import com.atomikos.icatch.jta.UserTransactionManager;
|
||||
import com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean;
|
||||
|
||||
import org.hibernate.service.internal.ServiceProxy;
|
||||
import javax.sql.DataSource;
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.UserTransaction;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.service.jta.platform.internal.AbstractJtaPlatform;
|
||||
import org.hibernate.service.jta.platform.internal.JtaSynchronizationStrategy;
|
||||
import org.hibernate.service.jta.platform.internal.TransactionManagerBasedSynchronizationStrategy;
|
||||
import org.hibernate.service.jta.platform.spi.JtaPlatform;
|
||||
import org.hibernate.service.jta.platform.spi.JtaPlatformException;
|
||||
import org.hibernate.service.spi.ServiceRegistry;
|
||||
import org.hibernate.service.spi.Startable;
|
||||
import org.hibernate.service.spi.Stoppable;
|
||||
import org.hibernate.test.common.ConnectionProviderBuilder;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import javax.transaction.SystemException;
|
||||
import javax.transaction.TransactionManager;
|
||||
import javax.transaction.UserTransaction;
|
||||
import org.jboss.logging.Logger;
|
||||
import com.atomikos.icatch.jta.UserTransactionImp;
|
||||
import com.atomikos.icatch.jta.UserTransactionManager;
|
||||
import com.atomikos.jdbc.nonxa.AtomikosNonXADataSourceBean;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class AtomikosJtaPlatform extends AbstractJtaPlatform implements Startable, Stoppable {
|
||||
private static final Logger log = LoggerFactory.getLogger( AtomikosJtaPlatform.class );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, AtomikosJtaPlatform.class.getName());
|
||||
|
||||
private final JtaSynchronizationStrategy synchronizationStrategy = new TransactionManagerBasedSynchronizationStrategy( this );
|
||||
|
||||
|
@ -113,7 +107,7 @@ public class AtomikosJtaPlatform extends AbstractJtaPlatform implements Startabl
|
|||
dataSourceBean.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.debug( "Error closing DataSourceBean", e );
|
||||
LOG.debug("Error closing DataSourceBean", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +116,7 @@ public class AtomikosJtaPlatform extends AbstractJtaPlatform implements Startabl
|
|||
transactionManager.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.debug( "Error closing UserTransactionManager", e );
|
||||
LOG.debug("Error closing UserTransactionManager", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue