source: branches/objectmq_old/lib/rabbitmq-java-client-javadoc-3.0.1/com/rabbitmq/utility/BlockingCell.html

Last change on this file was 9, checked in by stoda, 12 years ago

First commit

File size: 15.7 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<!--NewPage-->
3<HTML>
4<HEAD>
5<!-- Generated by javadoc (build 1.6.0_18) on Tue Dec 11 11:47:09 GMT 2012 -->
6<TITLE>
7BlockingCell
8</TITLE>
9
10<META NAME="date" CONTENT="2012-12-11">
11
12<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
13
14<SCRIPT type="text/javascript">
15function windowTitle()
16{
17    if (location.href.indexOf('is-external=true') == -1) {
18        parent.document.title="BlockingCell";
19    }
20}
21</SCRIPT>
22<NOSCRIPT>
23</NOSCRIPT>
24
25</HEAD>
26
27<BODY BGCOLOR="white" onload="windowTitle();">
28<HR>
29
30
31<!-- ========= START OF TOP NAVBAR ======= -->
32<A NAME="navbar_top"><!-- --></A>
33<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
34<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
35<TR>
36<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
37<A NAME="navbar_top_firstrow"><!-- --></A>
38<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
39  <TR ALIGN="center" VALIGN="top">
40  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
41  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
42  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
43  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
45  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
46  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
47  </TR>
48</TABLE>
49</TD>
50<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
51</EM>
52</TD>
53</TR>
54
55<TR>
56<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57&nbsp;PREV CLASS&nbsp;
58&nbsp;<A HREF="../../../com/rabbitmq/utility/BlockingValueOrException.html" title="class in com.rabbitmq.utility"><B>NEXT CLASS</B></A></FONT></TD>
59<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
60  <A HREF="../../../index.html?com/rabbitmq/utility/BlockingCell.html" target="_top"><B>FRAMES</B></A>  &nbsp;
61&nbsp;<A HREF="BlockingCell.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
62&nbsp;<SCRIPT type="text/javascript">
63  <!--
64  if(window==top) {
65    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
66  }
67  //-->
68</SCRIPT>
69<NOSCRIPT>
70  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
71</NOSCRIPT>
72
73
74</FONT></TD>
75</TR>
76<TR>
77<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
78  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
79<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
80DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
81</TR>
82</TABLE>
83<A NAME="skip-navbar_top"></A>
84<!-- ========= END OF TOP NAVBAR ========= -->
85
86<HR>
87<!-- ======== START OF CLASS DATA ======== -->
88<H2>
89<FONT SIZE="-1">
90com.rabbitmq.utility</FONT>
91<BR>
92Class BlockingCell&lt;T&gt;</H2>
93<PRE>
94java.lang.Object
95  <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.rabbitmq.utility.BlockingCell&lt;T&gt;</B>
96</PRE>
97<DL>
98<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../com/rabbitmq/utility/BlockingValueOrException.html" title="class in com.rabbitmq.utility">BlockingValueOrException</A></DD>
99</DL>
100<HR>
101<DL>
102<DT><PRE>public class <B>BlockingCell&lt;T&gt;</B><DT>extends java.lang.Object</DL>
103</PRE>
104
105<P>
106Simple one-shot IPC mechanism. Essentially a one-place buffer that cannot be emptied once filled.
107<P>
108
109<P>
110<HR>
111
112<P>
113
114<!-- ======== CONSTRUCTOR SUMMARY ======== -->
115
116<A NAME="constructor_summary"><!-- --></A>
117<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
118<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
119<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
120<B>Constructor Summary</B></FONT></TH>
121</TR>
122<TR BGCOLOR="white" CLASS="TableRowColor">
123<TD><CODE><B><A HREF="../../../com/rabbitmq/utility/BlockingCell.html#BlockingCell()">BlockingCell</A></B>()</CODE>
124
125<BR>
126&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Instantiate a new BlockingCell waiting for a value of the specified type.</TD>
127</TR>
128</TABLE>
129&nbsp;
130<!-- ========== METHOD SUMMARY =========== -->
131
132<A NAME="method_summary"><!-- --></A>
133<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
134<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
135<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
136<B>Method Summary</B></FONT></TH>
137</TR>
138<TR BGCOLOR="white" CLASS="TableRowColor">
139<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
140<CODE>&nbsp;<A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A></CODE></FONT></TD>
141<TD><CODE><B><A HREF="../../../com/rabbitmq/utility/BlockingCell.html#get()">get</A></B>()</CODE>
142
143<BR>
144&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wait for a value, and when one arrives, return it (without clearing it).</TD>
145</TR>
146<TR BGCOLOR="white" CLASS="TableRowColor">
147<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
148<CODE>&nbsp;<A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A></CODE></FONT></TD>
149<TD><CODE><B><A HREF="../../../com/rabbitmq/utility/BlockingCell.html#get(long)">get</A></B>(long&nbsp;timeout)</CODE>
150
151<BR>
152&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wait for a value, and when one arrives, return it (without clearing it).</TD>
153</TR>
154<TR BGCOLOR="white" CLASS="TableRowColor">
155<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
156<CODE>&nbsp;void</CODE></FONT></TD>
157<TD><CODE><B><A HREF="../../../com/rabbitmq/utility/BlockingCell.html#set(T)">set</A></B>(<A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A>&nbsp;newValue)</CODE>
158
159<BR>
160&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Store a value in this BlockingCell, throwing AssertionError if the cell already has a value.</TD>
161</TR>
162<TR BGCOLOR="white" CLASS="TableRowColor">
163<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
164<CODE>&nbsp;boolean</CODE></FONT></TD>
165<TD><CODE><B><A HREF="../../../com/rabbitmq/utility/BlockingCell.html#setIfUnset(T)">setIfUnset</A></B>(<A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A>&nbsp;newValue)</CODE>
166
167<BR>
168&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Store a value in this BlockingCell if it doesn't already have a value.</TD>
169</TR>
170<TR BGCOLOR="white" CLASS="TableRowColor">
171<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
172<CODE>&nbsp;<A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A></CODE></FONT></TD>
173<TD><CODE><B><A HREF="../../../com/rabbitmq/utility/BlockingCell.html#uninterruptibleGet()">uninterruptibleGet</A></B>()</CODE>
174
175<BR>
176&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;As get(), but catches and ignores InterruptedException, retrying until a value appears.</TD>
177</TR>
178<TR BGCOLOR="white" CLASS="TableRowColor">
179<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
180<CODE>&nbsp;<A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A></CODE></FONT></TD>
181<TD><CODE><B><A HREF="../../../com/rabbitmq/utility/BlockingCell.html#uninterruptibleGet(int)">uninterruptibleGet</A></B>(int&nbsp;timeout)</CODE>
182
183<BR>
184&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;As get(long timeout), but catches and ignores InterruptedException, retrying until
185 a value appears or until specified timeout is reached.</TD>
186</TR>
187</TABLE>
188&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
189<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
190<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
191<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
192</TR>
193<TR BGCOLOR="white" CLASS="TableRowColor">
194<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
195</TR>
196</TABLE>
197&nbsp;
198<P>
199
200<!-- ========= CONSTRUCTOR DETAIL ======== -->
201
202<A NAME="constructor_detail"><!-- --></A>
203<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
204<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
205<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
206<B>Constructor Detail</B></FONT></TH>
207</TR>
208</TABLE>
209
210<A NAME="BlockingCell()"><!-- --></A><H3>
211BlockingCell</H3>
212<PRE>
213public <B>BlockingCell</B>()</PRE>
214<DL>
215<DD>Instantiate a new BlockingCell waiting for a value of the specified type.
216<P>
217</DL>
218
219<!-- ============ METHOD DETAIL ========== -->
220
221<A NAME="method_detail"><!-- --></A>
222<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
223<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
224<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
225<B>Method Detail</B></FONT></TH>
226</TR>
227</TABLE>
228
229<A NAME="get()"><!-- --></A><H3>
230get</H3>
231<PRE>
232public <A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A> <B>get</B>()
233      throws java.lang.InterruptedException</PRE>
234<DL>
235<DD>Wait for a value, and when one arrives, return it (without clearing it). If there's already a value present, there's no need to wait - the existing value
236 is returned.
237<P>
238<DD><DL>
239
240<DT><B>Returns:</B><DD>the waited-for value
241<DT><B>Throws:</B>
242<DD><CODE>java.lang.InterruptedException</CODE> - if this thread is interrupted</DL>
243</DD>
244</DL>
245<HR>
246
247<A NAME="get(long)"><!-- --></A><H3>
248get</H3>
249<PRE>
250public <A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A> <B>get</B>(long&nbsp;timeout)
251      throws java.lang.InterruptedException,
252             java.util.concurrent.TimeoutException</PRE>
253<DL>
254<DD>Wait for a value, and when one arrives, return it (without clearing it). If there's
255 already a value present, there's no need to wait - the existing value is returned.
256 If timeout is reached and value hasn't arrived, TimeoutException is thrown.
257<P>
258<DD><DL>
259<DT><B>Parameters:</B><DD><CODE>timeout</CODE> - timeout in milliseconds. -1 effectively means infinity
260<DT><B>Returns:</B><DD>the waited-for value
261<DT><B>Throws:</B>
262<DD><CODE>java.lang.InterruptedException</CODE> - if this thread is interrupted
263<DD><CODE>java.util.concurrent.TimeoutException</CODE></DL>
264</DD>
265</DL>
266<HR>
267
268<A NAME="uninterruptibleGet()"><!-- --></A><H3>
269uninterruptibleGet</H3>
270<PRE>
271public <A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A> <B>uninterruptibleGet</B>()</PRE>
272<DL>
273<DD>As get(), but catches and ignores InterruptedException, retrying until a value appears.
274<P>
275<DD><DL>
276
277<DT><B>Returns:</B><DD>the waited-for value</DL>
278</DD>
279</DL>
280<HR>
281
282<A NAME="uninterruptibleGet(int)"><!-- --></A><H3>
283uninterruptibleGet</H3>
284<PRE>
285public <A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A> <B>uninterruptibleGet</B>(int&nbsp;timeout)
286                     throws java.util.concurrent.TimeoutException</PRE>
287<DL>
288<DD>As get(long timeout), but catches and ignores InterruptedException, retrying until
289 a value appears or until specified timeout is reached. If timeout is reached,
290 TimeoutException is thrown.
291 We also use System.nanoTime() to behave correctly when system clock jumps around.
292<P>
293<DD><DL>
294<DT><B>Parameters:</B><DD><CODE>timeout</CODE> - timeout in milliseconds. -1 means 'infinity': never time out
295<DT><B>Returns:</B><DD>the waited-for value
296<DT><B>Throws:</B>
297<DD><CODE>java.util.concurrent.TimeoutException</CODE></DL>
298</DD>
299</DL>
300<HR>
301
302<A NAME="set(java.lang.Object)"><!-- --></A><A NAME="set(T)"><!-- --></A><H3>
303set</H3>
304<PRE>
305public void <B>set</B>(<A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A>&nbsp;newValue)</PRE>
306<DL>
307<DD>Store a value in this BlockingCell, throwing AssertionError if the cell already has a value.
308<P>
309<DD><DL>
310<DT><B>Parameters:</B><DD><CODE>newValue</CODE> - the new value to store</DL>
311</DD>
312</DL>
313<HR>
314
315<A NAME="setIfUnset(java.lang.Object)"><!-- --></A><A NAME="setIfUnset(T)"><!-- --></A><H3>
316setIfUnset</H3>
317<PRE>
318public boolean <B>setIfUnset</B>(<A HREF="../../../com/rabbitmq/utility/BlockingCell.html" title="type parameter in BlockingCell">T</A>&nbsp;newValue)</PRE>
319<DL>
320<DD>Store a value in this BlockingCell if it doesn't already have a value.
321<P>
322<DD><DL>
323<DT><B>Parameters:</B><DD><CODE>newValue</CODE> - the new value to store
324<DT><B>Returns:</B><DD>true if this call to setIfUnset actually updated the BlockingCell; false if the cell already had a value.</DL>
325</DD>
326</DL>
327<!-- ========= END OF CLASS DATA ========= -->
328<HR>
329
330
331<!-- ======= START OF BOTTOM NAVBAR ====== -->
332<A NAME="navbar_bottom"><!-- --></A>
333<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
334<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
335<TR>
336<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
337<A NAME="navbar_bottom_firstrow"><!-- --></A>
338<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
339  <TR ALIGN="center" VALIGN="top">
340  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
341  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
342  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
343  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
344  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
345  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
346  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
347  </TR>
348</TABLE>
349</TD>
350<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
351</EM>
352</TD>
353</TR>
354
355<TR>
356<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
357&nbsp;PREV CLASS&nbsp;
358&nbsp;<A HREF="../../../com/rabbitmq/utility/BlockingValueOrException.html" title="class in com.rabbitmq.utility"><B>NEXT CLASS</B></A></FONT></TD>
359<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
360  <A HREF="../../../index.html?com/rabbitmq/utility/BlockingCell.html" target="_top"><B>FRAMES</B></A>  &nbsp;
361&nbsp;<A HREF="BlockingCell.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
362&nbsp;<SCRIPT type="text/javascript">
363  <!--
364  if(window==top) {
365    document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
366  }
367  //-->
368</SCRIPT>
369<NOSCRIPT>
370  <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
371</NOSCRIPT>
372
373
374</FONT></TD>
375</TR>
376<TR>
377<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
378  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
379<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
380DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
381</TR>
382</TABLE>
383<A NAME="skip-navbar_bottom"></A>
384<!-- ======== END OF BOTTOM NAVBAR ======= -->
385
386<HR>
387
388</BODY>
389</HTML>
Note: See TracBrowser for help on using the repository browser.