Home | History | Annotate | Download | only in concurrent
      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 SimpleTimeLimiter (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="SimpleTimeLimiter (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/SimpleTimeLimiter.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/NamingThreadFactory.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A>&nbsp;
     59 &nbsp;<A HREF="../../../../../com/google/common/util/concurrent/TimeLimiter.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/SimpleTimeLimiter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
     62 &nbsp;<A HREF="SimpleTimeLimiter.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;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
     80 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
     81 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&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">
     91 com.google.common.util.concurrent</FONT>
     92 <BR>
     93 Class SimpleTimeLimiter</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.SimpleTimeLimiter</B>
     97 </PRE>
     98 <DL>
     99 <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../com/google/common/util/concurrent/TimeLimiter.html" title="interface in com.google.common.util.concurrent">TimeLimiter</A></DD>
    100 </DL>
    101 <HR>
    102 <DL>
    103 <DT><PRE>public class <B>SimpleTimeLimiter</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="../../../../../com/google/common/util/concurrent/TimeLimiter.html" title="interface in com.google.common.util.concurrent">TimeLimiter</A></DL>
    104 </PRE>
    105 
    106 <P>
    107 A TimeLimiter that runs method calls in the background using an
    108  <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>ExecutorService</CODE></A>.  If the time limit expires for a given method call,
    109  the thread running the call will be interrupted.
    110 <P>
    111 
    112 <P>
    113 <DL>
    114 <DT><B>Since:</B></DT>
    115   <DD>2009.09.15 <b>tentative</b></DD>
    116 <DT><B>Author:</B></DT>
    117   <DD>Kevin Bourrillion</DD>
    118 </DL>
    119 <HR>
    120 
    121 <P>
    122 
    123 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
    124 
    125 <A NAME="constructor_summary"><!-- --></A>
    126 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    127 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    128 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
    129 <B>Constructor Summary</B></FONT></TH>
    130 </TR>
    131 <TR BGCOLOR="white" CLASS="TableRowColor">
    132 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/SimpleTimeLimiter.html#SimpleTimeLimiter()">SimpleTimeLimiter</A></B>()</CODE>
    133 
    134 <BR>
    135 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a TimeLimiter instance using a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executors.html?is-external=true#newCachedThreadPool()" title="class or interface in java.util.concurrent"><CODE>Executors.newCachedThreadPool()</CODE></A> to execute proxied
    136  method calls.</TD>
    137 </TR>
    138 <TR BGCOLOR="white" CLASS="TableRowColor">
    139 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/SimpleTimeLimiter.html#SimpleTimeLimiter(java.util.concurrent.ExecutorService)">SimpleTimeLimiter</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html?is-external=true" title="class or interface in java.util.concurrent">ExecutorService</A>&nbsp;executor)</CODE>
    140 
    141 <BR>
    142 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Constructs a TimeLimiter instance using the given executor service to
    143  execute proxied method calls.</TD>
    144 </TR>
    145 </TABLE>
    146 &nbsp;
    147 <!-- ========== METHOD SUMMARY =========== -->
    148 
    149 <A NAME="method_summary"><!-- --></A>
    150 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    151 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    152 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
    153 <B>Method Summary</B></FONT></TH>
    154 </TR>
    155 <TR BGCOLOR="white" CLASS="TableRowColor">
    156 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    157 <CODE>
    158 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    159 <TR ALIGN="right" VALIGN="">
    160 <TD NOWRAP><FONT SIZE="-1">
    161 <CODE>&lt;T&gt; T</CODE></FONT></TD>
    162 </TR>
    163 </TABLE>
    164 </CODE></FONT></TD>
    165 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/SimpleTimeLimiter.html#callWithTimeout(java.util.concurrent.Callable, long, java.util.concurrent.TimeUnit, boolean)">callWithTimeout</A></B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</A>&lt;T&gt;&nbsp;callable,
    166                 long&nbsp;timeoutDuration,
    167                 <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;timeoutUnit,
    168                 boolean&nbsp;amInterruptible)</CODE>
    169 
    170 <BR>
    171 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Invokes a specified Callable, timing out after the specified time limit.</TD>
    172 </TR>
    173 <TR BGCOLOR="white" CLASS="TableRowColor">
    174 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    175 <CODE>
    176 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" SUMMARY="">
    177 <TR ALIGN="right" VALIGN="">
    178 <TD NOWRAP><FONT SIZE="-1">
    179 <CODE>&lt;T&gt; T</CODE></FONT></TD>
    180 </TR>
    181 </TABLE>
    182 </CODE></FONT></TD>
    183 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/SimpleTimeLimiter.html#newProxy(T, java.lang.Class, long, java.util.concurrent.TimeUnit)">newProxy</A></B>(T&nbsp;target,
    184          <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;T&gt;&nbsp;interfaceType,
    185          long&nbsp;timeoutDuration,
    186          <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;timeoutUnit)</CODE>
    187 
    188 <BR>
    189 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an instance of <code>interfaceType</code> that delegates all method
    190  calls to the <code>target</code> object, enforcing the specified time limit on
    191  each call.</TD>
    192 </TR>
    193 </TABLE>
    194 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
    195 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    196 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
    197 <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>
    198 </TR>
    199 <TR BGCOLOR="white" CLASS="TableRowColor">
    200 <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>
    201 </TR>
    202 </TABLE>
    203 &nbsp;
    204 <P>
    205 
    206 <!-- ========= CONSTRUCTOR DETAIL ======== -->
    207 
    208 <A NAME="constructor_detail"><!-- --></A>
    209 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    210 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    211 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
    212 <B>Constructor Detail</B></FONT></TH>
    213 </TR>
    214 </TABLE>
    215 
    216 <A NAME="SimpleTimeLimiter(java.util.concurrent.ExecutorService)"><!-- --></A><H3>
    217 SimpleTimeLimiter</H3>
    218 <PRE>
    219 public <B>SimpleTimeLimiter</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/ExecutorService.html?is-external=true" title="class or interface in java.util.concurrent">ExecutorService</A>&nbsp;executor)</PRE>
    220 <DL>
    221 <DD>Constructs a TimeLimiter instance using the given executor service to
    222  execute proxied method calls.
    223  <p>
    224  <b>Warning:</b> using a bounded executor
    225  may be counterproductive!  If the thread pool fills up, any time callers
    226  spend waiting for a thread may count toward their time limit, and in
    227  this case the call may even time out before the target method is ever
    228  invoked.
    229 <P>
    230 <DL>
    231 <DT><B>Parameters:</B><DD><CODE>executor</CODE> - the ExecutorService that will execute the method calls on
    232      the target objects; for example, a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executors.html?is-external=true#newCachedThreadPool()" title="class or interface in java.util.concurrent"><CODE>Executors.newCachedThreadPool()</CODE></A>.</DL>
    233 </DL>
    234 <HR>
    235 
    236 <A NAME="SimpleTimeLimiter()"><!-- --></A><H3>
    237 SimpleTimeLimiter</H3>
    238 <PRE>
    239 public <B>SimpleTimeLimiter</B>()</PRE>
    240 <DL>
    241 <DD>Constructs a TimeLimiter instance using a <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executors.html?is-external=true#newCachedThreadPool()" title="class or interface in java.util.concurrent"><CODE>Executors.newCachedThreadPool()</CODE></A> to execute proxied
    242  method calls.
    243 
    244  <p><b>Warning:</b> using a bounded executor may be counterproductive! If
    245  the thread pool fills up, any time callers spend waiting for a thread may
    246  count toward their time limit, and in this case the call may even time out
    247  before the target method is ever invoked.
    248 <P>
    249 </DL>
    250 
    251 <!-- ============ METHOD DETAIL ========== -->
    252 
    253 <A NAME="method_detail"><!-- --></A>
    254 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    255 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    256 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
    257 <B>Method Detail</B></FONT></TH>
    258 </TR>
    259 </TABLE>
    260 
    261 <A NAME="newProxy(java.lang.Object,java.lang.Class,long,java.util.concurrent.TimeUnit)"><!-- --></A><A NAME="newProxy(T, java.lang.Class, long, java.util.concurrent.TimeUnit)"><!-- --></A><H3>
    262 newProxy</H3>
    263 <PRE>
    264 public &lt;T&gt; T <B>newProxy</B>(T&nbsp;target,
    265                       <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Class.html?is-external=true" title="class or interface in java.lang">Class</A>&lt;T&gt;&nbsp;interfaceType,
    266                       long&nbsp;timeoutDuration,
    267                       <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;timeoutUnit)</PRE>
    268 <DL>
    269 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/util/concurrent/TimeLimiter.html#newProxy(T, java.lang.Class, long, java.util.concurrent.TimeUnit)">TimeLimiter</A></CODE></B></DD>
    270 <DD>Returns an instance of <code>interfaceType</code> that delegates all method
    271  calls to the <code>target</code> object, enforcing the specified time limit on
    272  each call.  This time-limited delegation is also performed for calls to
    273  <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"><CODE>Object.equals(java.lang.Object)</CODE></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"><CODE>Object.hashCode()</CODE></A>, and
    274  <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"><CODE>Object.toString()</CODE></A>.
    275  <p>
    276  If the target method call finishes before the limit is reached, the return
    277  value or exception is propagated to the caller exactly as-is. If, on the
    278  other hand, the time limit is reached, the proxy will attempt to abort the
    279  call to the target, and will throw an <A HREF="../../../../../com/google/common/util/concurrent/UncheckedTimeoutException.html" title="class in com.google.common.util.concurrent"><CODE>UncheckedTimeoutException</CODE></A> to
    280  the caller.
    281  <p>
    282  It is important to note that the primary purpose of the proxy object is to
    283  return control to the caller when the timeout elapses; aborting the target
    284  method call is of secondary concern.  The particular nature and strength
    285  of the guarantees made by the proxy is implementation-dependent.  However,
    286  it is important that each of the methods on the target object behaves
    287  appropriately when its thread is interrupted.
    288 <P>
    289 <DD><DL>
    290 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/google/common/util/concurrent/TimeLimiter.html#newProxy(T, java.lang.Class, long, java.util.concurrent.TimeUnit)">newProxy</A></CODE> in interface <CODE><A HREF="../../../../../com/google/common/util/concurrent/TimeLimiter.html" title="interface in com.google.common.util.concurrent">TimeLimiter</A></CODE></DL>
    291 </DD>
    292 <DD><DL>
    293 <DT><B>Parameters:</B><DD><CODE>target</CODE> - the object to proxy<DD><CODE>interfaceType</CODE> - the interface you wish the returned proxy to
    294      implement<DD><CODE>timeoutDuration</CODE> - with timeoutUnit, the maximum length of time that
    295      callers are willing to wait on each method call to the proxy<DD><CODE>timeoutUnit</CODE> - with timeoutDuration, the maximum length of time that
    296      callers are willing to wait on each method call to the proxy
    297 <DT><B>Returns:</B><DD>a time-limiting proxy</DL>
    298 </DD>
    299 </DL>
    300 <HR>
    301 
    302 <A NAME="callWithTimeout(java.util.concurrent.Callable, long, java.util.concurrent.TimeUnit, boolean)"><!-- --></A><H3>
    303 callWithTimeout</H3>
    304 <PRE>
    305 public &lt;T&gt; T <B>callWithTimeout</B>(<A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html?is-external=true" title="class or interface in java.util.concurrent">Callable</A>&lt;T&gt;&nbsp;callable,
    306                              long&nbsp;timeoutDuration,
    307                              <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;timeoutUnit,
    308                              boolean&nbsp;amInterruptible)
    309                   throws <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></PRE>
    310 <DL>
    311 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/util/concurrent/TimeLimiter.html#callWithTimeout(java.util.concurrent.Callable, long, java.util.concurrent.TimeUnit, boolean)">TimeLimiter</A></CODE></B></DD>
    312 <DD>Invokes a specified Callable, timing out after the specified time limit.
    313  If the target method call finished before the limit is reached, the return
    314  value or exception is propagated to the caller exactly as-is.  If, on the
    315  other hand, the time limit is reached, we attempt to abort the call to the
    316  target, and throw an <A HREF="../../../../../com/google/common/util/concurrent/UncheckedTimeoutException.html" title="class in com.google.common.util.concurrent"><CODE>UncheckedTimeoutException</CODE></A> to the caller.
    317  <p>
    318  <b>Warning:</b> The future of this method is in doubt.  It may be nuked, or
    319  changed significantly.
    320 <P>
    321 <DD><DL>
    322 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/google/common/util/concurrent/TimeLimiter.html#callWithTimeout(java.util.concurrent.Callable, long, java.util.concurrent.TimeUnit, boolean)">callWithTimeout</A></CODE> in interface <CODE><A HREF="../../../../../com/google/common/util/concurrent/TimeLimiter.html" title="interface in com.google.common.util.concurrent">TimeLimiter</A></CODE></DL>
    323 </DD>
    324 <DD><DL>
    325 <DT><B>Parameters:</B><DD><CODE>callable</CODE> - the Callable to execute<DD><CODE>timeoutDuration</CODE> - with timeoutUnit, the maximum length of time to wait<DD><CODE>timeoutUnit</CODE> - with timeoutDuration, the maximum length of time to wait<DD><CODE>amInterruptible</CODE> - whether to respond to thread interruption by aborting
    326      the operation and throwing InterruptedException; if false, the
    327      operation is allowed to complete or time out, and the current thread's
    328      interrupt status is re-asserted.
    329 <DT><B>Returns:</B><DD>the result returned by the Callable
    330 <DT><B>Throws:</B>
    331 <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> - if <code>interruptible</code> is true and our
    332      thread is interrupted during execution
    333 <DD><CODE><A HREF="../../../../../com/google/common/util/concurrent/UncheckedTimeoutException.html" title="class in com.google.common.util.concurrent">UncheckedTimeoutException</A></CODE> - if the time limit is reached
    334 <DD><CODE><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></CODE></DL>
    335 </DD>
    336 </DL>
    337 <!-- ========= END OF CLASS DATA ========= -->
    338 <HR>
    339 
    340 
    341 <!-- ======= START OF BOTTOM NAVBAR ====== -->
    342 <A NAME="navbar_bottom"><!-- --></A>
    343 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
    344 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
    345 <TR>
    346 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
    347 <A NAME="navbar_bottom_firstrow"><!-- --></A>
    348 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
    349   <TR ALIGN="center" VALIGN="top">
    350   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
    351   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
    352   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
    353   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/SimpleTimeLimiter.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
    354   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
    355   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
    356   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
    357   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
    358   </TR>
    359 </TABLE>
    360 </TD>
    361 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
    362 </EM>
    363 </TD>
    364 </TR>
    365 
    366 <TR>
    367 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    368 &nbsp;<A HREF="../../../../../com/google/common/util/concurrent/NamingThreadFactory.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A>&nbsp;
    369 &nbsp;<A HREF="../../../../../com/google/common/util/concurrent/TimeLimiter.html" title="interface in com.google.common.util.concurrent"><B>NEXT CLASS</B></A></FONT></TD>
    370 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    371   <A HREF="../../../../../index.html?com/google/common/util/concurrent/SimpleTimeLimiter.html" target="_top"><B>FRAMES</B></A>  &nbsp;
    372 &nbsp;<A HREF="SimpleTimeLimiter.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
    373 &nbsp;<SCRIPT type="text/javascript">
    374   <!--
    375   if(window==top) {
    376     document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
    377   }
    378   //-->
    379 </SCRIPT>
    380 <NOSCRIPT>
    381   <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
    382 </NOSCRIPT>
    383 
    384 
    385 </FONT></TD>
    386 </TR>
    387 <TR>
    388 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    389   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
    390 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    391 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
    392 </TR>
    393 </TABLE>
    394 <A NAME="skip-navbar_bottom"></A>
    395 <!-- ======== END OF BOTTOM NAVBAR ======= -->
    396 
    397 <HR>
    398 
    399 </BODY>
    400 </HTML>
    401