corba/src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolManagerImpl.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.impl.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.IOException;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    29
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    30
import java.security.PrivilegedAction;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    31
import java.security.AccessController;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    32
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    33
import java.util.concurrent.atomic.AtomicInteger;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    34
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    35
import com.sun.corba.se.spi.orb.ORB;
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
import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException;
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool;
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolChooser;
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl;
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
import com.sun.corba.se.impl.orbutil.ORBConstants;
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
13171
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    45
import com.sun.corba.se.impl.logging.ORBUtilSystemException;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    46
import com.sun.corba.se.impl.orbutil.ORBConstants;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    47
import com.sun.corba.se.spi.logging.CORBALogDomains;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    48
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    49
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
public class ThreadPoolManagerImpl implements ThreadPoolManager
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
{
13171
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    52
    private ThreadPool threadPool;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    53
    private ThreadGroup threadGroup;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    54
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    55
    private static final ORBUtilSystemException wrapper =
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    56
        ORBUtilSystemException.get(CORBALogDomains.RPC_TRANSPORT);
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    57
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    58
    public ThreadPoolManagerImpl() {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    59
        threadGroup = getThreadGroup();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    60
        threadPool = new ThreadPoolImpl(threadGroup,
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    61
            ORBConstants.THREADPOOL_DEFAULT_NAME);
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    62
    }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    63
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    64
    private static AtomicInteger tgCount = new AtomicInteger();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    65
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    66
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    67
    private ThreadGroup getThreadGroup() {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    68
        ThreadGroup tg;
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
13171
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    70
        // See bugs 4916766 and 4936203
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    71
        // We intend to create new threads in a reliable thread group.
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    72
        // This avoids problems if the application/applet
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    73
        // creates a thread group, makes JavaIDL calls which create a new
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    74
        // connection and ReaderThread, and then destroys the thread
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    75
        // group. If our ReaderThreads were to be part of such destroyed thread
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    76
        // group then it might get killed and cause other invoking threads
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    77
        // sharing the same connection to get a non-restartable
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    78
        // CommunicationFailure. We'd like to avoid that.
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    79
        //
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    80
        // Our solution is to create all of our threads in the highest thread
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    81
        // group that we have access to, given our own security clearance.
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    82
        //
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    83
        try {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    84
            // try to get a thread group that's as high in the threadgroup
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    85
            // parent-child hierarchy, as we can get to.
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    86
            // this will prevent an ORB thread created during applet-init from
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    87
            // being killed when an applet dies.
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    88
            tg = AccessController.doPrivileged(
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    89
                new PrivilegedAction<ThreadGroup>() {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    90
                    public ThreadGroup run() {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    91
                        ThreadGroup tg = Thread.currentThread().getThreadGroup();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    92
                        ThreadGroup ptg = tg;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    93
                        try {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    94
                            while (ptg != null) {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    95
                                tg = ptg;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    96
                                ptg = tg.getParent();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    97
                            }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    98
                        } catch (SecurityException se) {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
    99
                            // Discontinue going higher on a security exception.
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   100
                        }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   101
                        return new ThreadGroup(tg, "ORB ThreadGroup " + tgCount.getAndIncrement());
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   102
                    }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   103
                }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   104
            );
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   105
        } catch (SecurityException e) {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   106
            // something wrong, we go back to the original code
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   107
            tg = Thread.currentThread().getThreadGroup();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   108
        }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   109
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   110
        return tg;
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   111
    }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   112
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   113
    public void close() {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   114
        try {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   115
            threadPool.close();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   116
        } catch (IOException exc) {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   117
            wrapper.threadPoolCloseError();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   118
        }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   119
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   120
        try {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   121
            boolean isDestroyed = threadGroup.isDestroyed();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   122
            int numThreads = threadGroup.activeCount();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   123
            int numGroups = threadGroup.activeGroupCount();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   124
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   125
            if (isDestroyed) {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   126
                wrapper.threadGroupIsDestroyed(threadGroup);
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   127
            } else {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   128
                if (numThreads > 0)
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   129
                    wrapper.threadGroupHasActiveThreadsInClose(threadGroup, numThreads);
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   130
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   131
                if (numGroups > 0)
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   132
                    wrapper.threadGroupHasSubGroupsInClose(threadGroup, numGroups);
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   133
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   134
                threadGroup.destroy();
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   135
            }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   136
        } catch (IllegalThreadStateException exc) {
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   137
            wrapper.threadGroupDestroyFailed(exc, threadGroup);
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   138
        }
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   139
1ac5e9a54a6e 7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8
coffeys
parents: 5555
diff changeset
   140
        threadGroup = null;
4
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
    * This method will return an instance of the threadpool given a threadpoolId,
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
    * that can be used by any component in the app. server.
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
    *
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
    * @throws NoSuchThreadPoolException thrown when invalid threadpoolId is passed
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
    * as a parameter
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
    */
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
    public ThreadPool getThreadPool(String threadpoolId)
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
        throws NoSuchThreadPoolException {
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
        return threadPool;
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
    * This method will return an instance of the threadpool given a numeric threadpoolId.
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
    * This method will be used by the ORB to support the functionality of
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
    * dedicated threadpool for EJB beans
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
    *
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
    * @throws NoSuchThreadPoolException thrown when invalidnumericIdForThreadpool is passed
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
    * as a parameter
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
    */
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
    public ThreadPool getThreadPool(int numericIdForThreadpool)
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
        throws NoSuchThreadPoolException {
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
        return threadPool;
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
    * This method is used to return the numeric id of the threadpool, given a String
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
    * threadpoolId. This is used by the POA interceptors to add the numeric threadpool
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
    * Id, as a tagged component in the IOR. This is used to provide the functionality of
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
    * dedicated threadpool for EJB beans
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
    */
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
    public int  getThreadPoolNumericId(String threadpoolId) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
        return 0;
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
    * Return a String Id for a numericId of a threadpool managed by the threadpool
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
    * manager
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
    */
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
    public String getThreadPoolStringId(int numericIdForThreadpool) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
       return "";
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
    * Returns the first instance of ThreadPool in the ThreadPoolManager
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
    */
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
    public ThreadPool getDefaultThreadPool() {
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
        return threadPool;
02bb8761fcce Initial load
duke
parents:
diff changeset
   193
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   194
02bb8761fcce Initial load
duke
parents:
diff changeset
   195
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   196
     * Return an instance of ThreadPoolChooser based on the componentId that was
02bb8761fcce Initial load
duke
parents:
diff changeset
   197
     * passed as argument
02bb8761fcce Initial load
duke
parents:
diff changeset
   198
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   199
    public ThreadPoolChooser getThreadPoolChooser(String componentId) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   200
        //FIXME: This method is not used, but should be fixed once
02bb8761fcce Initial load
duke
parents:
diff changeset
   201
        //nio select starts working and we start using ThreadPoolChooser
02bb8761fcce Initial load
duke
parents:
diff changeset
   202
        return null;
02bb8761fcce Initial load
duke
parents:
diff changeset
   203
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   204
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   205
     * Return an instance of ThreadPoolChooser based on the componentIndex that was
02bb8761fcce Initial load
duke
parents:
diff changeset
   206
     * passed as argument. This is added for improved performance so that the caller
02bb8761fcce Initial load
duke
parents:
diff changeset
   207
     * does not have to pay the cost of computing hashcode for the componentId
02bb8761fcce Initial load
duke
parents:
diff changeset
   208
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   209
    public ThreadPoolChooser getThreadPoolChooser(int componentIndex) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   210
        //FIXME: This method is not used, but should be fixed once
02bb8761fcce Initial load
duke
parents:
diff changeset
   211
        //nio select starts working and we start using ThreadPoolChooser
02bb8761fcce Initial load
duke
parents:
diff changeset
   212
        return null;
02bb8761fcce Initial load
duke
parents:
diff changeset
   213
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   214
02bb8761fcce Initial load
duke
parents:
diff changeset
   215
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   216
     * Sets a ThreadPoolChooser for a particular componentId in the ThreadPoolManager. This
02bb8761fcce Initial load
duke
parents:
diff changeset
   217
     * would enable any component to add a ThreadPoolChooser for their specific use
02bb8761fcce Initial load
duke
parents:
diff changeset
   218
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   219
    public void setThreadPoolChooser(String componentId, ThreadPoolChooser aThreadPoolChooser) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   220
        //FIXME: This method is not used, but should be fixed once
02bb8761fcce Initial load
duke
parents:
diff changeset
   221
        //nio select starts working and we start using ThreadPoolChooser
02bb8761fcce Initial load
duke
parents:
diff changeset
   222
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   223
02bb8761fcce Initial load
duke
parents:
diff changeset
   224
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   225
     * Gets the numeric index associated with the componentId specified for a
02bb8761fcce Initial load
duke
parents:
diff changeset
   226
     * ThreadPoolChooser. This method would help the component call the more
02bb8761fcce Initial load
duke
parents:
diff changeset
   227
     * efficient implementation i.e. getThreadPoolChooser(int componentIndex)
02bb8761fcce Initial load
duke
parents:
diff changeset
   228
     */
02bb8761fcce Initial load
duke
parents:
diff changeset
   229
    public int getThreadPoolChooserNumericId(String componentId) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   230
        //FIXME: This method is not used, but should be fixed once
02bb8761fcce Initial load
duke
parents:
diff changeset
   231
        //nio select starts working and we start using ThreadPoolChooser
02bb8761fcce Initial load
duke
parents:
diff changeset
   232
        return 0;
02bb8761fcce Initial load
duke
parents:
diff changeset
   233
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   234
02bb8761fcce Initial load
duke
parents:
diff changeset
   235
}
02bb8761fcce Initial load
duke
parents:
diff changeset
   236
02bb8761fcce Initial load
duke
parents:
diff changeset
   237
// End of file.