• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-google-internal) on Mon Jan 04 20:48:00 PST 2010 -->
6<TITLE>
7Futures (Guava Libraries 2010.01.04)
8</TITLE>
9
10<META NAME="date" CONTENT="2010-01-04">
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="Futures (Guava Libraries 2010.01.04)";
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="class-use/Futures.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
44  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
45  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
46  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
47  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
48  </TR>
49</TABLE>
50</TD>
51<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
52</EM>
53</TD>
54</TR>
55
56<TR>
57<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
58&nbsp;<A HREF="../../../../../com/google/common/util/concurrent/ForwardingService.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A>&nbsp;
59&nbsp;<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent"><B>NEXT CLASS</B></A></FONT></TD>
60<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
61  <A HREF="../../../../../index.html?com/google/common/util/concurrent/Futures.html" target="_top"><B>FRAMES</B></A>  &nbsp;
62&nbsp;<A HREF="Futures.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
63&nbsp;<SCRIPT type="text/javascript">
64  <!--
65  if(window==top) {
66    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
67  }
68  //-->
69</SCRIPT>
70<NOSCRIPT>
71  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
72</NOSCRIPT>
73
74
75</FONT></TD>
76</TR>
77<TR>
78<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
79  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
80<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
81DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
82</TR>
83</TABLE>
84<A NAME="skip-navbar_top"></A>
85<!-- ========= END OF TOP NAVBAR ========= -->
86
87<HR>
88<!-- ======== START OF CLASS DATA ======== -->
89<H2>
90<FONT SIZE="-1">
91com.google.common.util.concurrent</FONT>
92<BR>
93Class Futures</H2>
94<PRE>
95<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>
96  <IMG SRC="../../../../../resources/inherit.gif" ALT="extended by "><B>com.google.common.util.concurrent.Futures</B>
97</PRE>
98<HR>
99<DL>
100<DT><PRE>public class <B>Futures</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>
101</PRE>
102
103<P>
104Static utility methods pertaining to the <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>Future</CODE></A> interface.
105<P>
106
107<P>
108<DL>
109<DT><B>Since:</B></DT>
110  <DD>2009.09.15 <b>tentative</b></DD>
111<DT><B>Author:</B></DT>
112  <DD>Kevin Bourrillion, Nishant Thakkar, Sven Mawson</DD>
113</DL>
114<HR>
115
116<P>
117
118<!-- ========== METHOD SUMMARY =========== -->
119
120<A NAME="method_summary"><!-- --></A>
121<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
122<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
123<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
124<B>Method Summary</B></FONT></TH>
125</TR>
126<TR BGCOLOR="white" CLASS="TableRowColor">
127<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
128<CODE>static
129<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
130<TR ALIGN="right" VALIGN="">
131<TD NOWRAP><FONT SIZE="-1">
132<CODE>&lt;I,O&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;O&gt;</CODE></FONT></TD>
133</TR>
134</TABLE>
135</CODE></FONT></TD>
136<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#chain(com.google.common.util.concurrent.ListenableFuture, com.google.common.base.Function)">chain</A></B>(<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;I&gt;&nbsp;input,
137      <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;? extends O&gt;&gt;&nbsp;function)</CODE>
138
139<BR>
140&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>ListenableFuture</code> that wraps another
141 <code>ListenableFuture</code>.</TD>
142</TR>
143<TR BGCOLOR="white" CLASS="TableRowColor">
144<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
145<CODE>static
146<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
147<TR ALIGN="right" VALIGN="">
148<TD NOWRAP><FONT SIZE="-1">
149<CODE>&lt;I,O&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;O&gt;</CODE></FONT></TD>
150</TR>
151</TABLE>
152</CODE></FONT></TD>
153<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#chain(com.google.common.util.concurrent.ListenableFuture, com.google.common.base.Function, java.util.concurrent.Executor)">chain</A></B>(<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;I&gt;&nbsp;input,
154      <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;? extends O&gt;&gt;&nbsp;function,
155      <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent">Executor</A>&nbsp;exec)</CODE>
156
157<BR>
158&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>ListenableFuture</code> that wraps another
159 <code>ListenableFuture</code>.</TD>
160</TR>
161<TR BGCOLOR="white" CLASS="TableRowColor">
162<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
163<CODE>static
164<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
165<TR ALIGN="right" VALIGN="">
166<TD NOWRAP><FONT SIZE="-1">
167<CODE>&lt;I,O&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;O&gt;</CODE></FONT></TD>
168</TR>
169</TABLE>
170</CODE></FONT></TD>
171<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#compose(java.util.concurrent.Future, com.google.common.base.Function)">compose</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;I&gt;&nbsp;future,
172        <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends O&gt;&nbsp;function)</CODE>
173
174<BR>
175&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>Future</code> that wraps another <code>Future</code>.</TD>
176</TR>
177<TR BGCOLOR="white" CLASS="TableRowColor">
178<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
179<CODE>static
180<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
181<TR ALIGN="right" VALIGN="">
182<TD NOWRAP><FONT SIZE="-1">
183<CODE>&lt;I,O&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;O&gt;</CODE></FONT></TD>
184</TR>
185</TABLE>
186</CODE></FONT></TD>
187<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#compose(com.google.common.util.concurrent.ListenableFuture, com.google.common.base.Function)">compose</A></B>(<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;I&gt;&nbsp;future,
188        <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends O&gt;&nbsp;function)</CODE>
189
190<BR>
191&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>ListenableFuture</code> that wraps another
192 <code>ListenableFuture</code>.</TD>
193</TR>
194<TR BGCOLOR="white" CLASS="TableRowColor">
195<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
196<CODE>static
197<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
198<TR ALIGN="right" VALIGN="">
199<TD NOWRAP><FONT SIZE="-1">
200<CODE>&lt;I,O&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;O&gt;</CODE></FONT></TD>
201</TR>
202</TABLE>
203</CODE></FONT></TD>
204<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#compose(com.google.common.util.concurrent.ListenableFuture, com.google.common.base.Function, java.util.concurrent.Executor)">compose</A></B>(<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;I&gt;&nbsp;future,
205        <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends O&gt;&nbsp;function,
206        <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent">Executor</A>&nbsp;exec)</CODE>
207
208<BR>
209&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a new <code>ListenableFuture</code> that wraps another
210 <code>ListenableFuture</code>.</TD>
211</TR>
212<TR BGCOLOR="white" CLASS="TableRowColor">
213<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
214<CODE>static
215<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
216<TR ALIGN="right" VALIGN="">
217<TD NOWRAP><FONT SIZE="-1">
218<CODE>&lt;T,E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A>&gt;
219<BR>
220<A HREF="../../../../../com/google/common/util/concurrent/CheckedFuture.html" title="interface in com.google.common.util.concurrent">CheckedFuture</A>&lt;T,E&gt;</CODE></FONT></TD>
221</TR>
222</TABLE>
223</CODE></FONT></TD>
224<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#immediateCheckedFuture(T)">immediateCheckedFuture</A></B>(T&nbsp;value)</CODE>
225
226<BR>
227&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <code>CheckedFuture</code> which has its value set immediately upon
228 construction.</TD>
229</TR>
230<TR BGCOLOR="white" CLASS="TableRowColor">
231<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
232<CODE>static
233<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
234<TR ALIGN="right" VALIGN="">
235<TD NOWRAP><FONT SIZE="-1">
236<CODE>&lt;T,E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A>&gt;
237<BR>
238<A HREF="../../../../../com/google/common/util/concurrent/CheckedFuture.html" title="interface in com.google.common.util.concurrent">CheckedFuture</A>&lt;T,E&gt;</CODE></FONT></TD>
239</TR>
240</TABLE>
241</CODE></FONT></TD>
242<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#immediateFailedCheckedFuture(E)">immediateFailedCheckedFuture</A></B>(E&nbsp;exception)</CODE>
243
244<BR>
245&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <code>CheckedFuture</code> which has an exception set immediately
246 upon construction.</TD>
247</TR>
248<TR BGCOLOR="white" CLASS="TableRowColor">
249<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
250<CODE>static
251<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
252<TR ALIGN="right" VALIGN="">
253<TD NOWRAP><FONT SIZE="-1">
254<CODE>&lt;T&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;T&gt;</CODE></FONT></TD>
255</TR>
256</TABLE>
257</CODE></FONT></TD>
258<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#immediateFailedFuture(java.lang.Throwable)">immediateFailedFuture</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;throwable)</CODE>
259
260<BR>
261&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <code>ListenableFuture</code> which has an exception set immediately
262 upon construction.</TD>
263</TR>
264<TR BGCOLOR="white" CLASS="TableRowColor">
265<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
266<CODE>static
267<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
268<TR ALIGN="right" VALIGN="">
269<TD NOWRAP><FONT SIZE="-1">
270<CODE>&lt;T&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;T&gt;</CODE></FONT></TD>
271</TR>
272</TABLE>
273</CODE></FONT></TD>
274<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#immediateFuture(T)">immediateFuture</A></B>(T&nbsp;value)</CODE>
275
276<BR>
277&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <code>ListenableFuture</code> which has its value set immediately upon
278 construction.</TD>
279</TR>
280<TR BGCOLOR="white" CLASS="TableRowColor">
281<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
282<CODE>static
283<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
284<TR ALIGN="right" VALIGN="">
285<TD NOWRAP><FONT SIZE="-1">
286<CODE>&lt;T,E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A>&gt;
287<BR>
288<A HREF="../../../../../com/google/common/util/concurrent/CheckedFuture.html" title="interface in com.google.common.util.concurrent">CheckedFuture</A>&lt;T,E&gt;</CODE></FONT></TD>
289</TR>
290</TABLE>
291</CODE></FONT></TD>
292<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#makeChecked(java.util.concurrent.Future, com.google.common.base.Function)">makeChecked</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;T&gt;&nbsp;future,
293            <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A>,E&gt;&nbsp;mapper)</CODE>
294
295<BR>
296&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <A HREF="../../../../../com/google/common/util/concurrent/CheckedFuture.html" title="interface in com.google.common.util.concurrent"><CODE>CheckedFuture</CODE></A> out of a normal <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>Future</CODE></A> and a
297 <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base"><CODE>Function</CODE></A> that maps from <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang"><CODE>Exception</CODE></A> instances into the
298 appropriate checked type.</TD>
299</TR>
300<TR BGCOLOR="white" CLASS="TableRowColor">
301<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
302<CODE>static
303<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
304<TR ALIGN="right" VALIGN="">
305<TD NOWRAP><FONT SIZE="-1">
306<CODE>&lt;T&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;T&gt;</CODE></FONT></TD>
307</TR>
308</TABLE>
309</CODE></FONT></TD>
310<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#makeListenable(java.util.concurrent.Future)">makeListenable</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;T&gt;&nbsp;future)</CODE>
311
312<BR>
313&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent"><CODE>ListenableFuture</CODE></A> out of a normal <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>Future</CODE></A>.</TD>
314</TR>
315<TR BGCOLOR="white" CLASS="TableRowColor">
316<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
317<CODE>static
318<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
319<TR ALIGN="right" VALIGN="">
320<TD NOWRAP><FONT SIZE="-1">
321<CODE>&lt;V&gt; <A HREF="../../../../../com/google/common/util/concurrent/UninterruptibleFuture.html" title="interface in com.google.common.util.concurrent">UninterruptibleFuture</A>&lt;V&gt;</CODE></FONT></TD>
322</TR>
323</TABLE>
324</CODE></FONT></TD>
325<TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/Futures.html#makeUninterruptible(java.util.concurrent.Future)">makeUninterruptible</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;V&gt;&nbsp;future)</CODE>
326
327<BR>
328&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an uninterruptible view of a <code>Future</code>.</TD>
329</TR>
330</TABLE>
331&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
332<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
333<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
334<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>
335</TR>
336<TR BGCOLOR="white" CLASS="TableRowColor">
337<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#toString()" title="class or interface in java.lang">toString</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>
338</TR>
339</TABLE>
340&nbsp;
341<P>
342
343<!-- ============ METHOD DETAIL ========== -->
344
345<A NAME="method_detail"><!-- --></A>
346<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
347<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
348<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
349<B>Method Detail</B></FONT></TH>
350</TR>
351</TABLE>
352
353<A NAME="makeUninterruptible(java.util.concurrent.Future)"><!-- --></A><H3>
354makeUninterruptible</H3>
355<PRE>
356public static &lt;V&gt; <A HREF="../../../../../com/google/common/util/concurrent/UninterruptibleFuture.html" title="interface in com.google.common.util.concurrent">UninterruptibleFuture</A>&lt;V&gt; <B>makeUninterruptible</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;V&gt;&nbsp;future)</PRE>
357<DL>
358<DD>Returns an uninterruptible view of a <code>Future</code>. If a thread is
359 interrupted during an attempt to <code>get()</code> from the returned future, it
360 continues to wait on the result until it is available or the timeout
361 elapses, and only then re-interrupts the thread.
362<P>
363<DD><DL>
364</DL>
365</DD>
366</DL>
367<HR>
368
369<A NAME="makeListenable(java.util.concurrent.Future)"><!-- --></A><H3>
370makeListenable</H3>
371<PRE>
372public static &lt;T&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;T&gt; <B>makeListenable</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;T&gt;&nbsp;future)</PRE>
373<DL>
374<DD>Creates a <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent"><CODE>ListenableFuture</CODE></A> out of a normal <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>Future</CODE></A>. The
375 returned future will create a thread to wait for the source future to
376 complete before executing the listeners.
377
378 <p>Callers who have a future that subclasses
379 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/FutureTask.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>FutureTask</CODE></A> may want to instead subclass
380 <A HREF="../../../../../com/google/common/util/concurrent/ListenableFutureTask.html" title="class in com.google.common.util.concurrent"><CODE>ListenableFutureTask</CODE></A>, which adds the <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent"><CODE>ListenableFuture</CODE></A>
381 functionality to the standard <code>FutureTask</code> implementation.
382<P>
383<DD><DL>
384</DL>
385</DD>
386</DL>
387<HR>
388
389<A NAME="makeChecked(java.util.concurrent.Future, com.google.common.base.Function)"><!-- --></A><H3>
390makeChecked</H3>
391<PRE>
392public static &lt;T,E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A>&gt; <A HREF="../../../../../com/google/common/util/concurrent/CheckedFuture.html" title="interface in com.google.common.util.concurrent">CheckedFuture</A>&lt;T,E&gt; <B>makeChecked</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;T&gt;&nbsp;future,
393                                                                     <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;<A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A>,E&gt;&nbsp;mapper)</PRE>
394<DL>
395<DD>Creates a <A HREF="../../../../../com/google/common/util/concurrent/CheckedFuture.html" title="interface in com.google.common.util.concurrent"><CODE>CheckedFuture</CODE></A> out of a normal <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>Future</CODE></A> and a
396 <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base"><CODE>Function</CODE></A> that maps from <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang"><CODE>Exception</CODE></A> instances into the
397 appropriate checked type.
398
399 <p>The given mapping function will be applied to an
400 <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang"><CODE>InterruptedException</CODE></A>, a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/CancellationException.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>CancellationException</CODE></A>, or an
401 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ExecutionException.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>ExecutionException</CODE></A> with the actual cause of the exception.
402 See <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true#get()" title="class or interface in java.util.concurrent"><CODE>Future.get()</CODE></A> for details on the exceptions thrown.
403<P>
404<DD><DL>
405</DL>
406</DD>
407</DL>
408<HR>
409
410<A NAME="immediateFuture(java.lang.Object)"><!-- --></A><A NAME="immediateFuture(T)"><!-- --></A><H3>
411immediateFuture</H3>
412<PRE>
413public static &lt;T&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;T&gt; <B>immediateFuture</B>(<FONT SIZE="-1"><A HREF="http://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/Nullable.html?is-external=true" title="class or interface in javax.annotation">@Nullable</A></FONT>
414                                                      T&nbsp;value)</PRE>
415<DL>
416<DD>Creates a <code>ListenableFuture</code> which has its value set immediately upon
417 construction. The getters just return the value. This <code>Future</code> can't
418 be canceled or timed out and its <code>isDone()</code> method always returns
419 <code>true</code>. It's useful for returning something that implements the
420 <code>ListenableFuture</code> interface but already has the result.
421<P>
422<DD><DL>
423</DL>
424</DD>
425</DL>
426<HR>
427
428<A NAME="immediateCheckedFuture(java.lang.Object)"><!-- --></A><A NAME="immediateCheckedFuture(T)"><!-- --></A><H3>
429immediateCheckedFuture</H3>
430<PRE>
431public static &lt;T,E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A>&gt; <A HREF="../../../../../com/google/common/util/concurrent/CheckedFuture.html" title="interface in com.google.common.util.concurrent">CheckedFuture</A>&lt;T,E&gt; <B>immediateCheckedFuture</B>(<FONT SIZE="-1"><A HREF="http://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/Nullable.html?is-external=true" title="class or interface in javax.annotation">@Nullable</A></FONT>
432                                                                                T&nbsp;value)</PRE>
433<DL>
434<DD>Creates a <code>CheckedFuture</code> which has its value set immediately upon
435 construction. The getters just return the value. This <code>Future</code> can't
436 be canceled or timed out and its <code>isDone()</code> method always returns
437 <code>true</code>. It's useful for returning something that implements the
438 <code>CheckedFuture</code> interface but already has the result.
439<P>
440<DD><DL>
441</DL>
442</DD>
443</DL>
444<HR>
445
446<A NAME="immediateFailedFuture(java.lang.Throwable)"><!-- --></A><H3>
447immediateFailedFuture</H3>
448<PRE>
449public static &lt;T&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;T&gt; <B>immediateFailedFuture</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;throwable)</PRE>
450<DL>
451<DD>Creates a <code>ListenableFuture</code> which has an exception set immediately
452 upon construction. The getters just return the value. This <code>Future</code>
453 can't be canceled or timed out and its <code>isDone()</code> method always
454 returns <code>true</code>. It's useful for returning something that implements
455 the <code>ListenableFuture</code> interface but already has a failed
456 result. Calling <code>get()</code> will throw the provided <code>Throwable</code>
457 (wrapped in an <code>ExecutionException</code>).
458<P>
459<DD><DL>
460
461<DT><B>Throws:</B>
462<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Error.html?is-external=true" title="class or interface in java.lang">Error</A></CODE> - if the throwable was an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Error.html?is-external=true" title="class or interface in java.lang"><CODE>Error</CODE></A>.</DL>
463</DD>
464</DL>
465<HR>
466
467<A NAME="immediateFailedCheckedFuture(java.lang.Exception)"><!-- --></A><A NAME="immediateFailedCheckedFuture(E)"><!-- --></A><H3>
468immediateFailedCheckedFuture</H3>
469<PRE>
470public static &lt;T,E extends <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang">Exception</A>&gt; <A HREF="../../../../../com/google/common/util/concurrent/CheckedFuture.html" title="interface in com.google.common.util.concurrent">CheckedFuture</A>&lt;T,E&gt; <B>immediateFailedCheckedFuture</B>(E&nbsp;exception)</PRE>
471<DL>
472<DD>Creates a <code>CheckedFuture</code> which has an exception set immediately
473 upon construction. The getters just return the value. This <code>Future</code>
474 can't be canceled or timed out and its <code>isDone()</code> method always
475 returns <code>true</code>. It's useful for returning something that implements
476 the <code>CheckedFuture</code> interface but already has a failed result.
477 Calling <code>get()</code> will throw the provided <code>Throwable</code> (wrapped in
478 an <code>ExecutionException</code>) and calling <code>checkedGet()</code> will throw
479 the provided exception itself.
480<P>
481<DD><DL>
482
483<DT><B>Throws:</B>
484<DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Error.html?is-external=true" title="class or interface in java.lang">Error</A></CODE> - if the throwable was an <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Error.html?is-external=true" title="class or interface in java.lang"><CODE>Error</CODE></A>.</DL>
485</DD>
486</DL>
487<HR>
488
489<A NAME="chain(com.google.common.util.concurrent.ListenableFuture, com.google.common.base.Function)"><!-- --></A><H3>
490chain</H3>
491<PRE>
492public static &lt;I,O&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;O&gt; <B>chain</B>(<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;I&gt;&nbsp;input,
493                                              <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;? extends O&gt;&gt;&nbsp;function)</PRE>
494<DL>
495<DD>Creates a new <code>ListenableFuture</code> that wraps another
496 <code>ListenableFuture</code>.  The result of the new future is the result of
497 the provided function called on the result of the provided future.
498 The resulting future doesn't interrupt when aborted.
499
500 <p>TODO: Add a version that accepts a normal <code>Future</code>
501
502 <p>The typical use for this method would be when a RPC call is dependent on
503 the results of another RPC.  One would call the first RPC (input), create a
504 function that calls another RPC based on input's result, and then call
505 chain on input and that function to get a <code>ListenableFuture</code> of
506 the result.
507<P>
508<DD><DL>
509<DT><B>Parameters:</B><DD><CODE>input</CODE> - The future to chain<DD><CODE>function</CODE> - A function to chain the results of the provided future
510     to the results of the returned future.  This will be run in the thread
511     that notifies input it is complete.
512<DT><B>Returns:</B><DD>A future that holds result of the chain.</DL>
513</DD>
514</DL>
515<HR>
516
517<A NAME="chain(com.google.common.util.concurrent.ListenableFuture, com.google.common.base.Function, java.util.concurrent.Executor)"><!-- --></A><H3>
518chain</H3>
519<PRE>
520public static &lt;I,O&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;O&gt; <B>chain</B>(<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;I&gt;&nbsp;input,
521                                              <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;? extends O&gt;&gt;&nbsp;function,
522                                              <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent">Executor</A>&nbsp;exec)</PRE>
523<DL>
524<DD>Creates a new <code>ListenableFuture</code> that wraps another
525 <code>ListenableFuture</code>.  The result of the new future is the result of
526 the provided function called on the result of the provided future.
527 The resulting future doesn't interrupt when aborted.
528
529 <p>This version allows an arbitrary executor to be passed in for running
530 the chained Function. When using <A HREF="../../../../../com/google/common/util/concurrent/Executors.html#sameThreadExecutor()"><CODE>Executors.sameThreadExecutor()</CODE></A>, the
531 thread chained Function executes in will be whichever thread set the
532 result of the input Future, which may be the network thread in the case of
533 RPC-based Futures.
534<P>
535<DD><DL>
536<DT><B>Parameters:</B><DD><CODE>input</CODE> - The future to chain<DD><CODE>function</CODE> - A function to chain the results of the provided future
537     to the results of the returned future.<DD><CODE>exec</CODE> - Executor to run the function in.
538<DT><B>Returns:</B><DD>A future that holds result of the chain.</DL>
539</DD>
540</DL>
541<HR>
542
543<A NAME="compose(com.google.common.util.concurrent.ListenableFuture, com.google.common.base.Function)"><!-- --></A><H3>
544compose</H3>
545<PRE>
546public static &lt;I,O&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;O&gt; <B>compose</B>(<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;I&gt;&nbsp;future,
547                                                <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends O&gt;&nbsp;function)</PRE>
548<DL>
549<DD>Creates a new <code>ListenableFuture</code> that wraps another
550 <code>ListenableFuture</code>.  The result of the new future is the result of
551 the provided function called on the result of the provided future.
552 The resulting future doesn't interrupt when aborted.
553
554 <p>An example use of this method is to convert a serializable object
555 returned from an RPC into a POJO.
556<P>
557<DD><DL>
558<DT><B>Parameters:</B><DD><CODE>future</CODE> - The future to compose<DD><CODE>function</CODE> - A Function to compose the results of the provided future
559     to the results of the returned future.  This will be run in the thread
560     that notifies input it is complete.
561<DT><B>Returns:</B><DD>A future that holds result of the composition.</DL>
562</DD>
563</DL>
564<HR>
565
566<A NAME="compose(com.google.common.util.concurrent.ListenableFuture, com.google.common.base.Function, java.util.concurrent.Executor)"><!-- --></A><H3>
567compose</H3>
568<PRE>
569public static &lt;I,O&gt; <A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;O&gt; <B>compose</B>(<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent">ListenableFuture</A>&lt;I&gt;&nbsp;future,
570                                                <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends O&gt;&nbsp;function,
571                                                <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent">Executor</A>&nbsp;exec)</PRE>
572<DL>
573<DD>Creates a new <code>ListenableFuture</code> that wraps another
574 <code>ListenableFuture</code>.  The result of the new future is the result of
575 the provided function called on the result of the provided future.
576 The resulting future doesn't interrupt when aborted.
577
578 <p>An example use of this method is to convert a serializable object
579 returned from an RPC into a POJO.
580
581 <p>This version allows an arbitrary executor to be passed in for running
582 the chained Function. When using <A HREF="../../../../../com/google/common/util/concurrent/Executors.html#sameThreadExecutor()"><CODE>Executors.sameThreadExecutor()</CODE></A>, the
583 thread chained Function executes in will be whichever thread set the result
584 of the input Future, which may be the network thread in the case of
585 RPC-based Futures.
586<P>
587<DD><DL>
588<DT><B>Parameters:</B><DD><CODE>future</CODE> - The future to compose<DD><CODE>function</CODE> - A Function to compose the results of the provided future
589     to the results of the returned future.<DD><CODE>exec</CODE> - Executor to run the function in.
590<DT><B>Returns:</B><DD>A future that holds result of the composition.<DT><B>Since:</B></DT>
591  <DD>2010.01.04 <b>tentative</b></DD>
592</DL>
593</DD>
594</DL>
595<HR>
596
597<A NAME="compose(java.util.concurrent.Future, com.google.common.base.Function)"><!-- --></A><H3>
598compose</H3>
599<PRE>
600public static &lt;I,O&gt; <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;O&gt; <B>compose</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true" title="class or interface in java.util.concurrent">Future</A>&lt;I&gt;&nbsp;future,
601                                      <A HREF="../../../../../com/google/common/base/Function.html" title="interface in com.google.common.base">Function</A>&lt;? super I,? extends O&gt;&nbsp;function)</PRE>
602<DL>
603<DD>Creates a new <code>Future</code> that wraps another <code>Future</code>.
604 The result of the new future is the result of the provided function called
605 on the result of the provided future.
606
607 <p>An example use of this method is to convert a Future that produces a
608 handle to an object to a future that produces the object itself.
609
610 <p>Each call to <code>Future&lt;O&gt;.get(*)</code> results in a call to
611 <code>Future&lt;I&gt;.get(*)</code>, but <code>function</code> is only applied once, so it
612 is assumed that <code>Future&lt;I&gt;.get(*)</code> is idempotent.
613
614 <p>When calling <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true#get(long, java.util.concurrent.TimeUnit)" title="class or interface in java.util.concurrent"><CODE>Future.get(long, TimeUnit)</CODE></A> on the returned
615 future, the timeout only applies to the future passed in to this method.
616 Any additional time taken by applying <code>function</code> is not considered.
617<P>
618<DD><DL>
619<DT><B>Parameters:</B><DD><CODE>future</CODE> - The future to compose<DD><CODE>function</CODE> - A Function to compose the results of the provided future
620     to the results of the returned future.  This will be run in the thread
621     that calls one of the varieties of <code>get()</code>.
622<DT><B>Returns:</B><DD>A future that computes result of the composition.</DL>
623</DD>
624</DL>
625<!-- ========= END OF CLASS DATA ========= -->
626<HR>
627
628
629<!-- ======= START OF BOTTOM NAVBAR ====== -->
630<A NAME="navbar_bottom"><!-- --></A>
631<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
632<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
633<TR>
634<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
635<A NAME="navbar_bottom_firstrow"><!-- --></A>
636<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
637  <TR ALIGN="center" VALIGN="top">
638  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
639  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
640  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
641  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/Futures.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
642  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
643  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
644  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
645  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
646  </TR>
647</TABLE>
648</TD>
649<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
650</EM>
651</TD>
652</TR>
653
654<TR>
655<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
656&nbsp;<A HREF="../../../../../com/google/common/util/concurrent/ForwardingService.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A>&nbsp;
657&nbsp;<A HREF="../../../../../com/google/common/util/concurrent/ListenableFuture.html" title="interface in com.google.common.util.concurrent"><B>NEXT CLASS</B></A></FONT></TD>
658<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
659  <A HREF="../../../../../index.html?com/google/common/util/concurrent/Futures.html" target="_top"><B>FRAMES</B></A>  &nbsp;
660&nbsp;<A HREF="Futures.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
661&nbsp;<SCRIPT type="text/javascript">
662  <!--
663  if(window==top) {
664    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
665  }
666  //-->
667</SCRIPT>
668<NOSCRIPT>
669  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
670</NOSCRIPT>
671
672
673</FONT></TD>
674</TR>
675<TR>
676<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
677  SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
678<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
679DETAIL:&nbsp;FIELD&nbsp;|&nbsp;CONSTR&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
680</TR>
681</TABLE>
682<A NAME="skip-navbar_bottom"></A>
683<!-- ======== END OF BOTTOM NAVBAR ======= -->
684
685<HR>
686
687</BODY>
688</HTML>
689