Queue Class Reference

#include <coherence/util/Queue.hpp>

Inherits Object.

Inherited by AbstractConcurrentQueue [virtual].

List of all members.


Detailed Description

The Queue provides a means to efficiently (and in a thread-safe manner) queue received messages and messages to be sent.

Author:
nsa 2008.01.18

Public Types

typedef spec::Handle Handle
 Queue Handle definition.
typedef spec::View View
 Queue View definition.
typedef spec::Holder Holder
 Queue Holder definition.

Public Member Functions

virtual bool add (Object::Holder oh)=0
 Appends the specified element to the end of this queue.
virtual bool addHead (Object::Holder oh)=0
 Insert the specified element to the front of this queue.
virtual void flush ()=0
 Flush the queue.
virtual bool isEmpty () const =0
 Determine whether the Queue is empty or not.
virtual Object::Holder peekNoWait ()=0
 Returns the first element from the front of this Queue.
virtual Object::Holder remove ()=0
 Waits for and removes the first element from the front of this Queue.
virtual Object::Holder removeNoWait ()=0
 Removes and returns the first element from the front of this Queue.
virtual size32_t size () const =0
 Determine the number of elements in this Queue.

Member Function Documentation

virtual bool add ( Object::Holder  oh  )  [pure virtual]

Appends the specified element to the end of this queue.

Queues may place limitations on what types of elements may be added and should clearly specify in their documentation any restrictions.

Parameters:
oh element to be appended to this Queue
Returns:
true if the collection changed as a result of this call
Exceptions:
ClassCastException if the class of the specified element prevents it from being added to this Queue

Implemented in DualQueue.

virtual bool addHead ( Object::Holder  oh  )  [pure virtual]

Insert the specified element to the front of this queue.

Queues may place limitations on what types of elements may be added and should clearly specify in their documentation any restrictions.

Parameters:
oh element ot be prepended to this Queue
Returns:
true if the collection changed as a result of this call
Exceptions:
ClassCastException if the class of the specified element prevents it from being added to this Queue

Implemented in DualQueue.

virtual bool isEmpty (  )  const [pure virtual]

Determine whether the Queue is empty or not.

Returns:
true if the Queue is empty; false if not

Implemented in DualQueue.

virtual Object::Holder peekNoWait (  )  [pure virtual]

Returns the first element from the front of this Queue.

There is no blocking equivalent of this method as it would require notification to wake up from an empty Queue, and this would mean that the "add" and "addHead" methods would need to perform notifyAll over notify which has performance implications.

Returns:
the first element in the front of this Queue or null if the Queue is empty

Implemented in DualQueue.

virtual Object::Holder remove (  )  [pure virtual]

Waits for and removes the first element from the front of this Queue.

If the Queue is empty, this method will block until an element is in the Queue. The unblocking equivalent of this method is "removeNoWait".

Returns:
the first element in the front of this Queue

Implemented in AbstractConcurrentQueue.

virtual Object::Holder removeNoWait (  )  [pure virtual]

Removes and returns the first element from the front of this Queue.

The blocking equivalent of this method is "remove".

Returns:
the first element in the front of this Queue or NULL if the Queue is empty

Implemented in DualQueue.

virtual size32_t size (  )  const [pure virtual]

Determine the number of elements in this Queue.

The size of the Queue may change after the size is returned from this method.

Returns:
the number of elements in this Queue

Implemented in AbstractConcurrentQueue.


The documentation for this class was generated from the following file: Copyright (c) 2000-2008 Oracle. All rights reserved.