1 /*
2 * Copyright (c) 2002, 2013, 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
153 ByteBufferPool byteBufferPool;
154
155 // Local testing
156 // XXX clean this up, probably remove these
157 public abstract boolean isLocalHost( String hostName ) ;
158 public abstract boolean isLocalServerId( int subcontractId, int serverId ) ;
159
160 // Invocation stack manipulation
161 public abstract OAInvocationInfo peekInvocationInfo() ;
162 public abstract void pushInvocationInfo( OAInvocationInfo info ) ;
163 public abstract OAInvocationInfo popInvocationInfo() ;
164
165 public abstract CorbaTransportManager getCorbaTransportManager();
166 public abstract LegacyServerSocketManager getLegacyServerSocketManager();
167
168 // wrapperMap maintains a table of LogWrapper instances used by
169 // different classes to log exceptions. The key is a StringPair
170 // representing LogDomain and ExceptionGroup.
171 private Map wrapperMap ;
172
173 private static Map staticWrapperMap = new ConcurrentHashMap();
174
175 protected MonitoringManager monitoringManager;
176
177 private static PresentationManager setupPresentationManager() {
178 staticWrapper = ORBUtilSystemException.get(
179 CORBALogDomains.RPC_PRESENTATION ) ;
180
181 boolean useDynamicStub =
182 ((Boolean)AccessController.doPrivileged(
183 new PrivilegedAction() {
184 public java.lang.Object run() {
185 return Boolean.valueOf( Boolean.getBoolean (
186 ORBConstants.USE_DYNAMIC_STUB_PROPERTY ) ) ;
187 }
188 }
189 )).booleanValue() ;
190
191 PresentationManager.StubFactoryFactory dynamicStubFactoryFactory =
192 (PresentationManager.StubFactoryFactory)AccessController.doPrivileged(
218 pm.setStubFactoryFactory( false,
219 PresentationDefaults.getStaticStubFactoryFactory() ) ;
220 pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
221 return pm;
222 }
223
224 public void destroy() {
225 wrapper = null;
226 omgWrapper = null;
227 typeCodeMap = null;
228 primitiveTypeCodeConstants = null;
229 byteBufferPool = null;
230 }
231
232 /**
233 * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific
234 * AppContext to hold it. Creates and records one if needed.
235 */
236 public static PresentationManager getPresentationManager()
237 {
238 AppContext ac = AppContext.getAppContext();
239 PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class);
240 if (pm == null) {
241 pm = setupPresentationManager();
242 ac.put(PresentationManager.class, pm);
243 }
244 return pm;
245 }
246
247 /** Get the appropriate StubFactoryFactory. This
248 * will be dynamic or static depending on whether
249 * com.sun.CORBA.ORBUseDynamicStub is true or false.
250 */
251 public static PresentationManager.StubFactoryFactory
252 getStubFactoryFactory()
253 {
254 PresentationManager gPM = getPresentationManager();
255 boolean useDynamicStubs = gPM.useDynamicStubs() ;
256 return gPM.getStubFactoryFactory( useDynamicStubs ) ;
257 }
258
259 protected ORB()
260 {
261 // Initialize logging first, since it is needed nearly
262 // everywhere (for example, in TypeCodeImpl).
263 wrapperMap = new ConcurrentHashMap();
264 wrapper = ORBUtilSystemException.get( this,
265 CORBALogDomains.RPC_PRESENTATION ) ;
266 omgWrapper = OMGSystemException.get( this,
|
1 /*
2 * Copyright (c) 2002, 2014, 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
153 ByteBufferPool byteBufferPool;
154
155 // Local testing
156 // XXX clean this up, probably remove these
157 public abstract boolean isLocalHost( String hostName ) ;
158 public abstract boolean isLocalServerId( int subcontractId, int serverId ) ;
159
160 // Invocation stack manipulation
161 public abstract OAInvocationInfo peekInvocationInfo() ;
162 public abstract void pushInvocationInfo( OAInvocationInfo info ) ;
163 public abstract OAInvocationInfo popInvocationInfo() ;
164
165 public abstract CorbaTransportManager getCorbaTransportManager();
166 public abstract LegacyServerSocketManager getLegacyServerSocketManager();
167
168 // wrapperMap maintains a table of LogWrapper instances used by
169 // different classes to log exceptions. The key is a StringPair
170 // representing LogDomain and ExceptionGroup.
171 private Map wrapperMap ;
172
173 static class Holder {
174 static final PresentationManager defaultPresentationManager =
175 setupPresentationManager();
176 }
177 private static final Object pmLock = new Object();
178
179 private static Map staticWrapperMap = new ConcurrentHashMap();
180
181 protected MonitoringManager monitoringManager;
182
183 private static PresentationManager setupPresentationManager() {
184 staticWrapper = ORBUtilSystemException.get(
185 CORBALogDomains.RPC_PRESENTATION ) ;
186
187 boolean useDynamicStub =
188 ((Boolean)AccessController.doPrivileged(
189 new PrivilegedAction() {
190 public java.lang.Object run() {
191 return Boolean.valueOf( Boolean.getBoolean (
192 ORBConstants.USE_DYNAMIC_STUB_PROPERTY ) ) ;
193 }
194 }
195 )).booleanValue() ;
196
197 PresentationManager.StubFactoryFactory dynamicStubFactoryFactory =
198 (PresentationManager.StubFactoryFactory)AccessController.doPrivileged(
224 pm.setStubFactoryFactory( false,
225 PresentationDefaults.getStaticStubFactoryFactory() ) ;
226 pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
227 return pm;
228 }
229
230 public void destroy() {
231 wrapper = null;
232 omgWrapper = null;
233 typeCodeMap = null;
234 primitiveTypeCodeConstants = null;
235 byteBufferPool = null;
236 }
237
238 /**
239 * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific
240 * AppContext to hold it. Creates and records one if needed.
241 */
242 public static PresentationManager getPresentationManager()
243 {
244 SecurityManager sm = System.getSecurityManager();
245 if (sm != null && AppContext.getAppContexts().size() > 0) {
246 AppContext ac = AppContext.getAppContext();
247 if (ac != null) {
248 synchronized (pmLock) {
249 PresentationManager pm =
250 (PresentationManager) ac.get(PresentationManager.class);
251 if (pm == null) {
252 pm = setupPresentationManager();
253 ac.put(PresentationManager.class, pm);
254 }
255 return pm;
256 }
257 }
258 }
259
260 // No security manager or AppContext
261 return Holder.defaultPresentationManager;
262 }
263
264 /** Get the appropriate StubFactoryFactory. This
265 * will be dynamic or static depending on whether
266 * com.sun.CORBA.ORBUseDynamicStub is true or false.
267 */
268 public static PresentationManager.StubFactoryFactory
269 getStubFactoryFactory()
270 {
271 PresentationManager gPM = getPresentationManager();
272 boolean useDynamicStubs = gPM.useDynamicStubs() ;
273 return gPM.getStubFactoryFactory( useDynamicStubs ) ;
274 }
275
276 protected ORB()
277 {
278 // Initialize logging first, since it is needed nearly
279 // everywhere (for example, in TypeCodeImpl).
280 wrapperMap = new ConcurrentHashMap();
281 wrapper = ORBUtilSystemException.get( this,
282 CORBALogDomains.RPC_PRESENTATION ) ;
283 omgWrapper = OMGSystemException.get( this,
|