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> 7 AbstractFuture (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"> 15 function windowTitle() 16 { 17 if (location.href.indexOf('is-external=true') == -1) { 18 parent.document.title="AbstractFuture (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> </TD> 41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 42 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AbstractFuture.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 44 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 45 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 46 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 47 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </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 <A HREF="../../../../../com/google/common/util/concurrent/AbstractExecutionThreadService.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A> 59 <A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html" title="class 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/AbstractFuture.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="AbstractFuture.html" target="_top"><B>NO FRAMES</B></A> 63 <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: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 80 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 81 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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"> 91 com.google.common.util.concurrent</FONT> 92 <BR> 93 Class AbstractFuture<V></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.AbstractFuture<V></B> 97 </PRE> 98 <DL> 99 <DT><B>All Implemented Interfaces:</B> <DD><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><V></DD> 100 </DL> 101 <DL> 102 <DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../../../com/google/common/util/concurrent/AbstractListenableFuture.html" title="class in com.google.common.util.concurrent">AbstractListenableFuture</A></DD> 103 </DL> 104 <HR> 105 <DL> 106 <DT><PRE>public abstract class <B>AbstractFuture<V></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><DT>implements <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><V></DL> 107 </PRE> 108 109 <P> 110 <p>An abstract implementation of 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. This class 111 is an abstraction of <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> to support use 112 for tasks other than <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html?is-external=true" title="class or interface in java.lang"><CODE>Runnable</CODE></A>s. It uses an 113 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/locks/AbstractQueuedSynchronizer.html?is-external=true" title="class or interface in java.util.concurrent.locks"><CODE>AbstractQueuedSynchronizer</CODE></A> to deal with concurrency issues and 114 guarantee thread safety. It could be used as a base class to 115 <code>FutureTask</code>, or any other implementor of the <code>Future</code> interface. 116 117 <p>This class implements all methods in <code>Future</code>. Subclasses should 118 provide a way to set the result of the computation through the protected 119 methods <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#set(V)"><CODE>set(Object)</CODE></A>, <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#setException(java.lang.Throwable)"><CODE>setException(Throwable)</CODE></A>, or 120 <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#cancel()"><CODE>cancel()</CODE></A>. If subclasses want to implement cancellation they can 121 override the <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#cancel(boolean)"><CODE>cancel(boolean)</CODE></A> method with a real implementation, the 122 default implementation doesn't support cancellation. 123 124 <p>The state changing methods all return a boolean indicating success or 125 failure in changing the future's state. Valid states are running, 126 completed, failed, or cancelled. Because this class does not implement 127 cancellation it is left to the subclass to distinguish between created 128 and running tasks. 129 <P> 130 131 <P> 132 <DL> 133 <DT><B>Since:</B></DT> 134 <DD>2009.09.15 <b>tentative</b></DD> 135 <DT><B>Author:</B></DT> 136 <DD>Sven Mawson</DD> 137 </DL> 138 <HR> 139 140 <P> 141 142 <!-- ======== CONSTRUCTOR SUMMARY ======== --> 143 144 <A NAME="constructor_summary"><!-- --></A> 145 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 146 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 147 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 148 <B>Constructor Summary</B></FONT></TH> 149 </TR> 150 <TR BGCOLOR="white" CLASS="TableRowColor"> 151 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#AbstractFuture()">AbstractFuture</A></B>()</CODE> 152 153 <BR> 154 </TD> 155 </TR> 156 </TABLE> 157 158 <!-- ========== METHOD SUMMARY =========== --> 159 160 <A NAME="method_summary"><!-- --></A> 161 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 162 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 163 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> 164 <B>Method Summary</B></FONT></TH> 165 </TR> 166 <TR BGCOLOR="white" CLASS="TableRowColor"> 167 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 168 <CODE>protected boolean</CODE></FONT></TD> 169 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#cancel()">cancel</A></B>()</CODE> 170 171 <BR> 172 Subclasses should invoke this method to mark the future as cancelled.</TD> 173 </TR> 174 <TR BGCOLOR="white" CLASS="TableRowColor"> 175 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 176 <CODE> boolean</CODE></FONT></TD> 177 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#cancel(boolean)">cancel</A></B>(boolean mayInterruptIfRunning)</CODE> 178 179 <BR> 180 </TD> 181 </TR> 182 <TR BGCOLOR="white" CLASS="TableRowColor"> 183 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 184 <CODE>protected void</CODE></FONT></TD> 185 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#done()">done</A></B>()</CODE> 186 187 <BR> 188 </TD> 189 </TR> 190 <TR BGCOLOR="white" CLASS="TableRowColor"> 191 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 192 <CODE> <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A></CODE></FONT></TD> 193 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#get()">get</A></B>()</CODE> 194 195 <BR> 196 </TD> 197 </TR> 198 <TR BGCOLOR="white" CLASS="TableRowColor"> 199 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 200 <CODE> <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A></CODE></FONT></TD> 201 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#get(long, java.util.concurrent.TimeUnit)">get</A></B>(long timeout, 202 <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> unit)</CODE> 203 204 <BR> 205 </TD> 206 </TR> 207 <TR BGCOLOR="white" CLASS="TableRowColor"> 208 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 209 <CODE> boolean</CODE></FONT></TD> 210 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#isCancelled()">isCancelled</A></B>()</CODE> 211 212 <BR> 213 </TD> 214 </TR> 215 <TR BGCOLOR="white" CLASS="TableRowColor"> 216 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 217 <CODE> boolean</CODE></FONT></TD> 218 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#isDone()">isDone</A></B>()</CODE> 219 220 <BR> 221 </TD> 222 </TR> 223 <TR BGCOLOR="white" CLASS="TableRowColor"> 224 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 225 <CODE>protected boolean</CODE></FONT></TD> 226 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#set(V)">set</A></B>(<A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A> value)</CODE> 227 228 <BR> 229 Subclasses should invoke this method to set the result of the computation 230 to <code>value</code>.</TD> 231 </TR> 232 <TR BGCOLOR="white" CLASS="TableRowColor"> 233 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 234 <CODE>protected boolean</CODE></FONT></TD> 235 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#setException(java.lang.Throwable)">setException</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> throwable)</CODE> 236 237 <BR> 238 Subclasses should invoke this method to set the result of the computation 239 to an error, <code>throwable</code>.</TD> 240 </TR> 241 </TABLE> 242 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 243 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 244 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 245 <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> 246 </TR> 247 <TR BGCOLOR="white" CLASS="TableRowColor"> 248 <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> 249 </TR> 250 </TABLE> 251 252 <P> 253 254 <!-- ========= CONSTRUCTOR DETAIL ======== --> 255 256 <A NAME="constructor_detail"><!-- --></A> 257 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 258 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 259 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 260 <B>Constructor Detail</B></FONT></TH> 261 </TR> 262 </TABLE> 263 264 <A NAME="AbstractFuture()"><!-- --></A><H3> 265 AbstractFuture</H3> 266 <PRE> 267 public <B>AbstractFuture</B>()</PRE> 268 <DL> 269 </DL> 270 271 <!-- ============ METHOD DETAIL ========== --> 272 273 <A NAME="method_detail"><!-- --></A> 274 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 275 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 276 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 277 <B>Method Detail</B></FONT></TH> 278 </TR> 279 </TABLE> 280 281 <A NAME="get(long, java.util.concurrent.TimeUnit)"><!-- --></A><H3> 282 get</H3> 283 <PRE> 284 public <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A> <B>get</B>(long timeout, 285 <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> unit) 286 throws <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A>, 287 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/TimeoutException.html?is-external=true" title="class or interface in java.util.concurrent">TimeoutException</A>, 288 <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">ExecutionException</A></PRE> 289 <DL> 290 <DD><DL> 291 <DT><B>Specified by:</B><DD><CODE><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">get</A></CODE> in interface <CODE><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><<A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A>></CODE></DL> 292 </DD> 293 <DD><DL> 294 295 <DT><B>Throws:</B> 296 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></CODE> 297 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/TimeoutException.html?is-external=true" title="class or interface in java.util.concurrent">TimeoutException</A></CODE> 298 <DD><CODE><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">ExecutionException</A></CODE></DL> 299 </DD> 300 </DL> 301 <HR> 302 303 <A NAME="get()"><!-- --></A><H3> 304 get</H3> 305 <PRE> 306 public <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A> <B>get</B>() 307 throws <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A>, 308 <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">ExecutionException</A></PRE> 309 <DL> 310 <DD><DL> 311 <DT><B>Specified by:</B><DD><CODE><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">get</A></CODE> in interface <CODE><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><<A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A>></CODE></DL> 312 </DD> 313 <DD><DL> 314 315 <DT><B>Throws:</B> 316 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/InterruptedException.html?is-external=true" title="class or interface in java.lang">InterruptedException</A></CODE> 317 <DD><CODE><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">ExecutionException</A></CODE></DL> 318 </DD> 319 </DL> 320 <HR> 321 322 <A NAME="isDone()"><!-- --></A><H3> 323 isDone</H3> 324 <PRE> 325 public boolean <B>isDone</B>()</PRE> 326 <DL> 327 <DD><DL> 328 <DT><B>Specified by:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true#isDone()" title="class or interface in java.util.concurrent">isDone</A></CODE> in interface <CODE><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><<A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A>></CODE></DL> 329 </DD> 330 <DD><DL> 331 </DL> 332 </DD> 333 </DL> 334 <HR> 335 336 <A NAME="isCancelled()"><!-- --></A><H3> 337 isCancelled</H3> 338 <PRE> 339 public boolean <B>isCancelled</B>()</PRE> 340 <DL> 341 <DD><DL> 342 <DT><B>Specified by:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true#isCancelled()" title="class or interface in java.util.concurrent">isCancelled</A></CODE> in interface <CODE><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><<A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A>></CODE></DL> 343 </DD> 344 <DD><DL> 345 </DL> 346 </DD> 347 </DL> 348 <HR> 349 350 <A NAME="cancel(boolean)"><!-- --></A><H3> 351 cancel</H3> 352 <PRE> 353 public boolean <B>cancel</B>(boolean mayInterruptIfRunning)</PRE> 354 <DL> 355 <DD><DL> 356 <DT><B>Specified by:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html?is-external=true#cancel(boolean)" title="class or interface in java.util.concurrent">cancel</A></CODE> in interface <CODE><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><<A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A>></CODE></DL> 357 </DD> 358 <DD><DL> 359 </DL> 360 </DD> 361 </DL> 362 <HR> 363 364 <A NAME="set(java.lang.Object)"><!-- --></A><A NAME="set(V)"><!-- --></A><H3> 365 set</H3> 366 <PRE> 367 protected boolean <B>set</B>(<A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="type parameter in AbstractFuture">V</A> value)</PRE> 368 <DL> 369 <DD>Subclasses should invoke this method to set the result of the computation 370 to <code>value</code>. This will set the state of the future to 371 <CODE>AbstractFuture.Sync.COMPLETED</CODE> and call <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#done()"><CODE>done()</CODE></A> if the 372 state was successfully changed. 373 <P> 374 <DD><DL> 375 </DL> 376 </DD> 377 <DD><DL> 378 <DT><B>Parameters:</B><DD><CODE>value</CODE> - the value that was the result of the task. 379 <DT><B>Returns:</B><DD>true if the state was successfully changed.</DL> 380 </DD> 381 </DL> 382 <HR> 383 384 <A NAME="setException(java.lang.Throwable)"><!-- --></A><H3> 385 setException</H3> 386 <PRE> 387 protected boolean <B>setException</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> throwable)</PRE> 388 <DL> 389 <DD>Subclasses should invoke this method to set the result of the computation 390 to an error, <code>throwable</code>. This will set the state of the future to 391 <CODE>AbstractFuture.Sync.COMPLETED</CODE> and call <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#done()"><CODE>done()</CODE></A> if the 392 state was successfully changed. 393 <P> 394 <DD><DL> 395 </DL> 396 </DD> 397 <DD><DL> 398 <DT><B>Parameters:</B><DD><CODE>throwable</CODE> - the exception that the task failed with. 399 <DT><B>Returns:</B><DD>true if the state was successfully changed. 400 <DT><B>Throws:</B> 401 <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> 402 </DD> 403 </DL> 404 <HR> 405 406 <A NAME="cancel()"><!-- --></A><H3> 407 cancel</H3> 408 <PRE> 409 protected final boolean <B>cancel</B>()</PRE> 410 <DL> 411 <DD>Subclasses should invoke this method to mark the future as cancelled. 412 This will set the state of the future to <CODE>AbstractFuture.Sync.CANCELLED</CODE> and call <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html#done()"><CODE>done()</CODE></A> if the state was 413 successfully changed. 414 <P> 415 <DD><DL> 416 </DL> 417 </DD> 418 <DD><DL> 419 420 <DT><B>Returns:</B><DD>true if the state was successfully changed.</DL> 421 </DD> 422 </DL> 423 <HR> 424 425 <A NAME="done()"><!-- --></A><H3> 426 done</H3> 427 <PRE> 428 protected void <B>done</B>()</PRE> 429 <DL> 430 <DD><DL> 431 </DL> 432 </DD> 433 <DD><DL> 434 </DL> 435 </DD> 436 </DL> 437 <!-- ========= END OF CLASS DATA ========= --> 438 <HR> 439 440 441 <!-- ======= START OF BOTTOM NAVBAR ====== --> 442 <A NAME="navbar_bottom"><!-- --></A> 443 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 444 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 445 <TR> 446 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 447 <A NAME="navbar_bottom_firstrow"><!-- --></A> 448 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 449 <TR ALIGN="center" VALIGN="top"> 450 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 451 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 452 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 453 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AbstractFuture.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 454 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 455 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 456 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 457 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 458 </TR> 459 </TABLE> 460 </TD> 461 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 462 </EM> 463 </TD> 464 </TR> 465 466 <TR> 467 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 468 <A HREF="../../../../../com/google/common/util/concurrent/AbstractExecutionThreadService.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A> 469 <A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html" title="class in com.google.common.util.concurrent"><B>NEXT CLASS</B></A></FONT></TD> 470 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 471 <A HREF="../../../../../index.html?com/google/common/util/concurrent/AbstractFuture.html" target="_top"><B>FRAMES</B></A> 472 <A HREF="AbstractFuture.html" target="_top"><B>NO FRAMES</B></A> 473 <SCRIPT type="text/javascript"> 474 <!-- 475 if(window==top) { 476 document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 477 } 478 //--> 479 </SCRIPT> 480 <NOSCRIPT> 481 <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> 482 </NOSCRIPT> 483 484 485 </FONT></TD> 486 </TR> 487 <TR> 488 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 489 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 490 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 491 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 492 </TR> 493 </TABLE> 494 <A NAME="skip-navbar_bottom"></A> 495 <!-- ======== END OF BOTTOM NAVBAR ======= --> 496 497 <HR> 498 499 </BODY> 500 </HTML> 501