HHH-7265 - ConcurrentModificationException in SynchronizationRegistryImpl.notifySynchronizationsAfterTransactionCompletion due to SynchronizationRegistryImpl.clearSynchronizations clearing SynchronizationRegistryImpl.synchronizations

This commit is contained in:
Steve Ebersole 2012-05-02 14:14:34 -05:00
parent 48665213ff
commit 23aa8875d8
8 changed files with 21 additions and 14 deletions

View File

@ -93,7 +93,11 @@ public interface SessionBuilder {
* @param autoClose Should the session be automatically closed
*
* @return {@code this}, for method chaining
*
* @deprecated Only integrations can specify autoClosing behavior of individual sessions. See
* {@link org.hibernate.engine.spi.SessionOwner}
*/
@Deprecated
public SessionBuilder autoClose(boolean autoClose);
/**

View File

@ -63,7 +63,11 @@ public interface SharedSessionBuilder extends SessionBuilder {
* Signifies that the autoClose flag from the original session should be used to create the new session
*
* @return {@code this}, for method chaining
*
* @deprecated For same reasons as {@link SessionBuilder#autoClose(boolean)} was deprecated. However, shared
* session builders can use {@link #autoClose(boolean)} since they do not "inherit" the owner.
*/
@Deprecated
public SharedSessionBuilder autoClose();
/**

View File

@ -24,7 +24,6 @@
package org.hibernate.engine.spi;
import org.hibernate.SessionBuilder;
import org.hibernate.SessionOwner;
/**
* Defines the internal contract between the <tt>SessionBuilder</tt> and other parts of

View File

@ -66,6 +66,9 @@ import org.hibernate.type.TypeResolver;
* @author Gavin King
*/
public interface SessionFactoryImplementor extends Mapping, SessionFactory {
@Override
public SessionBuilderImplementor withOptions();
/**
* Retrieve the {@link Type} resolver associated with this factory.
*

View File

@ -21,12 +21,14 @@
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*/
package org.hibernate;
package org.hibernate.engine.spi;
/**
* The contract for a session owner.
* The contract for a Session owner. Typically this is something that wraps the Session.
*
* @author Gail Badner
*
* @see SessionBuilderImplementor#owner
*/
public interface SessionOwner {
/**
@ -35,5 +37,4 @@ public interface SessionOwner {
* @return {@literal true}/{@literal false} appropriately.
*/
public boolean shouldAutoCloseSession();
}

View File

@ -59,7 +59,7 @@ import org.hibernate.Session;
import org.hibernate.SessionBuilder;
import org.hibernate.SessionFactory;
import org.hibernate.SessionFactoryObserver;
import org.hibernate.SessionOwner;
import org.hibernate.engine.spi.SessionOwner;
import org.hibernate.StatelessSession;
import org.hibernate.StatelessSessionBuilder;
import org.hibernate.TypeHelper;

View File

@ -73,7 +73,7 @@ import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.SessionBuilder;
import org.hibernate.SessionException;
import org.hibernate.SessionOwner;
import org.hibernate.engine.spi.SessionOwner;
import org.hibernate.SharedSessionBuilder;
import org.hibernate.SimpleNaturalIdLoadAccess;
import org.hibernate.Transaction;
@ -531,11 +531,11 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
if ( isClosed() ) {
return false;
}
else if ( isAutoCloseSessionEnabled() ) {
return true;
else if ( sessionOwner != null ) {
return sessionOwner.shouldAutoCloseSession();
}
else {
return sessionOwner != null && sessionOwner.shouldAutoCloseSession();
return isAutoCloseSessionEnabled();
}
}

View File

@ -27,21 +27,17 @@ import java.util.Map;
import javax.persistence.PersistenceContextType;
import javax.persistence.PersistenceException;
import javax.persistence.spi.PersistenceUnitTransactionType;
import javax.transaction.Synchronization;
import org.jboss.logging.Logger;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.Session;
import org.hibernate.SessionBuilder;
import org.hibernate.SessionOwner;
import org.hibernate.engine.spi.SessionOwner;
import org.hibernate.annotations.common.util.ReflectHelper;
import org.hibernate.cfg.Environment;
import org.hibernate.ejb.internal.EntityManagerMessageLogger;
import org.hibernate.engine.spi.SessionBuilderImplementor;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.internal.SessionFactoryImpl;
/**
* Hibernate implementation of {@link javax.persistence.EntityManager}.