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 AbstractIdleService (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="AbstractIdleService (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/AbstractIdleService.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/AbstractFuture.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A> 59 <A HREF="../../../../../com/google/common/util/concurrent/AbstractListenableFuture.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/AbstractIdleService.html" target="_top"><B>FRAMES</B></A> 62 <A HREF="AbstractIdleService.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 AbstractIdleService</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.AbstractIdleService</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>AbstractIdleService</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 services that do not need a thread while "running" 108 but may need one during startup and shutdown. Subclasses can 109 implement <A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#startUp()"><CODE>startUp()</CODE></A> and <A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#shutDown()"><CODE>shutDown()</CODE></A> methods, each 110 which run in a executor which by default uses a separate thread 111 for each method. 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>Chris Nokleberg</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 <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 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/AbstractIdleService.html#AbstractIdleService()">AbstractIdleService</A></B>()</CODE> 154 155 <BR> 156 </TD> 157 </TR> 158 </TABLE> 159 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 <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent">Executor</A></CODE></FONT></TD> 171 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#executor(com.google.common.base.Service.State)">executor</A></B>(<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A> state)</CODE> 172 173 <BR> 174 Returns the <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>Executor</CODE></A> that will be used to run this service.</TD> 175 </TR> 176 <TR BGCOLOR="white" CLASS="TableRowColor"> 177 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 178 <CODE> boolean</CODE></FONT></TD> 179 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#isRunning()">isRunning</A></B>()</CODE> 180 181 <BR> 182 Returns <code>true</code> if this service is <A HREF="../../../../../com/google/common/base/Service.State.html#RUNNING"><CODE>running</CODE></A>.</TD> 183 </TR> 184 <TR BGCOLOR="white" CLASS="TableRowColor"> 185 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 186 <CODE>protected abstract void</CODE></FONT></TD> 187 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#shutDown()">shutDown</A></B>()</CODE> 188 189 <BR> 190 Stop the service.</TD> 191 </TR> 192 <TR BGCOLOR="white" CLASS="TableRowColor"> 193 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 194 <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/base/Service.State.html" title="enum in com.google.common.base">Service.State</A>></CODE></FONT></TD> 195 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#start()">start</A></B>()</CODE> 196 197 <BR> 198 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 199 and returns immediately.</TD> 200 </TR> 201 <TR BGCOLOR="white" CLASS="TableRowColor"> 202 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 203 <CODE> <A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A></CODE></FONT></TD> 204 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#startAndWait()">startAndWait</A></B>()</CODE> 205 206 <BR> 207 Initiates service startup (if necessary), returning once the service has 208 finished starting.</TD> 209 </TR> 210 <TR BGCOLOR="white" CLASS="TableRowColor"> 211 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 212 <CODE>protected abstract void</CODE></FONT></TD> 213 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#startUp()">startUp</A></B>()</CODE> 214 215 <BR> 216 Start the service.</TD> 217 </TR> 218 <TR BGCOLOR="white" CLASS="TableRowColor"> 219 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 220 <CODE> <A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A></CODE></FONT></TD> 221 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#state()">state</A></B>()</CODE> 222 223 <BR> 224 Returns the lifecycle state of the service.</TD> 225 </TR> 226 <TR BGCOLOR="white" CLASS="TableRowColor"> 227 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 228 <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/base/Service.State.html" title="enum in com.google.common.base">Service.State</A>></CODE></FONT></TD> 229 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#stop()">stop</A></B>()</CODE> 230 231 <BR> 232 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 233 initiates service shutdown and returns immediately.</TD> 234 </TR> 235 <TR BGCOLOR="white" CLASS="TableRowColor"> 236 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 237 <CODE> <A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A></CODE></FONT></TD> 238 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#stopAndWait()">stopAndWait</A></B>()</CODE> 239 240 <BR> 241 Initiates service shutdown (if necessary), returning once the service has 242 finished stopping.</TD> 243 </TR> 244 <TR BGCOLOR="white" CLASS="TableRowColor"> 245 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> 246 <CODE> <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD> 247 <TD><CODE><B><A HREF="../../../../../com/google/common/util/concurrent/AbstractIdleService.html#toString()">toString</A></B>()</CODE> 248 249 <BR> 250 </TD> 251 </TR> 252 </TABLE> 253 <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> 254 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 255 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> 256 <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> 257 </TR> 258 <TR BGCOLOR="white" CLASS="TableRowColor"> 259 <TD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD> 260 </TR> 261 </TABLE> 262 263 <P> 264 265 <!-- ========= CONSTRUCTOR DETAIL ======== --> 266 267 <A NAME="constructor_detail"><!-- --></A> 268 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 269 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 270 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 271 <B>Constructor Detail</B></FONT></TH> 272 </TR> 273 </TABLE> 274 275 <A NAME="AbstractIdleService()"><!-- --></A><H3> 276 AbstractIdleService</H3> 277 <PRE> 278 public <B>AbstractIdleService</B>()</PRE> 279 <DL> 280 </DL> 281 282 <!-- ============ METHOD DETAIL ========== --> 283 284 <A NAME="method_detail"><!-- --></A> 285 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> 286 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> 287 <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> 288 <B>Method Detail</B></FONT></TH> 289 </TR> 290 </TABLE> 291 292 <A NAME="startUp()"><!-- --></A><H3> 293 startUp</H3> 294 <PRE> 295 protected abstract void <B>startUp</B>() 296 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> 297 <DL> 298 <DD>Start the service. 299 <P> 300 <DD><DL> 301 </DL> 302 </DD> 303 <DD><DL> 304 305 <DT><B>Throws:</B> 306 <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> 307 </DD> 308 </DL> 309 <HR> 310 311 <A NAME="shutDown()"><!-- --></A><H3> 312 shutDown</H3> 313 <PRE> 314 protected abstract void <B>shutDown</B>() 315 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> 316 <DL> 317 <DD>Stop the service. 318 <P> 319 <DD><DL> 320 </DL> 321 </DD> 322 <DD><DL> 323 324 <DT><B>Throws:</B> 325 <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> 326 </DD> 327 </DL> 328 <HR> 329 330 <A NAME="executor(com.google.common.base.Service.State)"><!-- --></A><H3> 331 executor</H3> 332 <PRE> 333 protected <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent">Executor</A> <B>executor</B>(<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A> state)</PRE> 334 <DL> 335 <DD>Returns the <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>Executor</CODE></A> that will be used to run this service. 336 Subclasses may override this method to use a custom <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true" title="class or interface in java.util.concurrent"><CODE>Executor</CODE></A>, which 337 may configure its worker thread with a specific name, thread group or 338 priority. The returned executor's <A HREF="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executor.html?is-external=true#execute(java.lang.Runnable)" title="class or interface in java.util.concurrent"><CODE>execute()</CODE></A> method is called when this service is started and stopped, 339 and should return promptly. 340 <P> 341 <DD><DL> 342 </DL> 343 </DD> 344 <DD><DL> 345 <DT><B>Parameters:</B><DD><CODE>state</CODE> - <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#STOPPING"><CODE>Service.State.STOPPING</CODE></A>, used by the 346 default implementation for naming the thread</DL> 347 </DD> 348 </DL> 349 <HR> 350 351 <A NAME="toString()"><!-- --></A><H3> 352 toString</H3> 353 <PRE> 354 public <A HREF="http://java.sun.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>toString</B>()</PRE> 355 <DL> 356 <DD><DL> 357 <DT><B>Overrides:</B><DD><CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A></CODE> in class <CODE><A HREF="http://java.sun.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></CODE></DL> 358 </DD> 359 <DD><DL> 360 </DL> 361 </DD> 362 </DL> 363 <HR> 364 365 <A NAME="start()"><!-- --></A><H3> 366 start</H3> 367 <PRE> 368 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><<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A>> <B>start</B>()</PRE> 369 <DL> 370 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#start()">Service</A></CODE></B></DD> 371 <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 372 and returns immediately. If the service has already been started, this 373 method returns immediately without taking action. A stopped service may not 374 be restarted. 375 <P> 376 <DD><DL> 377 <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> 378 </DD> 379 <DD><DL> 380 381 <DT><B>Returns:</B><DD>a future for the startup result, regardless of whether this call 382 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 383 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 384 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> 385 returns immediately. Cancelling the returned future is unsupported and 386 always returns <code>false</code>.</DL> 387 </DD> 388 </DL> 389 <HR> 390 391 <A NAME="startAndWait()"><!-- --></A><H3> 392 startAndWait</H3> 393 <PRE> 394 public final <A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A> <B>startAndWait</B>()</PRE> 395 <DL> 396 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#startAndWait()">Service</A></CODE></B></DD> 397 <DD>Initiates service startup (if necessary), returning once the service has 398 finished starting. Unlike calling <code>start().get()</code>, this method throws 399 no checked exceptions. 400 <P> 401 <DD><DL> 402 <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> 403 </DD> 404 <DD><DL> 405 406 <DT><B>Returns:</B><DD>the state of the service when startup finished.</DL> 407 </DD> 408 </DL> 409 <HR> 410 411 <A NAME="isRunning()"><!-- --></A><H3> 412 isRunning</H3> 413 <PRE> 414 public final boolean <B>isRunning</B>()</PRE> 415 <DL> 416 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#isRunning()">Service</A></CODE></B></DD> 417 <DD>Returns <code>true</code> if this service is <A HREF="../../../../../com/google/common/base/Service.State.html#RUNNING"><CODE>running</CODE></A>. 418 <P> 419 <DD><DL> 420 <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> 421 </DD> 422 <DD><DL> 423 </DL> 424 </DD> 425 </DL> 426 <HR> 427 428 <A NAME="state()"><!-- --></A><H3> 429 state</H3> 430 <PRE> 431 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> 432 <DL> 433 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#state()">Service</A></CODE></B></DD> 434 <DD>Returns the lifecycle state of the service. 435 <P> 436 <DD><DL> 437 <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> 438 </DD> 439 <DD><DL> 440 </DL> 441 </DD> 442 </DL> 443 <HR> 444 445 <A NAME="stop()"><!-- --></A><H3> 446 stop</H3> 447 <PRE> 448 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><<A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A>> <B>stop</B>()</PRE> 449 <DL> 450 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#stop()">Service</A></CODE></B></DD> 451 <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 452 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 453 started nor stopped. If the service has already been stopped, this 454 method returns immediately without taking action. 455 <P> 456 <DD><DL> 457 <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> 458 </DD> 459 <DD><DL> 460 461 <DT><B>Returns:</B><DD>a future for the shutdown result, regardless of whether this call 462 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 463 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 464 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. 465 Cancelling this future is unsupported and always returns <code>false</code>.</DL> 466 </DD> 467 </DL> 468 <HR> 469 470 <A NAME="stopAndWait()"><!-- --></A><H3> 471 stopAndWait</H3> 472 <PRE> 473 public final <A HREF="../../../../../com/google/common/base/Service.State.html" title="enum in com.google.common.base">Service.State</A> <B>stopAndWait</B>()</PRE> 474 <DL> 475 <DD><B>Description copied from interface: <CODE><A HREF="../../../../../com/google/common/base/Service.html#stopAndWait()">Service</A></CODE></B></DD> 476 <DD>Initiates service shutdown (if necessary), returning once the service has 477 finished stopping. If this is <A HREF="../../../../../com/google/common/base/Service.State.html#STARTING"><CODE>Service.State.STARTING</CODE></A>, startup will be 478 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. 479 <P> 480 <DD><DL> 481 <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> 482 </DD> 483 <DD><DL> 484 485 <DT><B>Returns:</B><DD>the state of the service when shutdown finished.</DL> 486 </DD> 487 </DL> 488 <!-- ========= END OF CLASS DATA ========= --> 489 <HR> 490 491 492 <!-- ======= START OF BOTTOM NAVBAR ====== --> 493 <A NAME="navbar_bottom"><!-- --></A> 494 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> 495 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> 496 <TR> 497 <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> 498 <A NAME="navbar_bottom_firstrow"><!-- --></A> 499 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> 500 <TR ALIGN="center" VALIGN="top"> 501 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> 502 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> 503 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> 504 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/AbstractIdleService.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> 505 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> 506 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> 507 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> 508 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> 509 </TR> 510 </TABLE> 511 </TD> 512 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> 513 </EM> 514 </TD> 515 </TR> 516 517 <TR> 518 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 519 <A HREF="../../../../../com/google/common/util/concurrent/AbstractFuture.html" title="class in com.google.common.util.concurrent"><B>PREV CLASS</B></A> 520 <A HREF="../../../../../com/google/common/util/concurrent/AbstractListenableFuture.html" title="class in com.google.common.util.concurrent"><B>NEXT CLASS</B></A></FONT></TD> 521 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> 522 <A HREF="../../../../../index.html?com/google/common/util/concurrent/AbstractIdleService.html" target="_top"><B>FRAMES</B></A> 523 <A HREF="AbstractIdleService.html" target="_top"><B>NO FRAMES</B></A> 524 <SCRIPT type="text/javascript"> 525 <!-- 526 if(window==top) { 527 document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>'); 528 } 529 //--> 530 </SCRIPT> 531 <NOSCRIPT> 532 <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A> 533 </NOSCRIPT> 534 535 536 </FONT></TD> 537 </TR> 538 <TR> 539 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 540 SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD> 541 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> 542 DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD> 543 </TR> 544 </TABLE> 545 <A NAME="skip-navbar_bottom"></A> 546 <!-- ======== END OF BOTTOM NAVBAR ======= --> 547 548 <HR> 549 550 </BODY> 551 </HTML> 552