public class ReactiveActionQueue
extends java.lang.Object
ActionQueue
, where DML
operations are queued before execution during a flush.Modifier and Type | Class and Description |
---|---|
static class |
ReactiveActionQueue.TransactionCompletionProcesses
Wrapper class allowing to bind the same transaction completion process queues in different sessions.
|
Constructor and Description |
---|
ReactiveActionQueue(org.hibernate.engine.spi.SessionImplementor session)
Constructs an action queue bound to the given session.
|
Modifier and Type | Method and Description |
---|---|
void |
addAction(org.hibernate.action.internal.BulkOperationCleanupAction action)
Adds an action defining a cleanup relating to a bulk operation (HQL/JPQL or Criteria based update/delete)
|
void |
addAction(org.hibernate.action.internal.CollectionRecreateAction action)
Adds a collection (re)create action
|
void |
addAction(org.hibernate.action.internal.CollectionRemoveAction action)
Adds a collection remove action
|
void |
addAction(org.hibernate.action.internal.CollectionUpdateAction action)
Adds a collection update action
|
void |
addAction(org.hibernate.action.internal.OrphanRemovalAction action)
Adds an orphan removal action
|
void |
addAction(org.hibernate.action.internal.QueuedOperationCollectionAction action)
Adds an action relating to a collection queued operation (extra lazy).
|
void |
addAction(ReactiveEntityDeleteAction action)
Adds an entity delete action
|
java.util.concurrent.CompletionStage<java.lang.Void> |
addAction(ReactiveEntityIdentityInsertAction action)
Adds an entity (IDENTITY) insert action
|
java.util.concurrent.CompletionStage<java.lang.Void> |
addAction(ReactiveEntityRegularInsertAction action) |
void |
addAction(ReactiveEntityUpdateAction action)
Adds an entity update action
|
void |
afterTransactionCompletion(boolean success)
Performs cleanup of any held cache softlocks.
|
boolean |
areInsertionsOrDeletionsQueued()
Check whether any insertion or deletion actions are currently queued.
|
boolean |
areTablesToBeUpdated(java.util.Set tables)
Check whether the given tables/query-spaces are to be executed against given the currently queued actions.
|
void |
beforeTransactionCompletion()
Execute any registered
BeforeTransactionCompletionProcess |
void |
checkNoUnresolvedActionsAfterOperation()
Throws
PropertyValueException if there are any unresolved entity insert actions that depend
on non-nullable associations with a transient entity. |
void |
clear() |
void |
clearFromFlushNeededCheck(int previousCollectionRemovalSize) |
static ReactiveActionQueue |
deserialize(java.io.ObjectInputStream ois,
org.hibernate.engine.spi.SessionImplementor session)
Used by the owning session to explicitly control deserialization of the action queue.
|
<E extends ReactiveExecutable> |
execute(E executable) |
java.util.concurrent.CompletionStage<java.lang.Void> |
executeActions()
Perform all currently queued actions.
|
java.util.concurrent.CompletionStage<java.lang.Void> |
executeInserts()
Perform all currently queued entity-insertion actions.
|
ReactiveActionQueue.TransactionCompletionProcesses |
getTransactionCompletionProcesses() |
boolean |
hasAfterTransactionActions() |
boolean |
hasAnyQueuedActions() |
boolean |
hasBeforeTransactionActions() |
boolean |
hasUnresolvedEntityInsertActions()
Are there unresolved entity insert actions that depend on non-nullable associations with a transient entity?
|
int |
numberOfCollectionCreations() |
int |
numberOfCollectionRemovals() |
int |
numberOfCollectionUpdates() |
int |
numberOfDeletions() |
int |
numberOfInsertions() |
int |
numberOfUpdates() |
void |
prepareActions()
Prepares the internal action queues for execution.
|
void |
registerProcess(org.hibernate.action.spi.AfterTransactionCompletionProcess process) |
void |
registerProcess(org.hibernate.action.spi.BeforeTransactionCompletionProcess process) |
void |
serialize(java.io.ObjectOutputStream oos)
Used by the owning session to explicitly control serialization of the action queue
|
void |
setTransactionCompletionProcesses(ReactiveActionQueue.TransactionCompletionProcesses processes,
boolean isTransactionCoordinatorShared)
Bind transaction completion processes to make them shared between primary and secondary session.
|
void |
sortActions() |
void |
sortCollectionActions() |
java.lang.String |
toString()
Returns a string representation of the object.
|
void |
unScheduleDeletion(org.hibernate.engine.spi.EntityEntry entry,
java.lang.Object rescuedEntity) |
public ReactiveActionQueue(org.hibernate.engine.spi.SessionImplementor session)
session
- The session "owning" this queue.public static ReactiveActionQueue deserialize(java.io.ObjectInputStream ois, org.hibernate.engine.spi.SessionImplementor session) throws java.io.IOException, java.lang.ClassNotFoundException
ois
- The stream from which to read the action queuesession
- The session to which the action queue belongsjava.io.IOException
- indicates a problem reading from the streamjava.lang.ClassNotFoundException
- Generally means we were unable to locate user classes.public void clear()
public java.util.concurrent.CompletionStage<java.lang.Void> addAction(ReactiveEntityRegularInsertAction action)
public java.util.concurrent.CompletionStage<java.lang.Void> addAction(ReactiveEntityIdentityInsertAction action)
action
- The action representing the entity insertionpublic void addAction(ReactiveEntityDeleteAction action)
action
- The action representing the entity deletionpublic void addAction(org.hibernate.action.internal.OrphanRemovalAction action)
action
- The action representing the orphan removalpublic void addAction(ReactiveEntityUpdateAction action)
action
- The action representing the entity updatepublic void addAction(org.hibernate.action.internal.CollectionRecreateAction action)
action
- The action representing the (re)creation of a collectionpublic void addAction(org.hibernate.action.internal.CollectionRemoveAction action)
action
- The action representing the removal of a collectionpublic void addAction(org.hibernate.action.internal.CollectionUpdateAction action)
action
- The action representing the update of a collectionpublic void addAction(org.hibernate.action.internal.QueuedOperationCollectionAction action)
action
- The action representing the queued operationpublic void addAction(org.hibernate.action.internal.BulkOperationCleanupAction action)
action
- The action representing the queued operationpublic boolean hasUnresolvedEntityInsertActions()
public void checkNoUnresolvedActionsAfterOperation() throws org.hibernate.PropertyValueException
PropertyValueException
if there are any unresolved entity insert actions that depend
on non-nullable associations with a transient entity. This method should be called on completion of an operation
(after all cascades are completed) that saves an entity.org.hibernate.PropertyValueException
- if there are any unresolved entity insert actions;
PropertyValueException.getEntityName()
and
PropertyValueException.getPropertyName()
will return the entity name and property value for
the first unresolved entity insert action.public void registerProcess(org.hibernate.action.spi.AfterTransactionCompletionProcess process)
public void registerProcess(org.hibernate.action.spi.BeforeTransactionCompletionProcess process)
public java.util.concurrent.CompletionStage<java.lang.Void> executeInserts()
org.hibernate.HibernateException
- error executing queued insertion actions.public java.util.concurrent.CompletionStage<java.lang.Void> executeActions()
org.hibernate.HibernateException
- error executing queued actions.public void prepareActions() throws org.hibernate.HibernateException
org.hibernate.HibernateException
- error preparing actions.public void afterTransactionCompletion(boolean success)
success
- Was the transaction successful.public void beforeTransactionCompletion()
BeforeTransactionCompletionProcess
public boolean areInsertionsOrDeletionsQueued()
true
if insertions or deletions are currently queued; false
otherwise.public boolean areTablesToBeUpdated(java.util.Set tables)
tables
- The table/query-spaces to check.true
if we contain pending actions against any of the given tables; false
otherwise.public <E extends ReactiveExecutable> java.util.concurrent.CompletionStage<java.lang.Void> execute(E executable)
executable
- The action to executepublic java.lang.String toString()
toString
in class java.lang.Object
public int numberOfCollectionRemovals()
public int numberOfCollectionUpdates()
public int numberOfCollectionCreations()
public int numberOfDeletions()
public int numberOfUpdates()
public int numberOfInsertions()
public ReactiveActionQueue.TransactionCompletionProcesses getTransactionCompletionProcesses()
public void setTransactionCompletionProcesses(ReactiveActionQueue.TransactionCompletionProcesses processes, boolean isTransactionCoordinatorShared)
processes
- Transaction completion processes.isTransactionCoordinatorShared
- Flag indicating shared transaction context.public void sortCollectionActions()
public void sortActions()
public void clearFromFlushNeededCheck(int previousCollectionRemovalSize)
public boolean hasAfterTransactionActions()
public boolean hasBeforeTransactionActions()
public boolean hasAnyQueuedActions()
public void unScheduleDeletion(org.hibernate.engine.spi.EntityEntry entry, java.lang.Object rescuedEntity)
public void serialize(java.io.ObjectOutputStream oos) throws java.io.IOException
oos
- The stream to which the action queue should get writtenjava.io.IOException
- Indicates an error writing to the stream