author | coffeys |
Wed, 27 Jun 2012 21:09:29 +0100 | |
changeset 13171 | 1ac5e9a54a6e |
parent 5555 | b2b5ed3f0d0d |
permissions | -rw-r--r-- |
4 | 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 | 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 |
|
5555 | 7 |
* published by the Free Software Foundation. Oracle designates this |
4 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5555 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
4 | 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 |
* |
|
5555 | 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. |
|
4 | 24 |
*/ |
25 |
||
26 |
package com.sun.corba.se.impl.orbutil.threadpool; |
|
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 | 37 |
import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException; |
38 |
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool; |
|
39 |
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager; |
|
40 |
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolChooser; |
|
41 |
||
42 |
import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl; |
|
43 |
import com.sun.corba.se.impl.orbutil.ORBConstants; |
|
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 | 50 |
public class ThreadPoolManagerImpl implements ThreadPoolManager |
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 | 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 | 141 |
} |
142 |
||
143 |
/** |
|
144 |
* This method will return an instance of the threadpool given a threadpoolId, |
|
145 |
* that can be used by any component in the app. server. |
|
146 |
* |
|
147 |
* @throws NoSuchThreadPoolException thrown when invalid threadpoolId is passed |
|
148 |
* as a parameter |
|
149 |
*/ |
|
150 |
public ThreadPool getThreadPool(String threadpoolId) |
|
151 |
throws NoSuchThreadPoolException { |
|
152 |
||
153 |
return threadPool; |
|
154 |
} |
|
155 |
||
156 |
/** |
|
157 |
* This method will return an instance of the threadpool given a numeric threadpoolId. |
|
158 |
* This method will be used by the ORB to support the functionality of |
|
159 |
* dedicated threadpool for EJB beans |
|
160 |
* |
|
161 |
* @throws NoSuchThreadPoolException thrown when invalidnumericIdForThreadpool is passed |
|
162 |
* as a parameter |
|
163 |
*/ |
|
164 |
public ThreadPool getThreadPool(int numericIdForThreadpool) |
|
165 |
throws NoSuchThreadPoolException { |
|
166 |
||
167 |
return threadPool; |
|
168 |
} |
|
169 |
||
170 |
/** |
|
171 |
* This method is used to return the numeric id of the threadpool, given a String |
|
172 |
* threadpoolId. This is used by the POA interceptors to add the numeric threadpool |
|
173 |
* Id, as a tagged component in the IOR. This is used to provide the functionality of |
|
174 |
* dedicated threadpool for EJB beans |
|
175 |
*/ |
|
176 |
public int getThreadPoolNumericId(String threadpoolId) { |
|
177 |
return 0; |
|
178 |
} |
|
179 |
||
180 |
/** |
|
181 |
* Return a String Id for a numericId of a threadpool managed by the threadpool |
|
182 |
* manager |
|
183 |
*/ |
|
184 |
public String getThreadPoolStringId(int numericIdForThreadpool) { |
|
185 |
return ""; |
|
186 |
} |
|
187 |
||
188 |
/** |
|
189 |
* Returns the first instance of ThreadPool in the ThreadPoolManager |
|
190 |
*/ |
|
191 |
public ThreadPool getDefaultThreadPool() { |
|
192 |
return threadPool; |
|
193 |
} |
|
194 |
||
195 |
/** |
|
196 |
* Return an instance of ThreadPoolChooser based on the componentId that was |
|
197 |
* passed as argument |
|
198 |
*/ |
|
199 |
public ThreadPoolChooser getThreadPoolChooser(String componentId) { |
|
200 |
//FIXME: This method is not used, but should be fixed once |
|
201 |
//nio select starts working and we start using ThreadPoolChooser |
|
202 |
return null; |
|
203 |
} |
|
204 |
/** |
|
205 |
* Return an instance of ThreadPoolChooser based on the componentIndex that was |
|
206 |
* passed as argument. This is added for improved performance so that the caller |
|
207 |
* does not have to pay the cost of computing hashcode for the componentId |
|
208 |
*/ |
|
209 |
public ThreadPoolChooser getThreadPoolChooser(int componentIndex) { |
|
210 |
//FIXME: This method is not used, but should be fixed once |
|
211 |
//nio select starts working and we start using ThreadPoolChooser |
|
212 |
return null; |
|
213 |
} |
|
214 |
||
215 |
/** |
|
216 |
* Sets a ThreadPoolChooser for a particular componentId in the ThreadPoolManager. This |
|
217 |
* would enable any component to add a ThreadPoolChooser for their specific use |
|
218 |
*/ |
|
219 |
public void setThreadPoolChooser(String componentId, ThreadPoolChooser aThreadPoolChooser) { |
|
220 |
//FIXME: This method is not used, but should be fixed once |
|
221 |
//nio select starts working and we start using ThreadPoolChooser |
|
222 |
} |
|
223 |
||
224 |
/** |
|
225 |
* Gets the numeric index associated with the componentId specified for a |
|
226 |
* ThreadPoolChooser. This method would help the component call the more |
|
227 |
* efficient implementation i.e. getThreadPoolChooser(int componentIndex) |
|
228 |
*/ |
|
229 |
public int getThreadPoolChooserNumericId(String componentId) { |
|
230 |
//FIXME: This method is not used, but should be fixed once |
|
231 |
//nio select starts working and we start using ThreadPoolChooser |
|
232 |
return 0; |
|
233 |
} |
|
234 |
||
235 |
} |
|
236 |
||
237 |
// End of file. |