KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > thread > ThreadControl


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the LICENSE.txt file.
7  */

8 package org.apache.avalon.excalibur.thread;
9
10 /**
11  * This interface defines the method through which Threads can be controller.
12  *
13  * @author <a HREF="mailto:peter@apache.org">Peter Donald</a>
14  */

15 public interface ThreadControl
16 {
17     /**
18      * Wait for specified time for thread to complete it's work.
19      *
20      * @param milliSeconds the duration in milliseconds to wait until the thread has finished work
21      * @exception IllegalStateException if isValid() == false
22      * @exception InterruptedException if another thread has interrupted the current thread.
23      * The interrupted status of the current thread is cleared when this exception
24      * is thrown.
25      */

26     void join( long milliSeconds )
27         throws IllegalStateException JavaDoc, InterruptedException JavaDoc;
28
29     /**
30      * Call Thread.interupt() on thread being controlled.
31      *
32      * @exception IllegalStateException if isValid() == false
33      * @exception SecurityException if caller does not have permission to call interupt()
34      */

35     void interupt()
36         throws IllegalStateException JavaDoc, SecurityException JavaDoc;
37
38     /**
39      * Determine if thread has finished execution
40      *
41      * @return true if thread is finished, false otherwise
42      */

43     boolean isFinished();
44
45     /**
46      * Retrieve throwable that caused thread to cease execution.
47      * Only valid when true == isFinished()
48      *
49      * @return the throwable that caused thread to finish execution
50      */

51     Throwable JavaDoc getThrowable();
52 }
53
Popular Tags