clean up the package org.hibernate.engine.transaction
- it had classes/interfaces which are already unused in H5! - move TransactionObserver and IsolationDelegate to a much more sensible location next to TransactionCoordinator This will break custom implementations of TransactionCoordinator but I highly doubt there are very many of those!
This commit is contained in:
parent
c6f0be990c
commit
81a3541d26
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.engine.transaction.internal;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
|
||||
/**
|
||||
* Indicates an attempt to register a null synchronization. Basically a glorified {@link NullPointerException}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class NullSynchronizationException extends HibernateException {
|
||||
public NullSynchronizationException() {
|
||||
this( "Synchronization to register cannot be null" );
|
||||
}
|
||||
|
||||
public NullSynchronizationException(String s) {
|
||||
super( s );
|
||||
}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.engine.transaction.internal;
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import jakarta.transaction.Synchronization;
|
||||
|
||||
import org.hibernate.engine.transaction.spi.SynchronizationRegistry;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Manages a registry of {@link Synchronization}s.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated This appears to no longer be used
|
||||
*/
|
||||
@Deprecated(since = "6")
|
||||
public class SynchronizationRegistryImpl implements SynchronizationRegistry {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, SynchronizationRegistryImpl.class.getName() );
|
||||
|
||||
private LinkedHashSet<Synchronization> synchronizations;
|
||||
|
||||
@Override
|
||||
public void registerSynchronization(Synchronization synchronization) {
|
||||
if ( synchronization == null ) {
|
||||
throw new NullSynchronizationException();
|
||||
}
|
||||
|
||||
if ( synchronizations == null ) {
|
||||
synchronizations = new LinkedHashSet<>();
|
||||
}
|
||||
|
||||
boolean added = synchronizations.add( synchronization );
|
||||
if ( !added ) {
|
||||
LOG.synchronizationAlreadyRegistered( synchronization );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifySynchronizationsBeforeTransactionCompletion() {
|
||||
if ( synchronizations != null ) {
|
||||
for ( Synchronization synchronization : synchronizations ) {
|
||||
try {
|
||||
synchronization.beforeCompletion();
|
||||
}
|
||||
catch ( Throwable t ) {
|
||||
LOG.synchronizationFailed( synchronization, t );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifySynchronizationsAfterTransactionCompletion(int status) {
|
||||
if ( synchronizations != null ) {
|
||||
for ( Synchronization synchronization : synchronizations ) {
|
||||
try {
|
||||
synchronization.afterCompletion( status );
|
||||
}
|
||||
catch ( Throwable t ) {
|
||||
LOG.synchronizationFailed( synchronization, t );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Package-protected access to clear registered synchronizations.
|
||||
*/
|
||||
void clearSynchronizations() {
|
||||
if ( synchronizations != null ) {
|
||||
synchronizations.clear();
|
||||
synchronizations = null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.engine.transaction.spi;
|
||||
|
||||
/**
|
||||
* See the JPA notion of joining a transaction for details.
|
||||
*
|
||||
* @author Emmanuel Bernard
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated This is no longer used
|
||||
*/
|
||||
@Deprecated(since = "6", forRemoval = true)
|
||||
public enum JoinStatus {
|
||||
NOT_JOINED,
|
||||
MARKED_FOR_JOINED,
|
||||
JOINED
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.engine.transaction.spi;
|
||||
|
||||
import java.io.Serializable;
|
||||
import jakarta.transaction.Synchronization;
|
||||
|
||||
/**
|
||||
* Manages a registry of {@link Synchronization}s.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated This appears to no longer be used
|
||||
*/
|
||||
@Deprecated(since = "6")
|
||||
public interface SynchronizationRegistry extends Serializable {
|
||||
/**
|
||||
* Register a user {@link Synchronization} callback for this transaction.
|
||||
*
|
||||
* @param synchronization The synchronization callback to register.
|
||||
*
|
||||
* @throws org.hibernate.HibernateException
|
||||
*/
|
||||
void registerSynchronization(Synchronization synchronization);
|
||||
|
||||
/**
|
||||
* Delegate {@link Synchronization#beforeCompletion} calls to the {@linkplain #registerSynchronization registered}
|
||||
* {@link Synchronization}s
|
||||
*/
|
||||
void notifySynchronizationsBeforeTransactionCompletion();
|
||||
|
||||
/**
|
||||
* Delegate {@link Synchronization#afterCompletion} calls to {@linkplain #registerSynchronization registered}
|
||||
* {@link Synchronization}s
|
||||
*
|
||||
* @param status The transaction status (if known) per {@link jakarta.transaction.Status}
|
||||
*/
|
||||
void notifySynchronizationsAfterTransactionCompletion(int status);
|
||||
}
|
|
@ -7,33 +7,10 @@
|
|||
package org.hibernate.engine.transaction.spi;
|
||||
|
||||
/**
|
||||
* Observer of internal transaction events.
|
||||
* <p>
|
||||
* A {@link TransactionObserver} must be registered with the {@link org.hibernate.resource.transaction.spi.TransactionCoordinator}
|
||||
* by calling {@link org.hibernate.resource.transaction.spi.TransactionCoordinator#addObserver(TransactionObserver) addObserver()}.
|
||||
*
|
||||
* @apiNote It seems like this interface rightly belongs in {@link org.hibernate.resource.transaction.spi}.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*
|
||||
* @deprecated use {@link org.hibernate.resource.transaction.spi.TransactionObserver}
|
||||
*/
|
||||
public interface TransactionObserver {
|
||||
/**
|
||||
* Callback for processing the beginning of a transaction.
|
||||
* <p>
|
||||
* Do not rely on this being called as the transaction may be started in a manner other than through the
|
||||
* {@link org.hibernate.Transaction} API.
|
||||
*/
|
||||
void afterBegin();
|
||||
|
||||
/**
|
||||
* Callback for processing the initial phase of transaction completion.
|
||||
*/
|
||||
void beforeCompletion();
|
||||
|
||||
/**
|
||||
* Callback for processing the last phase of transaction completion.
|
||||
*
|
||||
* @param successful Was the transaction successful?
|
||||
*/
|
||||
void afterCompletion(boolean successful, boolean delayed);
|
||||
@Deprecated(since = "6")
|
||||
public interface TransactionObserver extends org.hibernate.resource.transaction.spi.TransactionObserver {
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
|
|||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.resource.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.metamodel.mapping.BasicValuedMapping;
|
||||
import org.hibernate.metamodel.mapping.EntityMappingType;
|
||||
import org.hibernate.metamodel.mapping.ModelPart;
|
||||
|
|
|
@ -13,7 +13,7 @@ import java.util.concurrent.Callable;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.resource.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.jdbc.WorkExecutor;
|
||||
|
|
|
@ -9,11 +9,11 @@ package org.hibernate.resource.transaction.backend.jdbc.internal;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.RollbackException;
|
||||
import jakarta.transaction.Status;
|
||||
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.engine.transaction.spi.TransactionObserver;
|
||||
import org.hibernate.resource.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.jpa.spi.JpaCompliance;
|
||||
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
||||
|
@ -24,6 +24,7 @@ import org.hibernate.resource.transaction.spi.SynchronizationRegistry;
|
|||
import org.hibernate.resource.transaction.spi.TransactionCoordinator;
|
||||
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
|
||||
import org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner;
|
||||
import org.hibernate.resource.transaction.spi.TransactionObserver;
|
||||
import org.hibernate.resource.transaction.spi.TransactionStatus;
|
||||
|
||||
import static org.hibernate.internal.CoreLogging.messageLogger;
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.concurrent.Callable;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.resource.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.ExceptionHelper;
|
||||
|
|
|
@ -16,8 +16,7 @@ import jakarta.transaction.UserTransaction;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform;
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.engine.transaction.spi.TransactionObserver;
|
||||
import org.hibernate.resource.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.jpa.spi.JpaCompliance;
|
||||
import org.hibernate.resource.jdbc.spi.JdbcSessionContext;
|
||||
import org.hibernate.resource.jdbc.spi.JdbcSessionOwner;
|
||||
|
@ -32,6 +31,7 @@ import org.hibernate.resource.transaction.spi.SynchronizationRegistry;
|
|||
import org.hibernate.resource.transaction.spi.TransactionCoordinator;
|
||||
import org.hibernate.resource.transaction.spi.TransactionCoordinatorBuilder;
|
||||
import org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner;
|
||||
import org.hibernate.resource.transaction.spi.TransactionObserver;
|
||||
import org.hibernate.resource.transaction.spi.TransactionStatus;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.engine.transaction.spi;
|
||||
package org.hibernate.resource.transaction.spi;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.jdbc.WorkExecutorVisitable;
|
|
@ -6,8 +6,6 @@
|
|||
*/
|
||||
package org.hibernate.resource.transaction.spi;
|
||||
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.engine.transaction.spi.TransactionObserver;
|
||||
import org.hibernate.jpa.spi.JpaCompliance;
|
||||
|
||||
/**
|
||||
|
@ -145,7 +143,5 @@ public interface TransactionCoordinator {
|
|||
// org.hibernate.Transaction that might be best done by:
|
||||
// 1) exposing registerSynchronization here (if the Transaction is just passed this)
|
||||
// 2) using the exposed TransactionCoordinator#getLocalSynchronizations (if the Transaction is passed the TransactionCoordinator)
|
||||
//
|
||||
// if
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.resource.transaction.spi;
|
||||
|
||||
/**
|
||||
* Observer of internal transaction events.
|
||||
* <p>
|
||||
* A {@link TransactionObserver} must be registered with the {@link TransactionCoordinator}
|
||||
* by calling {@link TransactionCoordinator#addObserver(TransactionObserver) addObserver()}.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface TransactionObserver {
|
||||
/**
|
||||
* Callback for processing the beginning of a transaction.
|
||||
* <p>
|
||||
* Do not rely on this being called as the transaction may be started
|
||||
* in some way other than via the {@link org.hibernate.Transaction} API.
|
||||
*/
|
||||
void afterBegin();
|
||||
|
||||
/**
|
||||
* Callback for processing the initial phase of transaction completion.
|
||||
*/
|
||||
void beforeCompletion();
|
||||
|
||||
/**
|
||||
* Callback for processing the last phase of transaction completion.
|
||||
*
|
||||
* @param successful Was the transaction successful?
|
||||
*/
|
||||
void afterCompletion(boolean successful, boolean delayed);
|
||||
}
|
Loading…
Reference in New Issue