Oracle Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.1.2)

E26041-01

AbstractConcurrentQueue Class Reference

#include <coherence/util/AbstractConcurrentQueue.hpp>

Inherits Object, and Queue.

Inherited by DualQueue.

List of all members.


Detailed Description

The ConcurrentQueue provides a means to efficiently (and in a thread-safe manner) queue elements with minimal contention.

Note: The ConcurrentQueue does not support null entries.

Author:
nsa 2008.01.19
NativeAtomic64 m_nAtomicFlushState
 The AtomicLong used to maintain the FlushState.
int32_t m_iBatchSize
 The queue size at which to auto-flush the queue during an add operation.
NativeAtomic64 m_nElementCounter
 A counter for maintaining the size of the queue.
FinalHandle< Objectf_hNotifier
 The monitor on which notifications related to a queue addition will be performed.
int64_t m_lStatsEmptied
 The total number of times the queue transitioned to the empty state.
int64_t m_lStatusFlushed
 The total number of times the queue has been flushed.
bool m_fSelfNotifier
 Indicate whether the notifier references itself.
virtual void flush ()
 inheritDoc}
virtual size32_t size () const
 inheritDoc}
virtual Object::Holder remove ()
 inheritDoc}

Public Types

enum  FlushState
 The FlushState values are used to indicate the state of the Queue with regards to flushing:. More...
typedef spec::Handle Handle
 AbstractConcurrentQueue Handle definition.
typedef spec::View View
 AbstractConcurrentQueue View definition.
typedef spec::Holder Holder
 AbstractConcurrentQueue Holder definition.

Public Member Functions

virtual FlushState getFlushState () const
 Return the current flush state.
virtual bool isFlushPending () const
 Return whether a flush is pending or not.
virtual void setBatchSize (int32_t cBatch)
 Set the batch size of the queue.
virtual int32_t getBatchSize () const
 Return the batch size of the queue.
virtual Object::Handle getNotifier ()
 Return the object used for notifications on this queue.
virtual void setNotifier (Object::Handle hNotifier)
 Set the object used for notifications on this queue.
virtual void waitForEntry (int64_t cMillis)
 Wait for the queue to contain at least one entry.
virtual int64_t getStatsEmptied () const
 Return the total number of times the queue has been emptied.
virtual int64_t getStatsFlushed () const
 Return the total number of times the queue has been flushed.

Protected Member Functions

virtual void checkFlush (int32_t cElements)
 Check whether or not the flush (notify) is necessary.
virtual void flush (bool fAuto)
 Flush the queue.
virtual void onAddElement ()
 Event called each time an element is added to the queue.
virtual void onEmpty ()
 Event called when the queue becomes empty.
virtual FlushState updateFlushState (FlushState nState)
 Set the flush state and return the previous state.
virtual FlushState updateFlushStateConditionally (FlushState nStateAssumed, FlushState nStateNew)
 Set the flush state iff the assumed state is correct, return the previous flushState.
virtual void setStatsEmptied (int64_t cEmpties)
 Set the total number of times the queue has been emptied.
virtual void setStatsFlushed (int64_t cFlushed)
 Set the total number of times the queue has been flushed.

Member Enumeration Documentation

enum FlushState

The FlushState values are used to indicate the state of the Queue with regards to flushing:.


Member Function Documentation

virtual bool isFlushPending (  )  const [virtual]

Return whether a flush is pending or not.

Returns:
true if a flush is pending

virtual void setBatchSize ( int32_t  cBatch  )  [virtual]

Set the batch size of the queue.

Parameters:
cBatch the batch size to set

virtual int32_t getBatchSize (  )  const [virtual]

Return the batch size of the queue.

Returns:
the batch size of the queue

virtual Object::Handle getNotifier (  )  [virtual]

Return the object used for notifications on this queue.

Returns:
the object used for notifications on this queue.

virtual void setNotifier ( Object::Handle  hNotifier  )  [virtual]

Set the object used for notifications on this queue.

Parameters:
hNotifier the object used for notifications on this queue

virtual void waitForEntry ( int64_t  cMillis  )  [virtual]

Wait for the queue to contain at least one entry.

Note: By the time the method returns the entry may have already been removed by another thread.

Parameters:
cMillis the number of milliseconds to wait before returing without having been notified, or 0 to wait until notified

virtual int64_t getStatsEmptied (  )  const [virtual]

Return the total number of times the queue has been emptied.

Returns:
the total number of times the queue has been emptied.

virtual int64_t getStatsFlushed (  )  const [virtual]

Return the total number of times the queue has been flushed.

Returns:
the total number of times the queue has been flushed

virtual void checkFlush ( int32_t  cElements  )  [protected, virtual]

Check whether or not the flush (notify) is necessary.

This method is always called when a new item is added to the queue.

Parameters:
cElements the number of elements in the queue after the addition

virtual void flush ( bool  fAuto  )  [protected, virtual]

Flush the queue.

Parameters:
fAuto iff the flush was invoked automatically based on the notification batch size

virtual FlushState updateFlushState ( FlushState  nState  )  [protected, virtual]

Set the flush state and return the previous state.

Parameters:
nState the state to set
Returns:
the previous flush state

virtual FlushState updateFlushStateConditionally ( FlushState  nStateAssumed,
FlushState  nStateNew 
) [protected, virtual]

Set the flush state iff the assumed state is correct, return the previous flushState.

Parameters:
nStateAssumed the assumed current value of the flush state
nStateNew the new flush state value
Returns:
FlushState the old flush state value

virtual void setStatsEmptied ( int64_t  cEmpties  )  [protected, virtual]

Set the total number of times the queue has been emptied.

Parameters:
cEmpties the total number of times the queue has been flushed.

virtual void setStatsFlushed ( int64_t  cFlushed  )  [protected, virtual]

Set the total number of times the queue has been flushed.

Parameters:
cFlushed the total number of times the queue has been flushed


Member Data Documentation

NativeAtomic64 m_nAtomicFlushState [protected]

The AtomicLong used to maintain the FlushState.

See getFlushState() and setFlushState() helper methods.

int32_t m_iBatchSize [protected]

The queue size at which to auto-flush the queue during an add operation.

If the BatchSize is greater then one, the caller must externally call flush() when it has finished adding elements in order to ensure that they may be processed by any waiting consumer thread.

FinalHandle<Object> f_hNotifier [protected]

The monitor on which notifications related to a queue addition will be performed.

The default value is the Queue itself. The Notifier should not be changed while the queue is in use. If the Notifier is null then notification will be disabled.


The documentation for this class was generated from the following file:
Copyright © 2000, 2013, Oracle and/or its affiliates. All rights reserved.