public class ActionQueue extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ActionQueue.TransactionCompletionProcesses
Wrapper class allowing to bind the same transaction completion process queues in different sessions.
|
Constructor and Description |
---|
ActionQueue(SessionImplementor session)
Constructs an action queue bound to the given session.
|
Modifier and Type | Method and Description |
---|---|
void |
addAction(BulkOperationCleanupAction action)
Adds an action defining a cleanup relating to a bulk operation (HQL/JPQL or Criteria based update/delete)
|
void |
addAction(CollectionRecreateAction action)
Adds a collection (re)create action
|
void |
addAction(CollectionRemoveAction action)
Adds a collection remove action
|
void |
addAction(CollectionUpdateAction action)
Adds a collection update action
|
void |
addAction(EntityDeleteAction action)
Adds an entity delete action
|
void |
addAction(EntityIdentityInsertAction action)
Adds an entity (IDENTITY) insert action
|
void |
addAction(EntityInsertAction action)
Adds an entity insert action
|
void |
addAction(EntityUpdateAction action)
Adds an entity update action
|
void |
addAction(OrphanRemovalAction action)
Adds an orphan removal action
|
void |
addAction(QueuedOperationCollectionAction action)
Adds an action relating to a collection queued operation (extra lazy).
|
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(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 ActionQueue |
deserialize(ObjectInputStream ois,
SessionImplementor session)
Used by the owning session to explicitly control deserialization of the action queue.
|
<E extends Executable & Comparable<?>> |
execute(E executable) |
void |
executeActions()
Perform all currently queued actions.
|
void |
executeInserts()
Perform all currently queued entity-insertion actions.
|
ActionQueue.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(AfterTransactionCompletionProcess process) |
void |
registerProcess(BeforeTransactionCompletionProcess process) |
void |
serialize(ObjectOutputStream oos)
Used by the owning session to explicitly control serialization of the action queue
|
void |
setTransactionCompletionProcesses(ActionQueue.TransactionCompletionProcesses processes,
boolean isTransactionCoordinatorShared)
Bind transaction completion processes to make them shared between primary and secondary session.
|
void |
sortActions() |
void |
sortCollectionActions() |
String |
toString()
Returns a string representation of the object.
|
void |
unScheduleDeletion(EntityEntry entry,
Object rescuedEntity) |
public ActionQueue(SessionImplementor session)
session
- The session "owning" this queue.public void clear()
public void addAction(EntityInsertAction action)
action
- The action representing the entity insertionpublic void addAction(EntityIdentityInsertAction action)
action
- The action representing the entity insertionpublic void addAction(EntityDeleteAction action)
action
- The action representing the entity deletionpublic void addAction(OrphanRemovalAction action)
action
- The action representing the orphan removalpublic void addAction(EntityUpdateAction action)
action
- The action representing the entity updatepublic void addAction(CollectionRecreateAction action)
action
- The action representing the (re)creation of a collectionpublic void addAction(CollectionRemoveAction action)
action
- The action representing the removal of a collectionpublic void addAction(CollectionUpdateAction action)
action
- The action representing the update of a collectionpublic void addAction(QueuedOperationCollectionAction action)
action
- The action representing the queued operationpublic void addAction(BulkOperationCleanupAction action)
action
- The action representing the queued operationpublic boolean hasUnresolvedEntityInsertActions()
public void checkNoUnresolvedActionsAfterOperation() throws 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.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(AfterTransactionCompletionProcess process)
public void registerProcess(BeforeTransactionCompletionProcess process)
public void executeInserts() throws HibernateException
HibernateException
- error executing queued insertion actions.public void executeActions() throws HibernateException
HibernateException
- error executing queued actions.public void prepareActions() throws HibernateException
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(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 Executable & Comparable<?>> void execute(E executable)
executable
- The action to executepublic String toString()
public int numberOfCollectionRemovals()
public int numberOfCollectionUpdates()
public int numberOfCollectionCreations()
public int numberOfDeletions()
public int numberOfUpdates()
public int numberOfInsertions()
public ActionQueue.TransactionCompletionProcesses getTransactionCompletionProcesses()
public void setTransactionCompletionProcesses(ActionQueue.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(EntityEntry entry, Object rescuedEntity)
public void serialize(ObjectOutputStream oos) throws IOException
oos
- The stream to which the action queue should get writtenIOException
- Indicates an error writing to the streampublic static ActionQueue deserialize(ObjectInputStream ois, SessionImplementor session) throws IOException, ClassNotFoundException
ois
- The stream from which to read the action queuesession
- The session to which the action queue belongsIOException
- indicates a problem reading from the streamClassNotFoundException
- Generally means we were unable to locate user classes.Copyright © 2019 JBoss by Red Hat. All rights reserved.