Files
sshj/javadoc/0.4.0/net/schmizz/concurrent/Promise.html
Shikhar Bhushan 63825c4f0f 0.4.0 javadoc
2011-06-06 21:39:09 +01:00

544 lines
27 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_24) on Mon Jun 06 20:44:30 BST 2011 -->
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
Promise (sshj 0.4.0 API)
</TITLE>
<META NAME="date" CONTENT="2011-06-06">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="Promise (sshj 0.4.0 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Promise.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../net/schmizz/concurrent/ExceptionChainer.html" title="interface in net.schmizz.concurrent"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?net/schmizz/concurrent/Promise.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Promise.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
net.schmizz.concurrent</FONT>
<BR>
Class Promise&lt;V,T extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A>&gt;</H2>
<PRE>
<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>net.schmizz.concurrent.Promise&lt;V,T&gt;</B>
</PRE>
<HR>
<DL>
<DT><PRE>public class <B>Promise&lt;V,T extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A>&gt;</B><DT>extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
</PRE>
<P>
Represents promised data of the parameterized type <code>V</code> and allows waiting on it. An exception may also be
delivered to a waiter, and will be of the parameterized type <code>T</code>.
<p/>
For atomic operations on a promise, e.g. checking if a value is delivered and if it is not then setting it, the
associated lock for the promise should be acquired while doing so.
<P>
<P>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#Promise(java.lang.String, net.schmizz.concurrent.ExceptionChainer)">Promise</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name,
<A HREF="../../../net/schmizz/concurrent/ExceptionChainer.html" title="interface in net.schmizz.concurrent">ExceptionChainer</A>&lt;<A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A>&gt;&nbsp;chainer)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates this promise with given <code>name</code> and exception <code>chainer</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#Promise(java.lang.String, net.schmizz.concurrent.ExceptionChainer, java.util.concurrent.locks.ReentrantLock)">Promise</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name,
<A HREF="../../../net/schmizz/concurrent/ExceptionChainer.html" title="interface in net.schmizz.concurrent">ExceptionChainer</A>&lt;<A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A>&gt;&nbsp;chainer,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html?is-external=true" title="class or interface in java.util.concurrent.locks">ReentrantLock</A>&nbsp;lock)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates this promise with given <code>name</code>, exception <code>chainer</code>, and associated <code>lock</code>.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#clear()">clear</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Clears this promise by setting its value and queued exception to <code>null</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#deliver(V)">deliver</A></B>(<A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">V</A>&nbsp;val)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set this promise's value to <code>val</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#deliverError(java.lang.Throwable)">deliverError</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A>&nbsp;e)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Queues error that will be thrown in any waiting thread or any thread that attempts to wait on this promise
hereafter.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#hasWaiters()">hasWaiters</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#inError()">inError</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#isDelivered()">isDelivered</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#lock()">lock</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Acquire the lock associated with this promise.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">V</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#retrieve()">retrieve</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wait indefinitely for this promise's value to be deliver.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">V</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#retrieve(long, java.util.concurrent.TimeUnit)">retrieve</A></B>(long&nbsp;timeout,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</A>&nbsp;unit)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wait for <code>timeout</code> duration for this promise's value to be deliver.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#toString()">toString</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">V</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#tryRetrieve(long, java.util.concurrent.TimeUnit)">tryRetrieve</A></B>(long&nbsp;timeout,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</A>&nbsp;unit)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wait for <code>timeout</code> duration for this promise's value to be deliver.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../net/schmizz/concurrent/Promise.html#unlock()">unlock</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Release the lock associated with this promise.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="Promise(java.lang.String, net.schmizz.concurrent.ExceptionChainer)"><!-- --></A><H3>
Promise</H3>
<PRE>
public <B>Promise</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name,
<A HREF="../../../net/schmizz/concurrent/ExceptionChainer.html" title="interface in net.schmizz.concurrent">ExceptionChainer</A>&lt;<A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A>&gt;&nbsp;chainer)</PRE>
<DL>
<DD>Creates this promise with given <code>name</code> and exception <code>chainer</code>. Allocates a new <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/Lock.html?is-external=true" title="class or interface in java.util.concurrent.locks"><CODE>lock</CODE></A> object for this promise.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - name of this promise<DD><CODE>chainer</CODE> - <A HREF="../../../net/schmizz/concurrent/ExceptionChainer.html" title="interface in net.schmizz.concurrent"><CODE>ExceptionChainer</CODE></A> that will be used for chaining exceptions</DL>
</DL>
<HR>
<A NAME="Promise(java.lang.String, net.schmizz.concurrent.ExceptionChainer, java.util.concurrent.locks.ReentrantLock)"><!-- --></A><H3>
Promise</H3>
<PRE>
public <B>Promise</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>&nbsp;name,
<A HREF="../../../net/schmizz/concurrent/ExceptionChainer.html" title="interface in net.schmizz.concurrent">ExceptionChainer</A>&lt;<A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A>&gt;&nbsp;chainer,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/ReentrantLock.html?is-external=true" title="class or interface in java.util.concurrent.locks">ReentrantLock</A>&nbsp;lock)</PRE>
<DL>
<DD>Creates this promise with given <code>name</code>, exception <code>chainer</code>, and associated <code>lock</code>.
<P>
<DL>
<DT><B>Parameters:</B><DD><CODE>name</CODE> - name of this promise<DD><CODE>chainer</CODE> - <A HREF="../../../net/schmizz/concurrent/ExceptionChainer.html" title="interface in net.schmizz.concurrent"><CODE>ExceptionChainer</CODE></A> that will be used for chaining exceptions<DD><CODE>lock</CODE> - lock to use</DL>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="deliver(java.lang.Object)"><!-- --></A><A NAME="deliver(V)"><!-- --></A><H3>
deliver</H3>
<PRE>
public void <B>deliver</B>(<A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">V</A>&nbsp;val)</PRE>
<DL>
<DD>Set this promise's value to <code>val</code>. Any waiters will be delivered this value.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>val</CODE> - the value</DL>
</DD>
</DL>
<HR>
<A NAME="deliverError(java.lang.Throwable)"><!-- --></A><H3>
deliverError</H3>
<PRE>
public void <B>deliverError</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A>&nbsp;e)</PRE>
<DL>
<DD>Queues error that will be thrown in any waiting thread or any thread that attempts to wait on this promise
hereafter.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>e</CODE> - the error</DL>
</DD>
</DL>
<HR>
<A NAME="clear()"><!-- --></A><H3>
clear</H3>
<PRE>
public void <B>clear</B>()</PRE>
<DL>
<DD>Clears this promise by setting its value and queued exception to <code>null</code>.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="retrieve()"><!-- --></A><H3>
retrieve</H3>
<PRE>
public <A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">V</A> <B>retrieve</B>()
throws <A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A> extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A></PRE>
<DL>
<DD>Wait indefinitely for this promise's value to be deliver.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the value
<DT><B>Throws:</B>
<DD><CODE>T</CODE> - in case another thread informs the promise of an error meanwhile
<DD><CODE><A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A> extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A></CODE></DL>
</DD>
</DL>
<HR>
<A NAME="retrieve(long, java.util.concurrent.TimeUnit)"><!-- --></A><H3>
retrieve</H3>
<PRE>
public <A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">V</A> <B>retrieve</B>(long&nbsp;timeout,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</A>&nbsp;unit)
throws <A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A> extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A></PRE>
<DL>
<DD>Wait for <code>timeout</code> duration for this promise's value to be deliver.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>timeout</CODE> - the timeout<DD><CODE>unit</CODE> - time unit for the timeout
<DT><B>Returns:</B><DD>the value
<DT><B>Throws:</B>
<DD><CODE>T</CODE> - in case another thread informs the promise of an error meanwhile, or the timeout expires
<DD><CODE><A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A> extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A></CODE></DL>
</DD>
</DL>
<HR>
<A NAME="tryRetrieve(long, java.util.concurrent.TimeUnit)"><!-- --></A><H3>
tryRetrieve</H3>
<PRE>
public <A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">V</A> <B>tryRetrieve</B>(long&nbsp;timeout,
<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/TimeUnit.html?is-external=true" title="class or interface in java.util.concurrent">TimeUnit</A>&nbsp;unit)
throws <A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A> extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A></PRE>
<DL>
<DD>Wait for <code>timeout</code> duration for this promise's value to be deliver.
<p/>
If the value is not deliver by the time the timeout expires, returns <code>null</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>timeout</CODE> - the timeout<DD><CODE>unit</CODE> - time unit for the timeout
<DT><B>Returns:</B><DD>the value or <code>null</code>
<DT><B>Throws:</B>
<DD><CODE>T</CODE> - in case another thread informs the promise of an error meanwhile
<DD><CODE><A HREF="../../../net/schmizz/concurrent/Promise.html" title="type parameter in Promise">T</A> extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html?is-external=true" title="class or interface in java.lang">Throwable</A></CODE></DL>
</DD>
</DL>
<HR>
<A NAME="isDelivered()"><!-- --></A><H3>
isDelivered</H3>
<PRE>
public boolean <B>isDelivered</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>whether this promise has a value delivered, and no error waiting to pop.</DL>
</DD>
</DL>
<HR>
<A NAME="inError()"><!-- --></A><H3>
inError</H3>
<PRE>
public boolean <B>inError</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>whether this promise has been delivered an error.</DL>
</DD>
</DL>
<HR>
<A NAME="hasWaiters()"><!-- --></A><H3>
hasWaiters</H3>
<PRE>
public boolean <B>hasWaiters</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Returns:</B><DD>whether this promise has threads waiting on it.</DL>
</DD>
</DL>
<HR>
<A NAME="lock()"><!-- --></A><H3>
lock</H3>
<PRE>
public void <B>lock</B>()</PRE>
<DL>
<DD>Acquire the lock associated with this promise.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="unlock()"><!-- --></A><H3>
unlock</H3>
<PRE>
public void <B>unlock</B>()</PRE>
<DL>
<DD>Release the lock associated with this promise.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="toString()"><!-- --></A><H3>
toString</H3>
<PRE>
public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>toString</B>()</PRE>
<DL>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A></CODE> in class <CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL>
</DD>
<DD><DL>
</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Promise.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../net/schmizz/concurrent/ExceptionChainer.html" title="interface in net.schmizz.concurrent"><B>PREV CLASS</B></A>&nbsp;
&nbsp;NEXT CLASS</FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?net/schmizz/concurrent/Promise.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="Promise.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 2009-2011. All Rights Reserved.
</BODY>
</HTML>