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(
216
217 PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ;
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 private static PresentationManager defaultPresentationManager;
174
175 private static Map staticWrapperMap = new ConcurrentHashMap();
176
177 protected MonitoringManager monitoringManager;
178
179 private static PresentationManager setupPresentationManager() {
180 staticWrapper = ORBUtilSystemException.get(
181 CORBALogDomains.RPC_PRESENTATION ) ;
182
183 boolean useDynamicStub =
184 ((Boolean)AccessController.doPrivileged(
185 new PrivilegedAction() {
186 public java.lang.Object run() {
187 return Boolean.valueOf( Boolean.getBoolean (
188 ORBConstants.USE_DYNAMIC_STUB_PROPERTY ) ) ;
189 }
190 }
191 )).booleanValue() ;
192
193 PresentationManager.StubFactoryFactory dynamicStubFactoryFactory =
194 (PresentationManager.StubFactoryFactory)AccessController.doPrivileged(
218
219 PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ;
220 pm.setStubFactoryFactory( false,
221 PresentationDefaults.getStaticStubFactoryFactory() ) ;
222 pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
223 return pm;
224 }
225
226 public void destroy() {
227 wrapper = null;
228 omgWrapper = null;
229 typeCodeMap = null;
230 primitiveTypeCodeConstants = null;
231 byteBufferPool = null;
232 }
233
234 /**
235 * Returns the Presentation Manager for the current thread group, using the ThreadGroup-specific
236 * AppContext to hold it. Creates and records one if needed.
237 */
238 public synchronized static PresentationManager getPresentationManager()
239 {
240 SecurityManager sm = System.getSecurityManager();
241 if (sm != null && AppContext.getAppContexts().size() > 0) {
242 AppContext ac = AppContext.getAppContext();
243 if (ac != null) {
244 PresentationManager pm =
245 (PresentationManager) ac.get(PresentationManager.class);
246 if (pm == null) {
247 pm = setupPresentationManager();
248 ac.put(PresentationManager.class, pm);
249 }
250 return pm;
251 }
252 }
253
254 // No security manager or AppContext
255 if (defaultPresentationManager == null)
256 defaultPresentationManager = setupPresentationManager();
257 return defaultPresentationManager;
258 }
259
260 /** Get the appropriate StubFactoryFactory. This
261 * will be dynamic or static depending on whether
262 * com.sun.CORBA.ORBUseDynamicStub is true or false.
263 */
264 public static PresentationManager.StubFactoryFactory
265 getStubFactoryFactory()
266 {
267 PresentationManager gPM = getPresentationManager();
268 boolean useDynamicStubs = gPM.useDynamicStubs() ;
269 return gPM.getStubFactoryFactory( useDynamicStubs ) ;
270 }
271
272 protected ORB()
273 {
274 // Initialize logging first, since it is needed nearly
275 // everywhere (for example, in TypeCodeImpl).
276 wrapperMap = new ConcurrentHashMap();
277 wrapper = ORBUtilSystemException.get( this,
278 CORBALogDomains.RPC_PRESENTATION ) ;
279 omgWrapper = OMGSystemException.get( this,
|