HHH-13595 Deprecate ConnectionObserver
This commit is contained in:
parent
952bf6f9c0
commit
c94117cedc
|
@ -125,7 +125,7 @@ final class FastSessionServices {
|
||||||
private final Dialect dialect;
|
private final Dialect dialect;
|
||||||
private final CacheStoreMode defaultCacheStoreMode;
|
private final CacheStoreMode defaultCacheStoreMode;
|
||||||
private final CacheRetrieveMode defaultCacheRetrieveMode;
|
private final CacheRetrieveMode defaultCacheRetrieveMode;
|
||||||
private List<ConnectionObserver> defaultJdbcObservers;
|
private final ConnectionObserverStatsBridge defaultJdbcObservers;
|
||||||
|
|
||||||
FastSessionServices(SessionFactoryImpl sf) {
|
FastSessionServices(SessionFactoryImpl sf) {
|
||||||
Objects.requireNonNull( sf );
|
Objects.requireNonNull( sf );
|
||||||
|
@ -174,7 +174,7 @@ final class FastSessionServices {
|
||||||
this.defaultCacheRetrieveMode = determineCacheRetrieveMode( defaultSessionProperties );
|
this.defaultCacheRetrieveMode = determineCacheRetrieveMode( defaultSessionProperties );
|
||||||
this.initialSessionCacheMode = CacheModeHelper.interpretCacheMode( defaultCacheStoreMode, defaultCacheRetrieveMode );
|
this.initialSessionCacheMode = CacheModeHelper.interpretCacheMode( defaultCacheStoreMode, defaultCacheRetrieveMode );
|
||||||
this.discardOnClose = sessionFactoryOptions.isReleaseResourcesOnCloseEnabled();
|
this.discardOnClose = sessionFactoryOptions.isReleaseResourcesOnCloseEnabled();
|
||||||
this.defaultJdbcObservers = Collections.singletonList( new ConnectionObserverStatsBridge( sf ) );
|
this.defaultJdbcObservers = new ConnectionObserverStatsBridge( sf );
|
||||||
this.defaultSessionEventListeners = sessionFactoryOptions.getBaselineSessionEventsListenerBuilder();
|
this.defaultSessionEventListeners = sessionFactoryOptions.getBaselineSessionEventsListenerBuilder();
|
||||||
this.defaultLockOptions = initializeDefaultLockOptions( defaultSessionProperties );
|
this.defaultLockOptions = initializeDefaultLockOptions( defaultSessionProperties );
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ final class FastSessionServices {
|
||||||
return ( CacheStoreMode ) settings.get( JPA_SHARED_CACHE_STORE_MODE );
|
return ( CacheStoreMode ) settings.get( JPA_SHARED_CACHE_STORE_MODE );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<ConnectionObserver> getDefaultJdbcObservers() {
|
public ConnectionObserverStatsBridge getDefaultJdbcObserver() {
|
||||||
return defaultJdbcObservers;
|
return defaultJdbcObservers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.internal;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
||||||
import org.hibernate.engine.jdbc.spi.ConnectionObserver;
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -18,11 +17,11 @@ import org.hibernate.resource.jdbc.spi.JdbcObserver;
|
||||||
public class JdbcObserverImpl implements JdbcObserver {
|
public class JdbcObserverImpl implements JdbcObserver {
|
||||||
|
|
||||||
private final SharedSessionContractImplementor session;
|
private final SharedSessionContractImplementor session;
|
||||||
private final Iterable<ConnectionObserver> observers;
|
private final ConnectionObserverStatsBridge observer;
|
||||||
|
|
||||||
public JdbcObserverImpl(SharedSessionContractImplementor session, FastSessionServices fastSessionServices) {
|
public JdbcObserverImpl(SharedSessionContractImplementor session, FastSessionServices fastSessionServices) {
|
||||||
this.session = session;
|
this.session = session;
|
||||||
this.observers = fastSessionServices.getDefaultJdbcObservers();
|
this.observer = fastSessionServices.getDefaultJdbcObserver();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,9 +31,7 @@ public class JdbcObserverImpl implements JdbcObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void jdbcConnectionAcquisitionEnd(Connection connection) {
|
public void jdbcConnectionAcquisitionEnd(Connection connection) {
|
||||||
for ( ConnectionObserver observer : observers ) {
|
observer.physicalConnectionObtained( connection );
|
||||||
observer.physicalConnectionObtained( connection );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -44,9 +41,7 @@ public class JdbcObserverImpl implements JdbcObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void jdbcConnectionReleaseEnd() {
|
public void jdbcConnectionReleaseEnd() {
|
||||||
for ( ConnectionObserver observer : observers ) {
|
observer.physicalConnectionReleased();
|
||||||
observer.physicalConnectionReleased();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -56,9 +51,7 @@ public class JdbcObserverImpl implements JdbcObserver {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void jdbcPrepareStatementEnd() {
|
public void jdbcPrepareStatementEnd() {
|
||||||
for ( ConnectionObserver observer : observers ) {
|
observer.statementPrepared();
|
||||||
observer.statementPrepared();
|
|
||||||
}
|
|
||||||
session.getEventListenerManager().jdbcPrepareStatementEnd();
|
session.getEventListenerManager().jdbcPrepareStatementEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,11 @@ package org.hibernate.resource.jdbc.spi;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @deprecated It is no longer possible to plug custom implementations of
|
||||||
|
* this SPI. It will be removed.
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface JdbcObserver {
|
public interface JdbcObserver {
|
||||||
public void jdbcConnectionAcquisitionStart();
|
public void jdbcConnectionAcquisitionStart();
|
||||||
public void jdbcConnectionAcquisitionEnd(Connection connection);
|
public void jdbcConnectionAcquisitionEnd(Connection connection);
|
||||||
|
|
Loading…
Reference in New Issue