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