HHH-6258: Wrap trace and debug log statements to lessen the load on JBossLogManagerLogger.doLog. This improved throughput quite a bit.
This commit is contained in:
parent
a917bb4b40
commit
e01bb8a911
|
@ -69,7 +69,9 @@ public abstract class AbstractResultSetProxyHandler extends AbstractProxyHandler
|
|||
@Override
|
||||
protected Object continueInvocation(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
String methodName = method.getName();
|
||||
LOG.trace("Handling invocation of ResultSet method [" + methodName + "]");
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Handling invocation of ResultSet method [" + methodName + "]");
|
||||
}
|
||||
|
||||
// other methods allowed while invalid ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ( "close".equals( methodName ) ) {
|
||||
|
|
|
@ -85,7 +85,9 @@ public abstract class AbstractStatementProxyHandler extends AbstractProxyHandler
|
|||
@Override
|
||||
protected Object continueInvocation(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
String methodName = method.getName();
|
||||
LOG.trace("Handling invocation of statement method [" + methodName + "]");
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Handling invocation of statement method [" + methodName + "]");
|
||||
}
|
||||
|
||||
// other methods allowed while invalid ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ( "close".equals( methodName ) ) {
|
||||
|
|
|
@ -183,7 +183,9 @@ public class LoadContexts {
|
|||
if (collectionLoadContexts == null) collectionLoadContexts = IdentityMap.instantiate(8);
|
||||
else context = (CollectionLoadContext)collectionLoadContexts.get(resultSet);
|
||||
if ( context == null ) {
|
||||
LOG.trace("Constructing collection load context for result set [" + resultSet + "]");
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Constructing collection load context for result set [" + resultSet + "]");
|
||||
}
|
||||
context = new CollectionLoadContext( this, resultSet );
|
||||
collectionLoadContexts.put( resultSet, context );
|
||||
}
|
||||
|
|
|
@ -132,7 +132,9 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
|
|||
}
|
||||
|
||||
public void afterTransaction(TransactionImplementor hibernateTransaction, int status) {
|
||||
LOG.trace( "after transaction completion" );
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace( "after transaction completion" );
|
||||
}
|
||||
|
||||
final boolean success = JtaStatusHelper.isCommitted( status );
|
||||
|
||||
|
@ -217,7 +219,9 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
|
|||
|
||||
if ( ! transactionContext.shouldAutoJoinTransaction() ) {
|
||||
if ( currentHibernateTransaction.getJoinStatus() != JoinStatus.MARKED_FOR_JOINED ) {
|
||||
LOG.debug( "Skipping JTA sync registration due to auto join checking" );
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug( "Skipping JTA sync registration due to auto join checking" );
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -235,19 +239,25 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
|
|||
|
||||
// Can we resister a synchronization
|
||||
if ( ! jtaPlatform.canRegisterSynchronization() ) {
|
||||
LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace( "registered JTA platform says we cannot currently resister synchronization; skipping" );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Should we resister a synchronization
|
||||
if ( ! transactionFactory().isJoinableJtaTransaction( this, currentHibernateTransaction ) ) {
|
||||
LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace( "TransactionFactory reported no JTA transaction to join; skipping Synchronization registration" );
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
jtaPlatform.registerSynchronization( new RegisteredSynchronization( getSynchronizationCallbackCoordinator() ) );
|
||||
synchronizationRegistered = true;
|
||||
LOG.debug( "successfully registered Synchronization" );
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug( "successfully registered Synchronization" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -259,7 +269,9 @@ public class TransactionCoordinatorImpl implements TransactionCoordinator {
|
|||
}
|
||||
|
||||
public void pulse() {
|
||||
LOG.trace( "Starting transaction coordinator pulse" );
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace( "Starting transaction coordinator pulse" );
|
||||
}
|
||||
if ( transactionFactory().compatibleWithJtaSynchronization() ) {
|
||||
// the configured transaction strategy says it supports callbacks via JTA synchronization, so attempt to
|
||||
// register JTA synchronization if possible
|
||||
|
|
|
@ -242,7 +242,9 @@ public abstract class AbstractFlushingEventListener implements Serializable {
|
|||
*/
|
||||
private void flushCollections(EventSource session) throws HibernateException {
|
||||
|
||||
LOG.trace("Processing unreferenced collections");
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Processing unreferenced collections");
|
||||
}
|
||||
|
||||
List list = IdentityMap.entries( session.getPersistenceContext().getCollectionEntries() );
|
||||
int size = list.size();
|
||||
|
@ -256,7 +258,9 @@ public abstract class AbstractFlushingEventListener implements Serializable {
|
|||
|
||||
// Schedule updates to collections:
|
||||
|
||||
LOG.trace("Scheduling collection removes/(re)creates/updates");
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Scheduling collection removes/(re)creates/updates");
|
||||
}
|
||||
|
||||
list = IdentityMap.entries( session.getPersistenceContext().getCollectionEntries() );
|
||||
size = list.size();
|
||||
|
|
|
@ -854,12 +854,16 @@ public abstract class Loader {
|
|||
|
||||
EntityKey[] keys = new EntityKey[entitySpan]; //we can reuse it for each row
|
||||
|
||||
LOG.trace("Processing result set");
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Processing result set");
|
||||
}
|
||||
|
||||
int count;
|
||||
for ( count = 0; count < maxRows && rs.next(); count++ ) {
|
||||
|
||||
LOG.debugf("Result set row: %s", count);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debugf("Result set row: %s", count);
|
||||
}
|
||||
|
||||
Object result = getRowFromResultSet(
|
||||
rs,
|
||||
|
@ -881,7 +885,9 @@ public abstract class Loader {
|
|||
|
||||
}
|
||||
|
||||
LOG.trace("Done processing result set (" + count + " rows)");
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Done processing result set (" + count + " rows)");
|
||||
}
|
||||
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -74,7 +74,9 @@ public final class ServiceBinding<R extends Service> {
|
|||
|
||||
public void setService(R service) {
|
||||
if ( this.service != null ) {
|
||||
log.debug( "Overriding existing service binding [" + serviceRole.getName() + "]" );
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug( "Overriding existing service binding [" + serviceRole.getName() + "]" );
|
||||
}
|
||||
}
|
||||
this.service = service;
|
||||
}
|
||||
|
|
|
@ -65,14 +65,18 @@ public abstract class BasicBinder<J> implements ValueBinder<J> {
|
|||
*/
|
||||
public final void bind(PreparedStatement st, J value, int index, WrapperOptions options) throws SQLException {
|
||||
if ( value == null ) {
|
||||
LOG.trace(String.format(NULL_BIND_MSG_TEMPLATE, index, JdbcTypeNameMapper.getTypeName(sqlDescriptor.getSqlType())));
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace(String.format(NULL_BIND_MSG_TEMPLATE, index, JdbcTypeNameMapper.getTypeName(sqlDescriptor.getSqlType())));
|
||||
}
|
||||
st.setNull( index, sqlDescriptor.getSqlType() );
|
||||
}
|
||||
else {
|
||||
LOG.trace(String.format(BIND_MSG_TEMPLATE,
|
||||
index,
|
||||
JdbcTypeNameMapper.getTypeName(sqlDescriptor.getSqlType()),
|
||||
getJavaDescriptor().extractLoggableRepresentation(value)));
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace(String.format(BIND_MSG_TEMPLATE,
|
||||
index,
|
||||
JdbcTypeNameMapper.getTypeName(sqlDescriptor.getSqlType()),
|
||||
getJavaDescriptor().extractLoggableRepresentation(value)));
|
||||
}
|
||||
doBind( st, value, index, options );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,11 +62,15 @@ public abstract class BasicExtractor<J> implements ValueExtractor<J> {
|
|||
public J extract(ResultSet rs, String name, WrapperOptions options) throws SQLException {
|
||||
final J value = doExtract( rs, name, options );
|
||||
if ( value == null || rs.wasNull() ) {
|
||||
LOG.trace("Found [null] as column [" + name + "]");
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Found [null] as column [" + name + "]");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
LOG.trace("Found [" + getJavaDescriptor().extractLoggableRepresentation(value) + "] as column [" + name + "]");
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Found [" + getJavaDescriptor().extractLoggableRepresentation(value) + "] as column [" + name + "]");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue