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