1 /* 2 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package com.sun.corba.se.spi.orbutil.threadpool; 27 28 29 public interface ThreadPool 30 { 31 /** 32 * This method will return any instance of the WorkQueue. If the ThreadPool 33 * instance only services one WorkQueue then that WorkQueue instance will 34 * be returned. If there are more than one WorkQueues serviced by this 35 * ThreadPool, then this method would return a WorkQueue based on the 36 * implementation of the class that implements this interface. For PE 8.0 we 37 * would return a WorkQueue in a roundrobin fashion everytime this method 38 * is called. In the future we could allow pluggability of Policy objects for this. 39 */ 40 public WorkQueue getAnyWorkQueue(); 41 42 /** 43 * This method will return an instance of the of the WorkQueue given a queueId. 44 * This will be useful in situations where there are more than one WorkQueues 45 * managed by the ThreadPool and the user of the ThreadPool wants to always use 46 * the same WorkQueue for doing the Work. 47 * If the number of WorkQueues in the ThreadPool are 10, then queueIds will go 48 * from 0-9 49 * 50 * @throws NoSuchWorkQueueException thrown when queueId passed is invalid 51 */ 52 public WorkQueue getWorkQueue(int queueId) throws NoSuchWorkQueueException; 53 54 /** 55 * This method will return the number of WorkQueues serviced by the threadpool. 56 */ 57 public int numberOfWorkQueues(); 58 59 /** 60 * This method will return the minimum number of threads maintained by the threadpool. 61 */ 62 public int minimumNumberOfThreads(); 63 64 /** 65 * This method will return the maximum number of threads in the threadpool at any 66 * point in time, for the life of the threadpool 67 */ 68 public int maximumNumberOfThreads(); 69 70 /** 71 * This method will return the time in milliseconds when idle threads in the threadpool are 72 * removed. 73 */ 74 public long idleTimeoutForThreads(); 75 76 /** 77 * This method will return the current number of threads in the threadpool. This method 78 * returns a value which is not synchronized. 79 */ 80 public int currentNumberOfThreads(); 81 82 /** 83 * This method will return the number of available threads in the threadpool which are 84 * waiting for work. This method returns a value which is not synchronized. 85 */ 86 public int numberOfAvailableThreads(); 87 88 /** 89 * This method will return the number of busy threads in the threadpool 90 * This method returns a value which is not synchronized. 91 */ 92 public int numberOfBusyThreads(); 93 94 /** 95 * This method returns the number of Work items processed by the threadpool 96 */ 97 public long currentProcessedCount(); 98 99 /** 100 * This method returns the average elapsed time taken to complete a Work 101 * item. 102 */ 103 public long averageWorkCompletionTime(); 104 105 /** 106 * This method will return the name of the threadpool. 107 */ 108 public String getName(); 109 110 } 111 112 // End of file.