HHH-13595 Small tuning of JdbcObserverImpl

This commit is contained in:
Sanne Grinovero 2019-08-23 15:16:52 +01:00
parent c94117cedc
commit db92f7aa00
1 changed files with 11 additions and 10 deletions

View File

@ -8,25 +8,27 @@ package org.hibernate.internal;
import java.sql.Connection; import java.sql.Connection;
import org.hibernate.engine.spi.SessionEventListenerManager;
import org.hibernate.engine.spi.SharedSessionContractImplementor; import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.resource.jdbc.spi.JdbcObserver; import org.hibernate.resource.jdbc.spi.JdbcObserver;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class JdbcObserverImpl implements JdbcObserver { public final class JdbcObserverImpl implements JdbcObserver {
private final SharedSessionContractImplementor session;
private final ConnectionObserverStatsBridge observer; private final ConnectionObserverStatsBridge observer;
private final SessionEventListenerManager eventListenerManager;
private final SharedSessionContractImplementor session;
public JdbcObserverImpl(SharedSessionContractImplementor session, FastSessionServices fastSessionServices) { public JdbcObserverImpl(SharedSessionContractImplementor session, FastSessionServices fastSessionServices) {
this.session = session; this.session = session;
this.observer = fastSessionServices.getDefaultJdbcObserver(); this.observer = fastSessionServices.getDefaultJdbcObserver();
this.eventListenerManager = session.getEventListenerManager();
} }
@Override @Override
public void jdbcConnectionAcquisitionStart() { public void jdbcConnectionAcquisitionStart() {
} }
@Override @Override
@ -36,7 +38,6 @@ public class JdbcObserverImpl implements JdbcObserver {
@Override @Override
public void jdbcConnectionReleaseStart() { public void jdbcConnectionReleaseStart() {
} }
@Override @Override
@ -46,33 +47,33 @@ public class JdbcObserverImpl implements JdbcObserver {
@Override @Override
public void jdbcPrepareStatementStart() { public void jdbcPrepareStatementStart() {
session.getEventListenerManager().jdbcPrepareStatementStart(); eventListenerManager.jdbcPrepareStatementStart();
} }
@Override @Override
public void jdbcPrepareStatementEnd() { public void jdbcPrepareStatementEnd() {
observer.statementPrepared(); observer.statementPrepared();
session.getEventListenerManager().jdbcPrepareStatementEnd(); eventListenerManager.jdbcPrepareStatementEnd();
} }
@Override @Override
public void jdbcExecuteStatementStart() { public void jdbcExecuteStatementStart() {
session.getEventListenerManager().jdbcExecuteStatementStart(); eventListenerManager.jdbcExecuteStatementStart();
} }
@Override @Override
public void jdbcExecuteStatementEnd() { public void jdbcExecuteStatementEnd() {
session.getEventListenerManager().jdbcExecuteStatementEnd(); eventListenerManager.jdbcExecuteStatementEnd();
} }
@Override @Override
public void jdbcExecuteBatchStart() { public void jdbcExecuteBatchStart() {
session.getEventListenerManager().jdbcExecuteBatchStart(); eventListenerManager.jdbcExecuteBatchStart();
} }
@Override @Override
public void jdbcExecuteBatchEnd() { public void jdbcExecuteBatchEnd() {
session.getEventListenerManager().jdbcExecuteBatchEnd(); eventListenerManager.jdbcExecuteBatchEnd();
} }
@Override @Override