org.datanucleus.store.types.queued
Class SCOOperationQueue

java.lang.Object
  extended by org.datanucleus.store.types.queued.SCOOperationQueue

public class SCOOperationQueue
extends Object

Queue of operations to be performed on second class collections/maps. When we are queueing operations until flush()/commit() they wait in this queue until the moment arrives for flushing to the datastore (and

performAll
is called). Note that this queue will contain all operations to be performed for an ExecutionContext, though currently (DN v3.2) will process them backing store by backing store, rather than in the order they necessarily came in.


Field Summary
protected static Localiser LOCALISER
           
protected  List<QueuedOperation> queuedOperations
           
 
Constructor Summary
SCOOperationQueue()
           
 
Method Summary
 void clear()
           
 void enqueue(QueuedOperation oper)
          Method to add the specified operation to the operation queue.
 List<QueuedOperation> getOperations()
          Method to provide access to inspect the queued operations.
protected static boolean isAddFollowedByRemoveOnSameSCO(Store store, ObjectProvider op, QueuedOperation currentOper, ListIterator<QueuedOperation> listIter)
          Convenience optimisation checker to return if the current operation is ADD of an element that is immediately REMOVED.
protected static boolean isPutFollowedByRemoveOnSameSCO(Store store, ObjectProvider op, QueuedOperation currentOper, ListIterator<QueuedOperation> listIter)
          Convenience optimisation checker to return if the current operation is PUT of a key that is immediately REMOVED.
protected static boolean isRemoveFollowedByAddOnSameSCO(Store store, ObjectProvider op, QueuedOperation currentOper, ListIterator<QueuedOperation> listIter)
          Convenience optimisation checker to return if the current operation is REMOVE of an element that is immediately ADDed.
 void performAll(Store store, ObjectProvider op)
          Method to perform all operations queued for the specified ObjectProvider and backing store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER

queuedOperations

protected List<QueuedOperation> queuedOperations
Constructor Detail

SCOOperationQueue

public SCOOperationQueue()
Method Detail

enqueue

public void enqueue(QueuedOperation oper)
Method to add the specified operation to the operation queue.

Parameters:
oper - Operation

clear

public void clear()

getOperations

public List<QueuedOperation> getOperations()
Method to provide access to inspect the queued operations. The returned list is unmodifiable.

Returns:
The queued operations

performAll

public void performAll(Store store,
                       ObjectProvider op)
Method to perform all operations queued for the specified ObjectProvider and backing store. Those operations are then removed from the queue.

Parameters:
store - The backing store
op - ObjectProvider

isAddFollowedByRemoveOnSameSCO

protected static boolean isAddFollowedByRemoveOnSameSCO(Store store,
                                                        ObjectProvider op,
                                                        QueuedOperation currentOper,
                                                        ListIterator<QueuedOperation> listIter)
Convenience optimisation checker to return if the current operation is ADD of an element that is immediately REMOVED. Always leaves the iterator at the same position as starting

Parameters:
store - The backing store
op - The object provider
currentOper - The current operation
listIter - The iterator of operations
Returns:
Whether this is an ADD that has a REMOVE of the same element immediately after

isRemoveFollowedByAddOnSameSCO

protected static boolean isRemoveFollowedByAddOnSameSCO(Store store,
                                                        ObjectProvider op,
                                                        QueuedOperation currentOper,
                                                        ListIterator<QueuedOperation> listIter)
Convenience optimisation checker to return if the current operation is REMOVE of an element that is immediately ADDed. Always leaves the iterator at the same position as starting

Parameters:
store - The backing store
op - The object provider
currentOper - The current operation
listIter - The iterator of operations
Returns:
Whether this is a REMOVE that has an ADD of the same element immediately after

isPutFollowedByRemoveOnSameSCO

protected static boolean isPutFollowedByRemoveOnSameSCO(Store store,
                                                        ObjectProvider op,
                                                        QueuedOperation currentOper,
                                                        ListIterator<QueuedOperation> listIter)
Convenience optimisation checker to return if the current operation is PUT of a key that is immediately REMOVED. Always leaves the iterator at the same position as starting

Parameters:
store - The backing store
op - The object provider
currentOper - The current operation
listIter - The iterator of operations
Returns:
Whether this is a PUT that has a REMOVE of the same key immediately after


Copyright © 2013. All Rights Reserved.