org.hibernate.engine.spi
Class ActionQueue

java.lang.Object
  extended by org.hibernate.engine.spi.ActionQueue

public class ActionQueue
extends Object

Responsible for maintaining the queue of actions related to events. The ActionQueue holds the DML operations queued as part of a session's transactional-write-behind semantics. DML operations are queued here until a flush forces them to be executed against the database.


Constructor Summary
ActionQueue(SessionImplementor session)
          Constructs an action queue bound to the given session.
 
Method Summary
 void addAction(BulkOperationCleanupAction cleanupAction)
           
 void addAction(CollectionRecreateAction action)
           
 void addAction(CollectionRemoveAction action)
           
 void addAction(CollectionUpdateAction action)
           
 void addAction(EntityDeleteAction action)
           
 void addAction(EntityIdentityInsertAction insert)
           
 void addAction(EntityInsertAction action)
           
 void addAction(EntityUpdateAction action)
           
 void addAction(OrphanRemovalAction action)
           
 void addAction(QueuedOperationCollectionAction 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(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)
           
 ArrayList cloneDeletions()
           
static ActionQueue deserialize(ObjectInputStream ois, SessionImplementor session)
          Used by the owning session to explicitly control deserialization of the action queue
 void execute(Executable executable)
           
 void executeActions()
          Perform all currently queued actions.
 void executeInserts()
          Perform all currently queued entity-insertion actions.
 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 sortActions()
           
 void sortCollectionActions()
           
 String toString()
          Returns a string representation of the object.
 void unScheduleDeletion(EntityEntry entry, Object rescuedEntity)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActionQueue

public ActionQueue(SessionImplementor session)
Constructs an action queue bound to the given session.

Parameters:
session - The session "owning" this queue.
Method Detail

clear

public void clear()

addAction

public void addAction(EntityInsertAction action)

addAction

public void addAction(EntityDeleteAction action)

addAction

public void addAction(OrphanRemovalAction action)

addAction

public void addAction(EntityUpdateAction action)

addAction

public void addAction(CollectionRecreateAction action)

addAction

public void addAction(CollectionRemoveAction action)

addAction

public void addAction(CollectionUpdateAction action)

addAction

public void addAction(QueuedOperationCollectionAction action)

addAction

public void addAction(EntityIdentityInsertAction insert)

hasUnresolvedEntityInsertActions

public boolean hasUnresolvedEntityInsertActions()
Are there unresolved entity insert actions that depend on non-nullable associations with a transient entity?

Returns:
true, if there are unresolved entity insert actions that depend on non-nullable associations with a transient entity; false, otherwise

checkNoUnresolvedActionsAfterOperation

public void checkNoUnresolvedActionsAfterOperation()
                                            throws PropertyValueException
Throws 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.

Throws:
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.

addAction

public void addAction(BulkOperationCleanupAction cleanupAction)

registerProcess

public void registerProcess(AfterTransactionCompletionProcess process)

registerProcess

public void registerProcess(BeforeTransactionCompletionProcess process)

executeInserts

public void executeInserts()
                    throws HibernateException
Perform all currently queued entity-insertion actions.

Throws:
HibernateException - error executing queued insertion actions.

executeActions

public void executeActions()
                    throws HibernateException
Perform all currently queued actions.

Throws:
HibernateException - error executing queued actions.

prepareActions

public void prepareActions()
                    throws HibernateException
Prepares the internal action queues for execution.

Throws:
HibernateException - error preparing actions.

afterTransactionCompletion

public void afterTransactionCompletion(boolean success)
Performs cleanup of any held cache softlocks.

Parameters:
success - Was the transaction successful.

beforeTransactionCompletion

public void beforeTransactionCompletion()
Execute any registered BeforeTransactionCompletionProcess


areTablesToBeUpdated

public boolean areTablesToBeUpdated(Set tables)
Check whether the given tables/query-spaces are to be executed against given the currently queued actions.

Parameters:
tables - The table/query-spaces to check.
Returns:
True if we contain pending actions against any of the given tables; false otherwise.

areInsertionsOrDeletionsQueued

public boolean areInsertionsOrDeletionsQueued()
Check whether any insertion or deletion actions are currently queued.

Returns:
True if insertions or deletions are currently queued; false otherwise.

execute

public void execute(Executable executable)

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object.

numberOfCollectionRemovals

public int numberOfCollectionRemovals()

numberOfCollectionUpdates

public int numberOfCollectionUpdates()

numberOfCollectionCreations

public int numberOfCollectionCreations()

numberOfDeletions

public int numberOfDeletions()

numberOfUpdates

public int numberOfUpdates()

numberOfInsertions

public int numberOfInsertions()

sortCollectionActions

public void sortCollectionActions()

sortActions

public void sortActions()

cloneDeletions

public ArrayList cloneDeletions()

clearFromFlushNeededCheck

public void clearFromFlushNeededCheck(int previousCollectionRemovalSize)

hasAfterTransactionActions

public boolean hasAfterTransactionActions()

hasBeforeTransactionActions

public boolean hasBeforeTransactionActions()

hasAnyQueuedActions

public boolean hasAnyQueuedActions()

unScheduleDeletion

public void unScheduleDeletion(EntityEntry entry,
                               Object rescuedEntity)

serialize

public void serialize(ObjectOutputStream oos)
               throws IOException
Used by the owning session to explicitly control serialization of the action queue

Parameters:
oos - The stream to which the action queue should get written
Throws:
IOException - Indicates an error writing to the stream

deserialize

public static ActionQueue deserialize(ObjectInputStream ois,
                                      SessionImplementor session)
                               throws IOException,
                                      ClassNotFoundException
Used by the owning session to explicitly control deserialization of the action queue

Parameters:
ois - The stream from which to read the action queue
session - The session to which the action queue belongs
Returns:
The deserialized action queue
Throws:
IOException - indicates a problem reading from the stream
ClassNotFoundException - Generally means we were unable to locate user classes.


Copyright © 2001-2015 Red Hat, Inc. All Rights Reserved.