public List<SessionEventListener> buildBaselineList() { List<SessionEventListener> list = new ArrayList<SessionEventListener>(); if ( logSessionMetrics && StatisticalLoggingSessionEventListener.isLoggingEnabled() ) { list.add( new StatisticalLoggingSessionEventListener() ); } if ( autoListener != null ) { try { list.add( autoListener.newInstance() ); } catch (Exception e) { throw new HibernateException( "Unable to instantiate specified auto SessionEventListener : " + autoListener.getName(), e ); } } return list; }
@Override public Session openSession() { log.tracef( "Opening Hibernate Session. tenant=%s, owner=%s", tenantIdentifier, sessionOwner ); final SessionImpl session = new SessionImpl( connection, sessionFactory, sessionOwner, getTransactionCoordinator(), getTransactionCompletionProcesses(), autoJoinTransactions, sessionFactory.settings.getRegionFactory().nextTimestamp(), interceptor, flushBeforeCompletion, autoClose, connectionReleaseMode, tenantIdentifier ); for ( SessionEventListener listener : listeners ) { session.getEventListenerManager().addListener( listener ); } return session; }
public void addListener(SessionEventListener... listeners) { if ( listenerList == null ) { listenerList = new ArrayList<SessionEventListener>(); } java.util.Collections.addAll( listenerList, listeners ); }
@Override public void transactionCompletion(boolean successful) { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.transactionCompletion( successful ); } }
@Override public void jdbcConnectionAcquisitionStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcConnectionAcquisitionStart(); } }
@Override public void jdbcConnectionAcquisitionEnd() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcConnectionAcquisitionEnd(); } }
@Override public void jdbcConnectionReleaseStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcConnectionReleaseStart(); } }
@Override public void jdbcConnectionReleaseEnd() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcConnectionReleaseEnd(); } }
@Override public void jdbcPrepareStatementStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcPrepareStatementStart(); } }
@Override public void jdbcPrepareStatementEnd() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcPrepareStatementEnd(); } }
@Override public void jdbcExecuteStatementStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcExecuteStatementStart(); } }
@Override public void jdbcExecuteStatementEnd() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcExecuteStatementEnd(); } }
@Override public void jdbcExecuteBatchStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcExecuteBatchStart(); } }
@Override public void jdbcExecuteBatchEnd() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.jdbcExecuteBatchEnd(); } }
@Override public void cachePutStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.cachePutStart(); } }
@Override public void cachePutEnd() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.cachePutEnd(); } }
@Override public void cacheGetStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.cacheGetStart(); } }
@Override public void cacheGetEnd(boolean hit) { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.cacheGetEnd( hit ); } }
@Override public void flushStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.flushStart(); } }
@Override public void flushEnd(int numberOfEntities, int numberOfCollections) { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.flushEnd( numberOfEntities, numberOfCollections ); } }
@Override public void partialFlushStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.partialFlushStart(); } }
@Override public void partialFlushEnd(int numberOfEntities, int numberOfCollections) { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.partialFlushEnd( numberOfEntities, numberOfCollections ); } }
@Override public void dirtyCalculationStart() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.dirtyCalculationStart(); } }
@Override public void dirtyCalculationEnd(boolean dirty) { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.dirtyCalculationEnd( dirty ); } }
@Override public void end() { if ( listenerList == null ) { return; } for ( SessionEventListener listener : listenerList ) { listener.end(); } }
void addAction(SessionEventListener... listeners) throws HibernateException { final Session session = sessionProvider.get(); if (session.getTransaction().getStatus() != TransactionStatus.ACTIVE) throw new IllegalStateException("Cannot add transaction action with no active transaction!"); session.addEventListeners(listeners); }
public BaselineSessionEventsListenerBuilder( boolean logSessionMetrics, Class<? extends SessionEventListener> autoListener) { this.logSessionMetrics = logSessionMetrics; this.autoListener = autoListener; }
@SuppressWarnings("UnusedDeclaration") public Class<? extends SessionEventListener> getAutoListener() { return autoListener; }
@SuppressWarnings("UnusedDeclaration") public void setAutoListener(Class<? extends SessionEventListener> autoListener) { this.autoListener = autoListener; }
@Override public void addEventListeners(SessionEventListener... listeners) { session.addEventListeners( listeners ); }
@Override public void addEventListeners(SessionEventListener... listeners) { getEventListenerManager().addListener( listeners ); }
@Override public SharedSessionBuilder eventListeners(SessionEventListener... listeners) { super.eventListeners( listeners ); return this; }
private NonContextualJdbcConnectionAccess( SessionEventListener listener, ConnectionProvider connectionProvider) { this.listener = listener; this.connectionProvider = connectionProvider; }
private ContextualJdbcConnectionAccess( SessionEventListener listener, MultiTenantConnectionProvider connectionProvider) { this.listener = listener; this.connectionProvider = connectionProvider; }
@Override public SessionBuilder eventListeners(SessionEventListener... listeners) { Collections.addAll( this.listeners, listeners ); return this; }