| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| <title>activemq-cpp-3.4.0: decaf::util::concurrent::BlockingQueue< E > Class Template Reference</title> |
| <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| <script type="text/javascript" src="jquery.js"></script> |
| <script type="text/javascript" src="navtree.js"></script> |
| <script type="text/javascript" src="resize.js"></script> |
| <script type="text/javascript"> |
| $(document).ready(initResizable); |
| </script> |
| <link href="doxygen.css" rel="stylesheet" type="text/css"/> |
| </head> |
| <body> |
| <!-- Generated by Doxygen 1.7.3 --> |
| <div id="top"> |
| <div id="titlearea"> |
| <table cellspacing="0" cellpadding="0"> |
| <tbody> |
| <tr style="height: 56px;"> |
| <td style="padding-left: 0.5em;"> |
| <div id="projectname">activemq-cpp-3.4.0</div> |
| </td> |
| </tr> |
| </tbody> |
| </table> |
| </div> |
| <div id="navrow1" class="tabs"> |
| <ul class="tablist"> |
| <li><a href="index.html"><span>Main Page</span></a></li> |
| <li><a href="namespaces.html"><span>Namespaces</span></a></li> |
| <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li> |
| <li><a href="files.html"><span>Files</span></a></li> |
| </ul> |
| </div> |
| <div id="navrow2" class="tabs2"> |
| <ul class="tablist"> |
| <li><a href="annotated.html"><span>Data Structures</span></a></li> |
| <li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li> |
| <li><a href="functions.html"><span>Data Fields</span></a></li> |
| </ul> |
| </div> |
| </div> |
| <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| <div id="nav-tree"> |
| <div id="nav-tree-contents"> |
| </div> |
| </div> |
| <div id="splitbar" style="-moz-user-select:none;" |
| class="ui-resizable-handle"> |
| </div> |
| </div> |
| <script type="text/javascript"> |
| initNavTree('classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html',''); |
| </script> |
| <div id="doc-content"> |
| <div class="header"> |
| <div class="summary"> |
| <a href="#pub-methods">Public Member Functions</a> </div> |
| <div class="headertitle"> |
| <h1>decaf::util::concurrent::BlockingQueue< E > Class Template Reference</h1> </div> |
| </div> |
| <div class="contents"> |
| <!-- doxytag: class="decaf::util::concurrent::BlockingQueue" --><!-- doxytag: inherits="decaf::util::AbstractQueue" --> |
| <p>A <a class="el" href="classdecaf_1_1util_1_1_queue.html" title="A kind of collection provides advanced operations than other basic collections, such as insertion...">decaf::util::Queue</a> that additionally supports operations that wait for the queue to become non-empty when retrieving an element, and wait for space to become available in the queue when storing an element. |
| <a href="#_details">More...</a></p> |
| |
| <p><code>#include <<a class="el" href="_blocking_queue_8h_source.html">src/main/decaf/util/concurrent/BlockingQueue.h</a>></code></p> |
| <div class="dynheader"> |
| Inheritance diagram for decaf::util::concurrent::BlockingQueue< E >:</div> |
| <div class="dyncontent"> |
| <div class="center"><img src="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue__inherit__graph.png" border="0" usemap="#decaf_1_1util_1_1concurrent_1_1_blocking_queue_3_01_e_01_4_inherit__map" alt="Inheritance graph"/></div> |
| <map name="decaf_1_1util_1_1concurrent_1_1_blocking_queue_3_01_e_01_4_inherit__map" id="decaf_1_1util_1_1concurrent_1_1_blocking_queue_3_01_e_01_4_inherit__map"> |
| <area shape="rect" id="node16" href="classdecaf_1_1util_1_1concurrent_1_1_linked_blocking_queue.html" title="A BlockingQueue derivative that allows for a bound to be placed on the number of elements that can be..." alt="" coords="1577,5,1943,35"/><area shape="rect" id="node18" href="classdecaf_1_1util_1_1concurrent_1_1_synchronous_queue.html" title="A blocking queue in which each insert operation must wait for a corresponding remove operation by ano..." alt="" coords="1584,59,1936,88"/><area shape="rect" id="node2" href="classdecaf_1_1util_1_1_abstract_queue.html" title="This class provides skeletal implementations of some Queue operations." alt="" coords="911,32,1153,61"/><area shape="rect" id="node4" href="classdecaf_1_1util_1_1_queue.html" title="A kind of collection provides advanced operations than other basic collections, such as insertion..." alt="" coords="636,5,820,35"/><area shape="rect" id="node6" href="classdecaf_1_1util_1_1_collection.html" title="The root interface in the collection hierarchy." alt="" coords="340,32,545,61"/><area shape="rect" id="node12" href="classdecaf_1_1util_1_1_abstract_collection.html" title="This class provides a skeletal implementation of the Collection interface, to minimize the effort req..." alt="" coords="595,59,861,88"/><area shape="rect" id="node8" href="classdecaf_1_1lang_1_1_iterable.html" title="Implementing this interface allows an object to be cast to an Iterable type for generic collections A..." alt="" coords="49,5,247,35"/><area shape="rect" id="node10" href="classdecaf_1_1util_1_1concurrent_1_1_synchronizable.html" title="The interface for all synchronizable objects (that is, objects that can be locked and unlocked)..." alt="" coords="5,59,291,88"/></map> |
| <center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div> |
| <table class="memberdecls"> |
| <tr><td colspan="2"><h2><a name="pub-methods"></a> |
| Public Member Functions</h2></td></tr> |
| <tr><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#a22445fea978c73373e372c415d55ce91">~BlockingQueue</a> ()</td></tr> |
| <tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#a109657d5c0181f631872e8533d5dcc09">put</a> (const E &value)=0</td></tr> |
| <tr><td class="mdescLeft"> </td><td class="mdescRight">Inserts the specified element into this queue, waiting if necessary for space to become available. <a href="#a109657d5c0181f631872e8533d5dcc09"></a><br/></td></tr> |
| <tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#a13c30e5dc2e330e7e0ecba7bac0d4d1c">offer</a> (const E &e, long long timeout, const <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_time_unit.html">TimeUnit</a> &unit)=0</td></tr> |
| <tr><td class="mdescLeft"> </td><td class="mdescRight">Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available. <a href="#a13c30e5dc2e330e7e0ecba7bac0d4d1c"></a><br/></td></tr> |
| <tr><td class="memItemLeft" align="right" valign="top">virtual E </td><td class="memItemRight" valign="bottom"><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#ae01d0599ddb1a0da802bbfef26c1b3dc">take</a> ()=0</td></tr> |
| <tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieves and removes the head of this queue, waiting if necessary until an element becomes available. <a href="#ae01d0599ddb1a0da802bbfef26c1b3dc"></a><br/></td></tr> |
| <tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#ada32b9d8fc257f4dde82c427aa445e81">poll</a> (E &result, long long timeout, const <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_time_unit.html">TimeUnit</a> &unit)=0</td></tr> |
| <tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available. <a href="#ada32b9d8fc257f4dde82c427aa445e81"></a><br/></td></tr> |
| <tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#af2f7fc6e2e973e9b7e7558c0add39d42">remainingCapacity</a> () const =0</td></tr> |
| <tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the number of additional elements that this queue can ideally (in the absence of memory or resource constraints) accept without blocking, or <code>Integer::MAX_VALUE</code> if there is no intrinsic limit. <a href="#af2f7fc6e2e973e9b7e7558c0add39d42"></a><br/></td></tr> |
| <tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#ae296a4cdb0aa17b1255d5bfbd1915549">drainTo</a> (<a class="el" href="classdecaf_1_1util_1_1_collection.html">Collection</a>< E > &c)=0</td></tr> |
| <tr><td class="mdescLeft"> </td><td class="mdescRight">Removes all available elements from this queue and adds them to the given collection. <a href="#ae296a4cdb0aa17b1255d5bfbd1915549"></a><br/></td></tr> |
| <tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#a02de5b804a7128865d178459c7e8a3ca">drainTo</a> (<a class="el" href="classdecaf_1_1util_1_1_collection.html">Collection</a>< E > &c, int maxElements)=0</td></tr> |
| <tr><td class="mdescLeft"> </td><td class="mdescRight">Removes at most the given number of available elements from this queue and adds them to the given collection. <a href="#a02de5b804a7128865d178459c7e8a3ca"></a><br/></td></tr> |
| </table> |
| <hr/><a name="_details"></a><h2>Detailed Description</h2> |
| <div class="textblock"><h3>template<typename E><br/> |
| class decaf::util::concurrent::BlockingQueue< E ></h3> |
| |
| <p>A <a class="el" href="classdecaf_1_1util_1_1_queue.html" title="A kind of collection provides advanced operations than other basic collections, such as insertion...">decaf::util::Queue</a> that additionally supports operations that wait for the queue to become non-empty when retrieving an element, and wait for space to become available in the queue when storing an element. </p> |
| <p><code><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a></code> methods come in four forms, with different ways of handling operations that cannot be satisfied immediately, but may be satisfied at some point in the future: one throws an exception, the second returns a special value (either <code>true</code> or <code>false</code>, depending on the operation), the third blocks the current thread indefinitely until the operation can succeed, and the fourth blocks for only a given maximum time limit before giving up. These methods are summarized in the following table:</p> |
| <table cellpadding="3" cellspacing="1"> |
| <tr> |
| <td></td><td align="CENTER"><em>Throws exception</em> </td><td align="CENTER"><em>Boolean Flag</em> </td><td align="CENTER"><em>Blocks</em> </td><td align="CENTER"><em>Times out</em> </td></tr> |
| <tr> |
| <td><b>Insert</b> </td><td><a class="el" href="classdecaf_1_1util_1_1_abstract_queue.html#a281d28a75ee76f4696644c9c56ca0070">add(e)</a> </td><td><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#a13c30e5dc2e330e7e0ecba7bac0d4d1c">offer(e)</a> </td><td><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#a109657d5c0181f631872e8533d5dcc09">put(e)</a> </td><td><a class="el" href="">offer(e, time, unit)</a> </td></tr> |
| <tr> |
| <td><b>Remove</b> </td><td><a class="el" href="classdecaf_1_1util_1_1_abstract_queue.html#abe6390cc567a624d545886b89c89975a">remove()</a> </td><td><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#ada32b9d8fc257f4dde82c427aa445e81">poll()</a> </td><td><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#ae01d0599ddb1a0da802bbfef26c1b3dc">take()</a> </td><td><a class="el" href="">poll(time, unit)</a> </td></tr> |
| <tr> |
| <td><b>Examine</b> </td><td><a class="el" href="classdecaf_1_1util_1_1_abstract_queue.html#a69e1b64fa43b083702f23ac3261ddadf">element()</a> </td><td><a class="el" href="classdecaf_1_1util_1_1_queue.html#a35c29d0f7a27e0bce583492dd90e5084">peek()</a> </td><td><em>not applicable</em> </td><td><em>not applicable</em> </td></tr> |
| </table> |
| <p>A <code><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a></code> may be capacity bounded. At any given time it may have a <code>remainingCapacity</code> beyond which no additional elements can be <code>put</code> without blocking. A <code><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a></code> without any intrinsic capacity constraints always reports a remaining capacity of <code>Integer::MAX_VALUE</code>.</p> |
| <p><code><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a></code> implementations are designed to be used primarily for producer-consumer queues, but additionally support <a class="el" href="classdecaf_1_1util_1_1_collection.html">decaf::util::Collection</a> interface. So, for example, it is possible to remove an arbitrary element from a queue using <code>remove(x)</code>. However, such operations are in general <em>not</em> performed very efficiently, and are intended for only occasional use, such as when a queued message is cancelled.</p> |
| <p><code><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a></code> implementations are thread-safe. All queuing methods achieve their effects atomically using internal locks or other forms of concurrency control. However, the <em>bulk</em> <a class="el" href="classdecaf_1_1util_1_1_collection.html" title="The root interface in the collection hierarchy.">Collection</a> operations <code>addAll</code>, <code>containsAll</code>, <code>retainAll</code> and <code>removeAll</code> are <em>not</em> necessarily performed atomically unless specified otherwise in an implementation. So it is possible, for example, for <code>addAll(c)</code> to fail (throwing an exception) after adding only some of the elements in <code>c</code>.</p> |
| <p>A <code><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a></code> does <em>not</em> intrinsically support any kind of "close" or "shutdown" operation to indicate that no more items will be added. The needs and usage of such features tend to be implementation-dependent. For example, a common tactic is for producers to insert special <em>end-of-stream</em> or <em>poison</em> objects, that are interpreted accordingly when taken by consumers.</p> |
| <p>Usage example, based on a typical producer-consumer scenario. Note that a <code><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a></code> can safely be used with multiple producers and multiple consumers. </p> |
| <pre> |
| class Producer : public Runnable { |
| private:</pre><pre> BlockingQueue* queue;</pre><pre> public:</pre><pre> Producer( BlockingQueue* q ) : queue( q ) {}</pre><pre> virtual void run() { |
| try { |
| while( true ) { queue->put( produce() ); } |
| } catch( InterruptedException& ex ) { ... handle ...} |
| }</pre><pre> Object produce() { ... } |
| }</pre><pre> class Consumer : public Runnable { |
| private:</pre><pre> BlockingQueue* queue;</pre><pre> public:</pre><pre> Consumer( BlockingQueue* q ) : queue( q ) {}</pre><pre> virtual void run() { |
| try { |
| while( true ) { consume( queue-><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html#ae01d0599ddb1a0da802bbfef26c1b3dc" title="Retrieves and removes the head of this queue, waiting if necessary until an element becomes available...">take()</a> ); } |
| } catch( InterruptedException& ex ) { ... handle ...} |
| }</pre><pre> void consume( Object& x ) { ... } |
| }</pre><pre> int main( int argc, char** argv ) {</pre><pre> <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a> q = new SomeQueueImplementation(); |
| Producer p( &q ); |
| Consumer c1( &q ); |
| Consumer c2( &q ); |
| Thread t1( &p ).start(); |
| Thread t2( &c1 ).start(); |
| Thread t3( &c2 ).start(); |
| } |
| </pre><p>Memory consistency effects: As with other concurrent collections, actions in a thread prior to placing an object into a <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a> <em>happen-before</em> actions subsequent to the access or removal of that element from the <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html" title="A decaf::util::Queue that additionally supports operations that wait for the queue to become non-empt...">BlockingQueue</a> in another thread.</p> |
| <dl class="since"><dt><b>Since:</b></dt><dd>1.0 </dd></dl> |
| </div><hr/><h2>Constructor & Destructor Documentation</h2> |
| <a class="anchor" id="a22445fea978c73373e372c415d55ce91"></a><!-- doxytag: member="decaf::util::concurrent::BlockingQueue::~BlockingQueue" ref="a22445fea978c73373e372c415d55ce91" args="()" --> |
| <div class="memitem"> |
| <div class="memproto"> |
| <div class="memtemplate"> |
| template<typename E> </div> |
| <table class="memname"> |
| <tr> |
| <td class="memname">virtual <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">decaf::util::concurrent::BlockingQueue</a>< E >::~<a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">BlockingQueue</a> </td> |
| <td>(</td> |
| <td class="paramname"></td><td>)</td> |
| <td><code> [inline, virtual]</code></td> |
| </tr> |
| </table> |
| </div> |
| <div class="memdoc"> |
| |
| </div> |
| </div> |
| <hr/><h2>Member Function Documentation</h2> |
| <a class="anchor" id="ae296a4cdb0aa17b1255d5bfbd1915549"></a><!-- doxytag: member="decaf::util::concurrent::BlockingQueue::drainTo" ref="ae296a4cdb0aa17b1255d5bfbd1915549" args="(Collection< E > &c)=0" --> |
| <div class="memitem"> |
| <div class="memproto"> |
| <div class="memtemplate"> |
| template<typename E> </div> |
| <table class="memname"> |
| <tr> |
| <td class="memname">virtual int <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">decaf::util::concurrent::BlockingQueue</a>< E >::drainTo </td> |
| <td>(</td> |
| <td class="paramtype"><a class="el" href="classdecaf_1_1util_1_1_collection.html">Collection</a>< E > & </td> |
| <td class="paramname"><em>c</em></td><td>)</td> |
| <td><code> [pure virtual]</code></td> |
| </tr> |
| </table> |
| </div> |
| <div class="memdoc"> |
| |
| <p>Removes all available elements from this queue and adds them to the given collection. </p> |
| <p>This operation may be more efficient than repeatedly polling this queue. A failure encountered while attempting to add elements to collection <code>c</code> may result in elements being in neither, either or both collections when the associated exception is thrown. Attempts to drain a queue to itself result in <code>IllegalArgumentException</code>. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.</p> |
| <dl><dt><b>Parameters:</b></dt><dd> |
| <table class="params"> |
| <tr><td class="paramname">c</td><td>the collection to transfer elements into </td></tr> |
| </table> |
| </dd> |
| </dl> |
| <dl class="return"><dt><b>Returns:</b></dt><dd>the number of elements transferred </dd></dl> |
| <dl><dt><b>Exceptions:</b></dt><dd> |
| <table class="exception"> |
| <tr><td class="paramname">UnsupportedOperationException</td><td>if addition of elements is not supported by the specified collection </td></tr> |
| <tr><td class="paramname">IllegalArgumentException</td><td>if the specified collection is this queue, or some property of an element of this queue prevents it from being added to the specified collection </td></tr> |
| </table> |
| </dd> |
| </dl> |
| |
| <p>Implemented in <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_linked_blocking_queue.html#af77f62ab4a4a83c391c5d87aef904e6c">decaf::util::concurrent::LinkedBlockingQueue< E ></a>, and <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_synchronous_queue.html#a5b0647a30d31fc130cc0daa2c2679cf9">decaf::util::concurrent::SynchronousQueue< E ></a>.</p> |
| |
| </div> |
| </div> |
| <a class="anchor" id="a02de5b804a7128865d178459c7e8a3ca"></a><!-- doxytag: member="decaf::util::concurrent::BlockingQueue::drainTo" ref="a02de5b804a7128865d178459c7e8a3ca" args="(Collection< E > &c, int maxElements)=0" --> |
| <div class="memitem"> |
| <div class="memproto"> |
| <div class="memtemplate"> |
| template<typename E> </div> |
| <table class="memname"> |
| <tr> |
| <td class="memname">virtual int <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">decaf::util::concurrent::BlockingQueue</a>< E >::drainTo </td> |
| <td>(</td> |
| <td class="paramtype"><a class="el" href="classdecaf_1_1util_1_1_collection.html">Collection</a>< E > & </td> |
| <td class="paramname"><em>c</em>, </td> |
| </tr> |
| <tr> |
| <td class="paramkey"></td> |
| <td></td> |
| <td class="paramtype">int </td> |
| <td class="paramname"><em>maxElements</em> </td> |
| </tr> |
| <tr> |
| <td></td> |
| <td>)</td> |
| <td></td><td><code> [pure virtual]</code></td> |
| </tr> |
| </table> |
| </div> |
| <div class="memdoc"> |
| |
| <p>Removes at most the given number of available elements from this queue and adds them to the given collection. </p> |
| <p>A failure encountered while attempting to add elements to collection <code>c</code> may result in elements being in neither, either or both collections when the associated exception is thrown. Attempts to drain a queue to itself result in <code>IllegalArgumentException</code>. Further, the behavior of this operation is undefined if the specified collection is modified while the operation is in progress.</p> |
| <dl><dt><b>Parameters:</b></dt><dd> |
| <table class="params"> |
| <tr><td class="paramname">c</td><td>the collection to transfer elements into </td></tr> |
| <tr><td class="paramname">maxElements</td><td>the maximum number of elements to transfer </td></tr> |
| </table> |
| </dd> |
| </dl> |
| <dl class="return"><dt><b>Returns:</b></dt><dd>the number of elements transferred </dd></dl> |
| <dl><dt><b>Exceptions:</b></dt><dd> |
| <table class="exception"> |
| <tr><td class="paramname">UnsupportedOperationException</td><td>if addition of elements is not supported by the specified collection </td></tr> |
| <tr><td class="paramname">IllegalArgumentException</td><td>if the specified collection is this queue, or some property of an element of this queue prevents it from being added to the specified collection </td></tr> |
| </table> |
| </dd> |
| </dl> |
| |
| <p>Implemented in <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_linked_blocking_queue.html#a24ddcddd07320e59f5726567f857cacc">decaf::util::concurrent::LinkedBlockingQueue< E ></a>, and <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_synchronous_queue.html#a16122744149fa45ec628e6a2a24111b4">decaf::util::concurrent::SynchronousQueue< E ></a>.</p> |
| |
| </div> |
| </div> |
| <a class="anchor" id="a13c30e5dc2e330e7e0ecba7bac0d4d1c"></a><!-- doxytag: member="decaf::util::concurrent::BlockingQueue::offer" ref="a13c30e5dc2e330e7e0ecba7bac0d4d1c" args="(const E &e, long long timeout, const TimeUnit &unit)=0" --> |
| <div class="memitem"> |
| <div class="memproto"> |
| <div class="memtemplate"> |
| template<typename E> </div> |
| <table class="memname"> |
| <tr> |
| <td class="memname">virtual bool <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">decaf::util::concurrent::BlockingQueue</a>< E >::offer </td> |
| <td>(</td> |
| <td class="paramtype">const E & </td> |
| <td class="paramname"><em>e</em>, </td> |
| </tr> |
| <tr> |
| <td class="paramkey"></td> |
| <td></td> |
| <td class="paramtype">long long </td> |
| <td class="paramname"><em>timeout</em>, </td> |
| </tr> |
| <tr> |
| <td class="paramkey"></td> |
| <td></td> |
| <td class="paramtype">const <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_time_unit.html">TimeUnit</a> & </td> |
| <td class="paramname"><em>unit</em> </td> |
| </tr> |
| <tr> |
| <td></td> |
| <td>)</td> |
| <td></td><td><code> [pure virtual]</code></td> |
| </tr> |
| </table> |
| </div> |
| <div class="memdoc"> |
| |
| <p>Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to become available. </p> |
| <dl><dt><b>Parameters:</b></dt><dd> |
| <table class="params"> |
| <tr><td class="paramname">e</td><td>the element to add </td></tr> |
| <tr><td class="paramname">timeout</td><td>how long to wait before giving up, in units of <code>unit</code> </td></tr> |
| <tr><td class="paramname">unit</td><td>a <code><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_time_unit.html" title="A TimeUnit represents time durations at a given unit of granularity and provides utility methods to c...">TimeUnit</a></code> determining how to interpret the <code>timeout</code> parameter</td></tr> |
| </table> |
| </dd> |
| </dl> |
| <dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if successful, or <code>false</code> if the specified waiting time elapses before space is available</dd></dl> |
| <dl><dt><b>Exceptions:</b></dt><dd> |
| <table class="exception"> |
| <tr><td class="paramname">InterruptedException</td><td>if interrupted while waiting </td></tr> |
| <tr><td class="paramname">NullPointerException</td><td>if the specified element is null </td></tr> |
| <tr><td class="paramname">IllegalArgumentException</td><td>if some property of the specified element prevents it from being added to this queue </td></tr> |
| </table> |
| </dd> |
| </dl> |
| |
| <p>Implemented in <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_linked_blocking_queue.html#acc422303761c38f07b340cdc341d7149">decaf::util::concurrent::LinkedBlockingQueue< E ></a>, and <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_synchronous_queue.html#a9df7b8c7344207dd5949638e833d21f5">decaf::util::concurrent::SynchronousQueue< E ></a>.</p> |
| |
| </div> |
| </div> |
| <a class="anchor" id="ada32b9d8fc257f4dde82c427aa445e81"></a><!-- doxytag: member="decaf::util::concurrent::BlockingQueue::poll" ref="ada32b9d8fc257f4dde82c427aa445e81" args="(E &result, long long timeout, const TimeUnit &unit)=0" --> |
| <div class="memitem"> |
| <div class="memproto"> |
| <div class="memtemplate"> |
| template<typename E> </div> |
| <table class="memname"> |
| <tr> |
| <td class="memname">virtual bool <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">decaf::util::concurrent::BlockingQueue</a>< E >::poll </td> |
| <td>(</td> |
| <td class="paramtype">E & </td> |
| <td class="paramname"><em>result</em>, </td> |
| </tr> |
| <tr> |
| <td class="paramkey"></td> |
| <td></td> |
| <td class="paramtype">long long </td> |
| <td class="paramname"><em>timeout</em>, </td> |
| </tr> |
| <tr> |
| <td class="paramkey"></td> |
| <td></td> |
| <td class="paramtype">const <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_time_unit.html">TimeUnit</a> & </td> |
| <td class="paramname"><em>unit</em> </td> |
| </tr> |
| <tr> |
| <td></td> |
| <td>)</td> |
| <td></td><td><code> [pure virtual]</code></td> |
| </tr> |
| </table> |
| </div> |
| <div class="memdoc"> |
| |
| <p>Retrieves and removes the head of this queue, waiting up to the specified wait time if necessary for an element to become available. </p> |
| <dl><dt><b>Parameters:</b></dt><dd> |
| <table class="params"> |
| <tr><td class="paramname">result</td><td>the referenced value that will be assigned the value retrieved from the <a class="el" href="classdecaf_1_1util_1_1_queue.html" title="A kind of collection provides advanced operations than other basic collections, such as insertion...">Queue</a>. Undefined if this methods returned false. </td></tr> |
| <tr><td class="paramname">timeout</td><td>how long to wait before giving up, in units of <code>unit</code> </td></tr> |
| <tr><td class="paramname">unit</td><td>a <code><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_time_unit.html" title="A TimeUnit represents time durations at a given unit of granularity and provides utility methods to c...">TimeUnit</a></code> determining how to interpret the <code>timeout</code> parameter. </td></tr> |
| </table> |
| </dd> |
| </dl> |
| <dl class="return"><dt><b>Returns:</b></dt><dd><code>true</code> if successful or <code>false</code> if the specified waiting time elapses before an element is available. </dd></dl> |
| <dl><dt><b>Exceptions:</b></dt><dd> |
| <table class="exception"> |
| <tr><td class="paramname">InterruptedException</td><td>if interrupted while waiting </td></tr> |
| </table> |
| </dd> |
| </dl> |
| |
| <p>Implemented in <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_linked_blocking_queue.html#aa16b86e58825b1cd7ac1092e35f439ac">decaf::util::concurrent::LinkedBlockingQueue< E ></a>, and <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_synchronous_queue.html#aff18d0dcff547995fcbe76804f4070bf">decaf::util::concurrent::SynchronousQueue< E ></a>.</p> |
| |
| </div> |
| </div> |
| <a class="anchor" id="a109657d5c0181f631872e8533d5dcc09"></a><!-- doxytag: member="decaf::util::concurrent::BlockingQueue::put" ref="a109657d5c0181f631872e8533d5dcc09" args="(const E &value)=0" --> |
| <div class="memitem"> |
| <div class="memproto"> |
| <div class="memtemplate"> |
| template<typename E> </div> |
| <table class="memname"> |
| <tr> |
| <td class="memname">virtual void <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">decaf::util::concurrent::BlockingQueue</a>< E >::put </td> |
| <td>(</td> |
| <td class="paramtype">const E & </td> |
| <td class="paramname"><em>value</em></td><td>)</td> |
| <td><code> [pure virtual]</code></td> |
| </tr> |
| </table> |
| </div> |
| <div class="memdoc"> |
| |
| <p>Inserts the specified element into this queue, waiting if necessary for space to become available. </p> |
| <dl><dt><b>Parameters:</b></dt><dd> |
| <table class="params"> |
| <tr><td class="paramname">value</td><td>the element to add </td></tr> |
| </table> |
| </dd> |
| </dl> |
| <dl><dt><b>Exceptions:</b></dt><dd> |
| <table class="exception"> |
| <tr><td class="paramname">InterruptedException</td><td>if interrupted while waiting </td></tr> |
| <tr><td class="paramname">NullPointerException</td><td>if the specified element is null </td></tr> |
| <tr><td class="paramname">IllegalArgumentException</td><td>if some property of the specified element prevents it from being added to this queue </td></tr> |
| </table> |
| </dd> |
| </dl> |
| |
| <p>Implemented in <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_linked_blocking_queue.html#a0a2bfa035134ecf04b747923fb9184c7">decaf::util::concurrent::LinkedBlockingQueue< E ></a>, and <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_synchronous_queue.html#ada6346e053c6f59a9b32780c64ee5cbf">decaf::util::concurrent::SynchronousQueue< E ></a>.</p> |
| |
| </div> |
| </div> |
| <a class="anchor" id="af2f7fc6e2e973e9b7e7558c0add39d42"></a><!-- doxytag: member="decaf::util::concurrent::BlockingQueue::remainingCapacity" ref="af2f7fc6e2e973e9b7e7558c0add39d42" args="() const =0" --> |
| <div class="memitem"> |
| <div class="memproto"> |
| <div class="memtemplate"> |
| template<typename E> </div> |
| <table class="memname"> |
| <tr> |
| <td class="memname">virtual int <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">decaf::util::concurrent::BlockingQueue</a>< E >::remainingCapacity </td> |
| <td>(</td> |
| <td class="paramname"></td><td>)</td> |
| <td> const<code> [pure virtual]</code></td> |
| </tr> |
| </table> |
| </div> |
| <div class="memdoc"> |
| |
| <p>Returns the number of additional elements that this queue can ideally (in the absence of memory or resource constraints) accept without blocking, or <code>Integer::MAX_VALUE</code> if there is no intrinsic limit. </p> |
| <p>Note that you <em>cannot</em> always tell if an attempt to insert an element will succeed by inspecting <code>remainingCapacity</code> because it may be the case that another thread is about to insert or remove an element.</p> |
| <dl class="return"><dt><b>Returns:</b></dt><dd>the remaining capacity </dd></dl> |
| |
| <p>Implemented in <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_linked_blocking_queue.html#adc88b63df8328266fe89256ed1916d7a">decaf::util::concurrent::LinkedBlockingQueue< E ></a>, and <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_synchronous_queue.html#ad422f0868c7484c9530e3133f749f81c">decaf::util::concurrent::SynchronousQueue< E ></a>.</p> |
| |
| </div> |
| </div> |
| <a class="anchor" id="ae01d0599ddb1a0da802bbfef26c1b3dc"></a><!-- doxytag: member="decaf::util::concurrent::BlockingQueue::take" ref="ae01d0599ddb1a0da802bbfef26c1b3dc" args="()=0" --> |
| <div class="memitem"> |
| <div class="memproto"> |
| <div class="memtemplate"> |
| template<typename E> </div> |
| <table class="memname"> |
| <tr> |
| <td class="memname">virtual E <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">decaf::util::concurrent::BlockingQueue</a>< E >::take </td> |
| <td>(</td> |
| <td class="paramname"></td><td>)</td> |
| <td><code> [pure virtual]</code></td> |
| </tr> |
| </table> |
| </div> |
| <div class="memdoc"> |
| |
| <p>Retrieves and removes the head of this queue, waiting if necessary until an element becomes available. </p> |
| <dl class="return"><dt><b>Returns:</b></dt><dd>the head of this queue </dd></dl> |
| <dl><dt><b>Exceptions:</b></dt><dd> |
| <table class="exception"> |
| <tr><td class="paramname">InterruptedException</td><td>if interrupted while waiting </td></tr> |
| </table> |
| </dd> |
| </dl> |
| |
| <p>Implemented in <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_linked_blocking_queue.html#a093b20a55f62e3e8cf4f81b1b9a4e5b1">decaf::util::concurrent::LinkedBlockingQueue< E ></a>, and <a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_synchronous_queue.html#afac7f4916621cc7bb6507aef613ccf42">decaf::util::concurrent::SynchronousQueue< E ></a>.</p> |
| |
| </div> |
| </div> |
| <hr/>The documentation for this class was generated from the following file:<ul> |
| <li>src/main/decaf/util/concurrent/<a class="el" href="_blocking_queue_8h_source.html">BlockingQueue.h</a></li> |
| </ul> |
| </div> |
| </div> |
| <div id="nav-path" class="navpath"> |
| <ul> |
| <li class="navelem"><a class="el" href="namespacedecaf.html">decaf</a> </li> |
| <li class="navelem"><a class="el" href="namespacedecaf_1_1util.html">util</a> </li> |
| <li class="navelem"><a class="el" href="namespacedecaf_1_1util_1_1concurrent.html">concurrent</a> </li> |
| <li class="navelem"><a class="el" href="classdecaf_1_1util_1_1concurrent_1_1_blocking_queue.html">BlockingQueue</a> </li> |
| <li class="footer">Generated on Mon Apr 25 2011 for activemq-cpp-3.4.0 by  |
| <a href="http://www.doxygen.org/index.html"> |
| <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </li> |
| </ul> |
| </div> |
| |
| </body> |
| </html> |