#include <coherence/util/AbstractConcurrentQueue.hpp>
Inherited by DualQueue.
Note: The ConcurrentQueue does not support null entries.
NativeAtomic32 | 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. | |
NativeAtomic32 | m_nElementCounter |
A counter for maintaining the size of the queue. | |
FinalHandle< Object > | f_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. |
enum FlushState |
The FlushState values are used to indicate the state of the Queue with regards to flushing:.
virtual bool isFlushPending | ( | ) | const [virtual] |
Return whether a flush is pending or not.
virtual void setBatchSize | ( | int32_t | cBatch | ) | [virtual] |
Set the batch size of the queue.
cBatch | the batch size to set |
virtual int32_t getBatchSize | ( | ) | const [virtual] |
Return the batch size of the queue.
virtual Object::Handle getNotifier | ( | ) | [virtual] |
Return the object used for notifications on this queue.
virtual void setNotifier | ( | Object::Handle | hNotifier | ) | [virtual] |
Set the object used for notifications on this queue.
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.
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.
virtual int64_t getStatsFlushed | ( | ) | const [virtual] |
Return 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.
cElements | the number of elements in the queue after the addition |
virtual void flush | ( | bool | fAuto | ) | [protected, virtual] |
Flush the queue.
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.
nState | the state to set |
virtual FlushState updateFlushStateConditionally | ( | FlushState | nStateAssumed, | |
FlushState | nStateNew | |||
) | [protected, virtual] |
Set the flush state iff the assumed state is correct, return the previous flushState.
nStateAssumed | the assumed current value of the flush state | |
nStateNew | the new flush state value |
virtual void setStatsEmptied | ( | int64_t | cEmpties | ) | [protected, virtual] |
Set the total number of times the queue has been emptied.
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.
cFlushed | the total number of times the queue has been flushed |
NativeAtomic32 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.