KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > spi > orbutil > threadpool > ThreadPool


1 /*
2  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
3  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4  */

5
6 package com.sun.corba.se.spi.orbutil.threadpool;
7
8
9 public interface ThreadPool
10 {
11     /**
12     * This method will return any instance of the WorkQueue. If the ThreadPool
13     * instance only services one WorkQueue then that WorkQueue instance will
14     * be returned. If there are more than one WorkQueues serviced by this
15     * ThreadPool, then this method would return a WorkQueue based on the
16     * implementation of the class that implements this interface. For PE 8.0 we
17     * would return a WorkQueue in a roundrobin fashion everytime this method
18     * is called. In the future we could allow pluggability of Policy objects for this.
19     */

20     public WorkQueue getAnyWorkQueue();
21
22     /**
23     * This method will return an instance of the of the WorkQueue given a queueId.
24     * This will be useful in situations where there are more than one WorkQueues
25     * managed by the ThreadPool and the user of the ThreadPool wants to always use
26     * the same WorkQueue for doing the Work.
27     * If the number of WorkQueues in the ThreadPool are 10, then queueIds will go
28     * from 0-9
29     *
30     * @throws NoSuchWorkQueueException thrown when queueId passed is invalid
31     */

32     public WorkQueue getWorkQueue(int queueId) throws NoSuchWorkQueueException;
33
34     /**
35     * This method will return the number of WorkQueues serviced by the threadpool.
36     */

37     public int numberOfWorkQueues();
38
39     /**
40     * This method will return the minimum number of threads maintained by the threadpool.
41     */

42     public int minimumNumberOfThreads();
43
44     /**
45     * This method will return the maximum number of threads in the threadpool at any
46     * point in time, for the life of the threadpool
47     */

48     public int maximumNumberOfThreads();
49
50     /**
51     * This method will return the time in milliseconds when idle threads in the threadpool are
52     * removed.
53     */

54     public long idleTimeoutForThreads();
55
56     /**
57     * This method will return the current number of threads in the threadpool. This method
58     * returns a value which is not synchronized.
59     */

60     public int currentNumberOfThreads();
61
62     /**
63     * This method will return the number of available threads in the threadpool which are
64      * waiting for work. This method returns a value which is not synchronized.
65     */

66     public int numberOfAvailableThreads();
67
68     /**
69     * This method will return the number of busy threads in the threadpool
70     * This method returns a value which is not synchronized.
71     */

72     public int numberOfBusyThreads();
73
74     /**
75     * This method returns the number of Work items processed by the threadpool
76     */

77     public long currentProcessedCount();
78
79      /**
80      * This method returns the average elapsed time taken to complete a Work
81      * item.
82      */

83     public long averageWorkCompletionTime();
84
85     /**
86     * This method will return the name of the threadpool.
87     */

88     public String JavaDoc getName();
89
90 }
91
92 // End of file.
93
Popular Tags