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