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 AbstractService (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="AbstractService (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/AbstractService.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/AbstractListenableFuture.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A>&nbsp;
     59 &nbsp;<A HREF="../../../../../com/google/common/util/concurrent/Callables.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/AbstractService.html" target="_top"><B>FRAMES</B></A>  &nbsp;
     62 &nbsp;<A HREF="AbstractService.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 AbstractService</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.AbstractService</B>
     97 </PRE>
     98 <DL>
     99 <DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../../../../com/google/common/base/Service.html" title="interface in com.google.common.base">Service</A></DD>
    100 </DL>
    101 <HR>
    102 <DL>
    103 <DT><PRE>public abstract class <B>AbstractService</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/base/Service.html" title="interface in com.google.common.base">Service</A></DL>
    104 </PRE>
    105 
    106 <P>
    107 Base class for implementing services that can handle <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#doStart()"><CODE>doStart()</CODE></A> and
    108  <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#doStop()"><CODE>doStop()</CODE></A> requests, responding to them with <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#notifyStarted()"><CODE>notifyStarted()</CODE></A>
    109  and <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#notifyStopped()"><CODE>notifyStopped()</CODE></A> callbacks. Its subclasses must manage threads
    110  manually; consider <A HREF="../../../../../com/google/common/util/concurrent/AbstractExecutionThreadService.html" title="class in com.google.common.util.concurrent"><CODE>AbstractExecutionThreadService</CODE></A> if you need only a
    111  single execution thread.
    112 <P>
    113 
    114 <P>
    115 <DL>
    116 <DT><B>Since:</B></DT>
    117   <DD>2009.09.15 <b>tentative</b></DD>
    118 <DT><B>Author:</B></DT>
    119   <DD>Jesse Wilson</DD>
    120 </DL>
    121 <HR>
    122 
    123 <P>
    124 <!-- ======== NESTED CLASS SUMMARY ======== -->
    125 
    126 <A NAME="nested_class_summary"><!-- --></A>
    127 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    128 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    129 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
    130 <B>Nested Class Summary</B></FONT></TH>
    131 </TR>
    132 </TABLE>
    133 &nbsp;<A NAME="nested_classes_inherited_from_class_com.google.common.base.Service"><!-- --></A>
    134 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    135 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
    136 <TH ALIGN="left"><B>Nested classes/interfaces inherited from interface com.google.common.base.<A HREF="../../../../../com/google/common/base/Service.html" title="interface in com.google.common.base">Service</A></B></TH>
    137 </TR>
    138 <TR BGCOLOR="white" CLASS="TableRowColor">
    139 <TD><CODE><A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A></CODE></TD>
    140 </TR>
    141 </TABLE>
    142 &nbsp;
    143 
    144 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
    145 
    146 <A NAME="constructor_summary"><!-- --></A>
    147 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    148 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    149 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
    150 <B>Constructor Summary</B></FONT></TH>
    151 </TR>
    152 <TR BGCOLOR="white" CLASS="TableRowColor">
    153 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#AbstractService()">AbstractService</A></B>()</CODE>
    154 
    155 <BR>
    156 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
    157 </TR>
    158 </TABLE>
    159 &nbsp;
    160 <!-- ========== METHOD SUMMARY =========== -->
    161 
    162 <A NAME="method_summary"><!-- --></A>
    163 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    164 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    165 <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
    166 <B>Method Summary</B></FONT></TH>
    167 </TR>
    168 <TR BGCOLOR="white" CLASS="TableRowColor">
    169 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    170 <CODE>protected abstract &nbsp;void</CODE></FONT></TD>
    171 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#doStart()">doStart</A></B>()</CODE>
    172 
    173 <BR>
    174 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method is called by <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#start()"><CODE>start()</CODE></A> to initiate service startup.</TD>
    175 </TR>
    176 <TR BGCOLOR="white" CLASS="TableRowColor">
    177 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    178 <CODE>protected abstract &nbsp;void</CODE></FONT></TD>
    179 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#doStop()">doStop</A></B>()</CODE>
    180 
    181 <BR>
    182 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This method should be used to initiate service shutdown.</TD>
    183 </TR>
    184 <TR BGCOLOR="white" CLASS="TableRowColor">
    185 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    186 <CODE>&nbsp;boolean</CODE></FONT></TD>
    187 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#isRunning()">isRunning</A></B>()</CODE>
    188 
    189 <BR>
    190 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns <code>true</code> if this service is <A HREF="../../../../../com/google/common/base/Service.State.html#RUNNING"><CODE>running</CODE></A>.</TD>
    191 </TR>
    192 <TR BGCOLOR="white" CLASS="TableRowColor">
    193 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    194 <CODE>protected &nbsp;void</CODE></FONT></TD>
    195 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#notifyFailed(java.lang.Throwable)">notifyFailed</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;cause)</CODE>
    196 
    197 <BR>
    198 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Invoke this method to transition the service to the
    199  <A HREF="../../../../../com/google/common/base/Service.State.html#FAILED"><CODE>Service.State.FAILED</CODE></A>.</TD>
    200 </TR>
    201 <TR BGCOLOR="white" CLASS="TableRowColor">
    202 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    203 <CODE>protected &nbsp;void</CODE></FONT></TD>
    204 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#notifyStarted()">notifyStarted</A></B>()</CODE>
    205 
    206 <BR>
    207 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Implementing classes should invoke this method once their service has
    208  started.</TD>
    209 </TR>
    210 <TR BGCOLOR="white" CLASS="TableRowColor">
    211 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    212 <CODE>protected &nbsp;void</CODE></FONT></TD>
    213 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#notifyStopped()">notifyStopped</A></B>()</CODE>
    214 
    215 <BR>
    216 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Implementing classes should invoke this method once their service has
    217  stopped.</TD>
    218 </TR>
    219 <TR BGCOLOR="white" CLASS="TableRowColor">
    220 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    221 <CODE>&nbsp;<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;<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A>&gt;</CODE></FONT></TD>
    222 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#start()">start</A></B>()</CODE>
    223 
    224 <BR>
    225 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If the service state is <A HREF="../../../../../com/google/common/base/Service.State.html#NEW"><CODE>Service.State.NEW</CODE></A>, this initiates service startup
    226  and returns immediately.</TD>
    227 </TR>
    228 <TR BGCOLOR="white" CLASS="TableRowColor">
    229 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    230 <CODE>&nbsp;<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A></CODE></FONT></TD>
    231 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#startAndWait()">startAndWait</A></B>()</CODE>
    232 
    233 <BR>
    234 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Initiates service startup (if necessary), returning once the service has
    235  finished starting.</TD>
    236 </TR>
    237 <TR BGCOLOR="white" CLASS="TableRowColor">
    238 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    239 <CODE>&nbsp;<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A></CODE></FONT></TD>
    240 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#state()">state</A></B>()</CODE>
    241 
    242 <BR>
    243 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the lifecycle state of the service.</TD>
    244 </TR>
    245 <TR BGCOLOR="white" CLASS="TableRowColor">
    246 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    247 <CODE>&nbsp;<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;<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A>&gt;</CODE></FONT></TD>
    248 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#stop()">stop</A></B>()</CODE>
    249 
    250 <BR>
    251 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If the service is <A HREF="../../../../../com/google/common/base/Service.State.html#STARTING"><CODE>Service.State.STARTING</CODE></A> or <A HREF="../../../../../com/google/common/base/Service.State.html#RUNNING"><CODE>Service.State.RUNNING</CODE></A>, this
    252  initiates service shutdown and returns immediately.</TD>
    253 </TR>
    254 <TR BGCOLOR="white" CLASS="TableRowColor">
    255 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
    256 <CODE>&nbsp;<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A></CODE></FONT></TD>
    257 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#stopAndWait()">stopAndWait</A></B>()</CODE>
    258 
    259 <BR>
    260 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Initiates service shutdown (if necessary), returning once the service has
    261  finished stopping.</TD>
    262 </TR>
    263 </TABLE>
    264 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
    265 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    266 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
    267 <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>
    268 </TR>
    269 <TR BGCOLOR="white" CLASS="TableRowColor">
    270 <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>
    271 </TR>
    272 </TABLE>
    273 &nbsp;
    274 <P>
    275 
    276 <!-- ========= CONSTRUCTOR DETAIL ======== -->
    277 
    278 <A NAME="constructor_detail"><!-- --></A>
    279 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    280 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    281 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
    282 <B>Constructor Detail</B></FONT></TH>
    283 </TR>
    284 </TABLE>
    285 
    286 <A NAME="AbstractService()"><!-- --></A><H3>
    287 AbstractService</H3>
    288 <PRE>
    289 public <B>AbstractService</B>()</PRE>
    290 <DL>
    291 </DL>
    292 
    293 <!-- ============ METHOD DETAIL ========== -->
    294 
    295 <A NAME="method_detail"><!-- --></A>
    296 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
    297 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
    298 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
    299 <B>Method Detail</B></FONT></TH>
    300 </TR>
    301 </TABLE>
    302 
    303 <A NAME="doStart()"><!-- --></A><H3>
    304 doStart</H3>
    305 <PRE>
    306 protected abstract void <B>doStart</B>()</PRE>
    307 <DL>
    308 <DD>This method is called by <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#start()"><CODE>start()</CODE></A> to initiate service startup. The
    309  invocation of this method should cause a call to <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#notifyStarted()"><CODE>notifyStarted()</CODE></A>,
    310  either during this method's run, or after it has returned. If startup
    311  fails, the invocation should cause a call to <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#notifyFailed(java.lang.Throwable)"><CODE>notifyFailed(Throwable)</CODE></A> instead.
    312 
    313  <p>This method should return promptly; prefer to do work on a different
    314  thread where it is convenient. It is invoked exactly once on service
    315  startup, even when <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#start()"><CODE>start()</CODE></A> is called multiple times.
    316 <P>
    317 <DD><DL>
    318 </DL>
    319 </DD>
    320 <DD><DL>
    321 </DL>
    322 </DD>
    323 </DL>
    324 <HR>
    325 
    326 <A NAME="doStop()"><!-- --></A><H3>
    327 doStop</H3>
    328 <PRE>
    329 protected abstract void <B>doStop</B>()</PRE>
    330 <DL>
    331 <DD>This method should be used to initiate service shutdown. The invocation
    332  of this method should cause a call to <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#notifyStopped()"><CODE>notifyStopped()</CODE></A>, either
    333  during this method's run, or after it has returned. If shutdown fails, the
    334  invocation should cause a call to <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#notifyFailed(java.lang.Throwable)"><CODE>notifyFailed(Throwable)</CODE></A> instead.
    335 
    336  <p>This method should return promptly; prefer to do work on a different
    337  thread where it is convenient. It is invoked exactly once on service
    338  shutdown, even when <A HREF="../../../../../com/google/common/util/concurrent/AbstractService.html#stop()"><CODE>stop()</CODE></A> is called multiple times.
    339 <P>
    340 <DD><DL>
    341 </DL>
    342 </DD>
    343 <DD><DL>
    344 </DL>
    345 </DD>
    346 </DL>
    347 <HR>
    348 
    349 <A NAME="start()"><!-- --></A><H3>
    350 start</H3>
    351 <PRE>
    352 public final <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;<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A>&gt; <B>start</B>()</PRE>
    353 <DL>
    354 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#start()">Service</A></CODE></B></DD>
    355 <DD>If the service state is <A HREF="../../../../../com/google/common/base/Service.State.html#NEW"><CODE>Service.State.NEW</CODE></A>, this initiates service startup
    356  and returns immediately. If the service has already been started, this
    357  method returns immediately without taking action. A stopped service may not
    358  be restarted.
    359 <P>
    360 <DD><DL>
    361 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/google/common/base/Service.html#start()">start</A></CODE> in interface <CODE><A HREF="../../../../../com/google/common/base/Service.html" title="interface in com.google.common.base">Service</A></CODE></DL>
    362 </DD>
    363 <DD><DL>
    364 
    365 <DT><B>Returns:</B><DD>a future for the startup result, regardless of whether this call
    366      initiated startup. Calling <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> will block until the
    367      service has finished starting, and returns one of <A HREF="../../../../../com/google/common/base/Service.State.html#RUNNING"><CODE>Service.State.RUNNING</CODE></A>, <A HREF="../../../../../com/google/common/base/Service.State.html#STOPPING"><CODE>Service.State.STOPPING</CODE></A> or <A HREF="../../../../../com/google/common/base/Service.State.html#TERMINATED"><CODE>Service.State.TERMINATED</CODE></A>. If
    368      the service fails to start, <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> will throw an <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>, and the service's state will be <A HREF="../../../../../com/google/common/base/Service.State.html#FAILED"><CODE>Service.State.FAILED</CODE></A>. If it has already finished starting, <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>
    369      returns immediately. Cancelling the returned future is unsupported and
    370      always returns <code>false</code>.</DL>
    371 </DD>
    372 </DL>
    373 <HR>
    374 
    375 <A NAME="stop()"><!-- --></A><H3>
    376 stop</H3>
    377 <PRE>
    378 public final <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;<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A>&gt; <B>stop</B>()</PRE>
    379 <DL>
    380 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#stop()">Service</A></CODE></B></DD>
    381 <DD>If the service is <A HREF="../../../../../com/google/common/base/Service.State.html#STARTING"><CODE>Service.State.STARTING</CODE></A> or <A HREF="../../../../../com/google/common/base/Service.State.html#RUNNING"><CODE>Service.State.RUNNING</CODE></A>, this
    382  initiates service shutdown and returns immediately. If this is <A HREF="../../../../../com/google/common/base/Service.State.html#NEW"><CODE>Service.State.NEW</CODE></A>, it is <A HREF="../../../../../com/google/common/base/Service.State.html#TERMINATED"><CODE>terminated</CODE></A> without having been
    383  started nor stopped.  If the service has already been stopped, this
    384  method returns immediately without taking action.
    385 <P>
    386 <DD><DL>
    387 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/google/common/base/Service.html#stop()">stop</A></CODE> in interface <CODE><A HREF="../../../../../com/google/common/base/Service.html" title="interface in com.google.common.base">Service</A></CODE></DL>
    388 </DD>
    389 <DD><DL>
    390 
    391 <DT><B>Returns:</B><DD>a future for the shutdown result, regardless of whether this call
    392      initiated shutdown. Calling <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> will block until the
    393      service has finished shutting down, and either returns <A HREF="../../../../../com/google/common/base/Service.State.html#TERMINATED"><CODE>Service.State.TERMINATED</CODE></A> or throws an <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>. If it has
    394      already finished stopping, <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> returns immediately.
    395      Cancelling this future is unsupported and always returns <code>false</code>.</DL>
    396 </DD>
    397 </DL>
    398 <HR>
    399 
    400 <A NAME="startAndWait()"><!-- --></A><H3>
    401 startAndWait</H3>
    402 <PRE>
    403 public <A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A> <B>startAndWait</B>()</PRE>
    404 <DL>
    405 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#startAndWait()">Service</A></CODE></B></DD>
    406 <DD>Initiates service startup (if necessary), returning once the service has
    407  finished starting. Unlike calling <code>start().get()</code>, this method throws
    408  no checked exceptions.
    409 <P>
    410 <DD><DL>
    411 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/google/common/base/Service.html#startAndWait()">startAndWait</A></CODE> in interface <CODE><A HREF="../../../../../com/google/common/base/Service.html" title="interface in com.google.common.base">Service</A></CODE></DL>
    412 </DD>
    413 <DD><DL>
    414 
    415 <DT><B>Returns:</B><DD>the state of the service when startup finished.</DL>
    416 </DD>
    417 </DL>
    418 <HR>
    419 
    420 <A NAME="stopAndWait()"><!-- --></A><H3>
    421 stopAndWait</H3>
    422 <PRE>
    423 public <A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A> <B>stopAndWait</B>()</PRE>
    424 <DL>
    425 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#stopAndWait()">Service</A></CODE></B></DD>
    426 <DD>Initiates service shutdown (if necessary), returning once the service has
    427  finished stopping. If this is <A HREF="../../../../../com/google/common/base/Service.State.html#STARTING"><CODE>Service.State.STARTING</CODE></A>, startup will be
    428  cancelled. If this is <A HREF="../../../../../com/google/common/base/Service.State.html#NEW"><CODE>Service.State.NEW</CODE></A>, it is <A HREF="../../../../../com/google/common/base/Service.State.html#TERMINATED"><CODE>terminated</CODE></A> without having been started nor stopped. Unlike calling <code>stop().get()</code>, this method throws no checked exceptions.
    429 <P>
    430 <DD><DL>
    431 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/google/common/base/Service.html#stopAndWait()">stopAndWait</A></CODE> in interface <CODE><A HREF="../../../../../com/google/common/base/Service.html" title="interface in com.google.common.base">Service</A></CODE></DL>
    432 </DD>
    433 <DD><DL>
    434 
    435 <DT><B>Returns:</B><DD>the state of the service when shutdown finished.</DL>
    436 </DD>
    437 </DL>
    438 <HR>
    439 
    440 <A NAME="notifyStarted()"><!-- --></A><H3>
    441 notifyStarted</H3>
    442 <PRE>
    443 protected final void <B>notifyStarted</B>()</PRE>
    444 <DL>
    445 <DD>Implementing classes should invoke this method once their service has
    446  started. It will cause the service to transition from <A HREF="../../../../../com/google/common/base/Service.State.html#STARTING"><CODE>Service.State.STARTING</CODE></A> to <A HREF="../../../../../com/google/common/base/Service.State.html#RUNNING"><CODE>Service.State.RUNNING</CODE></A>.
    447 <P>
    448 <DD><DL>
    449 </DL>
    450 </DD>
    451 <DD><DL>
    452 
    453 <DT><B>Throws:</B>
    454 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the service is not
    455      <A HREF="../../../../../com/google/common/base/Service.State.html#STARTING"><CODE>Service.State.STARTING</CODE></A>.</DL>
    456 </DD>
    457 </DL>
    458 <HR>
    459 
    460 <A NAME="notifyStopped()"><!-- --></A><H3>
    461 notifyStopped</H3>
    462 <PRE>
    463 protected final void <B>notifyStopped</B>()</PRE>
    464 <DL>
    465 <DD>Implementing classes should invoke this method once their service has
    466  stopped. It will cause the service to transition from <A HREF="../../../../../com/google/common/base/Service.State.html#STOPPING"><CODE>Service.State.STOPPING</CODE></A> to <A HREF="../../../../../com/google/common/base/Service.State.html#TERMINATED"><CODE>Service.State.TERMINATED</CODE></A>.
    467 <P>
    468 <DD><DL>
    469 </DL>
    470 </DD>
    471 <DD><DL>
    472 
    473 <DT><B>Throws:</B>
    474 <DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the service is neither <A HREF="../../../../../com/google/common/base/Service.State.html#STOPPING"><CODE>Service.State.STOPPING</CODE></A> nor <A HREF="../../../../../com/google/common/base/Service.State.html#RUNNING"><CODE>Service.State.RUNNING</CODE></A>.</DL>
    475 </DD>
    476 </DL>
    477 <HR>
    478 
    479 <A NAME="notifyFailed(java.lang.Throwable)"><!-- --></A><H3>
    480 notifyFailed</H3>
    481 <PRE>
    482 protected final void <B>notifyFailed</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;cause)</PRE>
    483 <DL>
    484 <DD>Invoke this method to transition the service to the
    485  <A HREF="../../../../../com/google/common/base/Service.State.html#FAILED"><CODE>Service.State.FAILED</CODE></A>. The service will <b>not be stopped</b> if it
    486  is running. Invoke this method when a service has failed critically or
    487  otherwise cannot be started nor stopped.
    488 <P>
    489 <DD><DL>
    490 </DL>
    491 </DD>
    492 <DD><DL>
    493 </DL>
    494 </DD>
    495 </DL>
    496 <HR>
    497 
    498 <A NAME="isRunning()"><!-- --></A><H3>
    499 isRunning</H3>
    500 <PRE>
    501 public final boolean <B>isRunning</B>()</PRE>
    502 <DL>
    503 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#isRunning()">Service</A></CODE></B></DD>
    504 <DD>Returns <code>true</code> if this service is <A HREF="../../../../../com/google/common/base/Service.State.html#RUNNING"><CODE>running</CODE></A>.
    505 <P>
    506 <DD><DL>
    507 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/google/common/base/Service.html#isRunning()">isRunning</A></CODE> in interface <CODE><A HREF="../../../../../com/google/common/base/Service.html" title="interface in com.google.common.base">Service</A></CODE></DL>
    508 </DD>
    509 <DD><DL>
    510 </DL>
    511 </DD>
    512 </DL>
    513 <HR>
    514 
    515 <A NAME="state()"><!-- --></A><H3>
    516 state</H3>
    517 <PRE>
    518 public final <A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A> <B>state</B>()</PRE>
    519 <DL>
    520 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#state()">Service</A></CODE></B></DD>
    521 <DD>Returns the lifecycle state of the service.
    522 <P>
    523 <DD><DL>
    524 <DT><B>Specified by:</B><DD><CODE><A HREF="../../../../../com/google/common/base/Service.html#state()">state</A></CODE> in interface <CODE><A HREF="../../../../../com/google/common/base/Service.html" title="interface in com.google.common.base">Service</A></CODE></DL>
    525 </DD>
    526 <DD><DL>
    527 </DL>
    528 </DD>
    529 </DL>
    530 <!-- ========= END OF CLASS DATA ========= -->
    531 <HR>
    532 
    533 
    534 <!-- ======= START OF BOTTOM NAVBAR ====== -->
    535 <A NAME="navbar_bottom"><!-- --></A>
    536 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
    537 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
    538 <TR>
    539 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
    540 <A NAME="navbar_bottom_firstrow"><!-- --></A>
    541 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
    542   <TR ALIGN="center" VALIGN="top">
    543   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
    544   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
    545   <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
    546   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/AbstractService.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
    547   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
    548   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
    549   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
    550   <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
    551   </TR>
    552 </TABLE>
    553 </TD>
    554 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
    555 </EM>
    556 </TD>
    557 </TR>
    558 
    559 <TR>
    560 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    561 &nbsp;<A HREF="../../../../../com/google/common/util/concurrent/AbstractListenableFuture.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A>&nbsp;
    562 &nbsp;<A HREF="../../../../../com/google/common/util/concurrent/Callables.html" title="class in com.google.common.util.concurrent"><B>NEXT CLASS</B></A></FONT></TD>
    563 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
    564   <A HREF="../../../../../index.html?com/google/common/util/concurrent/AbstractService.html" target="_top"><B>FRAMES</B></A>  &nbsp;
    565 &nbsp;<A HREF="AbstractService.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
    566 &nbsp;<SCRIPT type="text/javascript">
    567   <!--
    568   if(window==top) {
    569     document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
    570   }
    571   //-->
    572 </SCRIPT>
    573 <NOSCRIPT>
    574   <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
    575 </NOSCRIPT>
    576 
    577 
    578 </FONT></TD>
    579 </TR>
    580 <TR>
    581 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    582   SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
    583 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
    584 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
    585 </TR>
    586 </TABLE>
    587 <A NAME="skip-navbar_bottom"></A>
    588 <!-- ======== END OF BOTTOM NAVBAR ======= -->
    589 
    590 <HR>
    591 
    592 </BODY>
    593 </HTML>
    594