21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
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 |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.corba.se.impl.orb ; |
26 package com.sun.corba.se.impl.orb; |
27 |
27 |
28 import java.applet.Applet; |
28 import java.applet.Applet; |
29 |
29 |
30 import java.io.IOException ; |
30 import java.io.IOException; |
31 |
31 |
32 import java.lang.reflect.Constructor; |
32 import java.lang.reflect.Constructor; |
33 import java.lang.reflect.Field ; |
33 import java.lang.reflect.Field; |
34 import java.lang.reflect.Modifier ; |
34 import java.lang.reflect.Modifier; |
35 import java.lang.reflect.InvocationTargetException ; |
35 import java.lang.reflect.InvocationTargetException; |
36 |
36 |
37 import java.util.ArrayList ; |
37 import java.util.Set; |
38 import java.util.Iterator ; |
38 import java.util.HashSet; |
39 import java.util.Properties ; |
39 import java.util.ArrayList; |
40 import java.util.Vector ; |
40 import java.util.Iterator; |
41 import java.util.Hashtable ; |
41 import java.util.Properties; |
42 import java.util.Map ; |
42 import java.util.Vector; |
43 import java.util.HashMap ; |
43 import java.util.Hashtable; |
44 import java.util.LinkedList ; |
44 import java.util.Map; |
45 import java.util.Collection ; |
45 import java.util.HashMap; |
46 import java.util.Collections ; |
46 import java.util.LinkedList; |
47 import java.util.StringTokenizer ; |
47 import java.util.Collection; |
48 import java.util.Enumeration ; |
48 import java.util.Collections; |
49 import java.util.WeakHashMap ; |
49 import java.util.StringTokenizer; |
50 |
50 import java.util.Enumeration; |
51 import java.net.InetAddress ; |
51 import java.util.WeakHashMap; |
|
52 |
|
53 import java.net.InetAddress; |
52 |
54 |
53 import java.security.PrivilegedAction; |
55 import java.security.PrivilegedAction; |
54 import java.security.AccessController ; |
56 import java.security.AccessController; |
55 |
57 |
56 import javax.rmi.CORBA.Util; |
58 import javax.rmi.CORBA.Util; |
57 import javax.rmi.CORBA.ValueHandler; |
59 import javax.rmi.CORBA.ValueHandler; |
58 |
60 |
59 import org.omg.CORBA.Context; |
61 import org.omg.CORBA.Context; |
80 import org.omg.CORBA.ORBPackage.InvalidName; |
82 import org.omg.CORBA.ORBPackage.InvalidName; |
81 |
83 |
82 import com.sun.org.omg.SendingContext.CodeBase; |
84 import com.sun.org.omg.SendingContext.CodeBase; |
83 |
85 |
84 import com.sun.corba.se.pept.broker.Broker; |
86 import com.sun.corba.se.pept.broker.Broker; |
85 import com.sun.corba.se.pept.protocol.ClientInvocationInfo ; |
87 import com.sun.corba.se.pept.protocol.ClientInvocationInfo; |
86 import com.sun.corba.se.pept.transport.ContactInfo; |
88 import com.sun.corba.se.pept.transport.ContactInfo; |
87 import com.sun.corba.se.pept.transport.ConnectionCache; |
89 import com.sun.corba.se.pept.transport.ConnectionCache; |
88 import com.sun.corba.se.pept.transport.TransportManager; |
90 import com.sun.corba.se.pept.transport.TransportManager; |
89 |
91 |
90 import com.sun.corba.se.spi.ior.IOR; |
92 import com.sun.corba.se.spi.ior.IOR; |
91 import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ; |
93 import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder; |
92 import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder; |
94 import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder; |
93 import com.sun.corba.se.spi.ior.IORFactories ; |
95 import com.sun.corba.se.spi.ior.IORFactories; |
94 import com.sun.corba.se.spi.ior.ObjectKey ; |
96 import com.sun.corba.se.spi.ior.ObjectKey; |
95 import com.sun.corba.se.spi.ior.ObjectKeyFactory ; |
97 import com.sun.corba.se.spi.ior.ObjectKeyFactory; |
96 import com.sun.corba.se.spi.ior.iiop.IIOPFactories ; |
98 import com.sun.corba.se.spi.ior.iiop.IIOPFactories; |
97 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; |
99 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; |
98 import com.sun.corba.se.spi.oa.OAInvocationInfo; |
100 import com.sun.corba.se.spi.oa.OAInvocationInfo; |
99 import com.sun.corba.se.spi.oa.ObjectAdapterFactory; |
101 import com.sun.corba.se.spi.oa.ObjectAdapterFactory; |
100 import com.sun.corba.se.spi.orb.DataCollector; |
102 import com.sun.corba.se.spi.orb.DataCollector; |
101 import com.sun.corba.se.spi.orb.Operation; |
103 import com.sun.corba.se.spi.orb.Operation; |
120 import com.sun.corba.se.spi.orb.StringPair; |
122 import com.sun.corba.se.spi.orb.StringPair; |
121 import com.sun.corba.se.spi.orb.StringPair; |
123 import com.sun.corba.se.spi.orb.StringPair; |
122 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory; |
124 import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory; |
123 import com.sun.corba.se.spi.transport.CorbaTransportManager; |
125 import com.sun.corba.se.spi.transport.CorbaTransportManager; |
124 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager; |
126 import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager; |
125 import com.sun.corba.se.spi.copyobject.CopierManager ; |
127 import com.sun.corba.se.spi.copyobject.CopierManager; |
126 import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ; |
128 import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults; |
127 import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; |
129 import com.sun.corba.se.spi.presentation.rmi.PresentationManager; |
128 import com.sun.corba.se.spi.presentation.rmi.StubAdapter ; |
130 import com.sun.corba.se.spi.presentation.rmi.StubAdapter; |
129 import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry; |
131 import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry; |
130 |
132 |
131 import com.sun.corba.se.impl.corba.TypeCodeFactory; |
133 import com.sun.corba.se.impl.corba.TypeCodeFactory; |
132 import com.sun.corba.se.impl.corba.TypeCodeImpl; |
134 import com.sun.corba.se.impl.corba.TypeCodeImpl; |
133 import com.sun.corba.se.impl.corba.NVListImpl; |
135 import com.sun.corba.se.impl.corba.NVListImpl; |
183 private Vector dynamicRequests ; |
186 private Vector dynamicRequests ; |
184 private SynchVariable svResponseReceived ; |
187 private SynchVariable svResponseReceived ; |
185 |
188 |
186 private java.lang.Object runObj = new java.lang.Object(); |
189 private java.lang.Object runObj = new java.lang.Object(); |
187 private java.lang.Object shutdownObj = new java.lang.Object(); |
190 private java.lang.Object shutdownObj = new java.lang.Object(); |
|
191 private java.lang.Object waitForCompletionObj = new java.lang.Object(); |
188 private static final byte STATUS_OPERATING = 1; |
192 private static final byte STATUS_OPERATING = 1; |
189 private static final byte STATUS_SHUTTING_DOWN = 2; |
193 private static final byte STATUS_SHUTTING_DOWN = 2; |
190 private static final byte STATUS_SHUTDOWN = 3; |
194 private static final byte STATUS_SHUTDOWN = 3; |
191 private static final byte STATUS_DESTROYED = 4; |
195 private static final byte STATUS_DESTROYED = 4; |
192 private byte status = STATUS_OPERATING; |
196 private byte status = STATUS_OPERATING; |
193 |
197 |
194 // XXX Should we move invocation tracking to the first level server dispatcher? |
198 // XXX Should we move invocation tracking to the first level server dispatcher? |
195 private java.lang.Object invocationObj = new java.lang.Object(); |
199 private java.lang.Object invocationObj = new java.lang.Object(); |
|
200 private int numInvocations = 0; |
196 |
201 |
197 // thread local variable to store a boolean to detect deadlock in |
202 // thread local variable to store a boolean to detect deadlock in |
198 // ORB.shutdown(true). |
203 // ORB.shutdown(true). |
199 private ThreadLocal isProcessingInvocation = new ThreadLocal () { |
204 private ThreadLocal isProcessingInvocation = new ThreadLocal () { |
200 protected java.lang.Object initialValue() { |
205 protected java.lang.Object initialValue() { |
344 // check on piHandler to invoke Interceptors. We do not want any |
356 // check on piHandler to invoke Interceptors. We do not want any |
345 // Interceptors to be invoked before the complete ORB initialization. |
357 // Interceptors to be invoked before the complete ORB initialization. |
346 // piHandler will be replaced by a real PIHandler implementation at the |
358 // piHandler will be replaced by a real PIHandler implementation at the |
347 // end of this method. |
359 // end of this method. |
348 pihandler = new PINoOpHandlerImpl( ); |
360 pihandler = new PINoOpHandlerImpl( ); |
349 |
|
350 // See bugs 4916766 and 4936203 |
|
351 // We intend to create new threads in a reliable thread group. |
|
352 // This avoids problems if the application/applet |
|
353 // creates a thread group, makes JavaIDL calls which create a new |
|
354 // connection and ReaderThread, and then destroys the thread |
|
355 // group. If our ReaderThreads were to be part of such destroyed thread |
|
356 // group then it might get killed and cause other invoking threads |
|
357 // sharing the same connection to get a non-restartable |
|
358 // CommunicationFailure. We'd like to avoid that. |
|
359 // |
|
360 // Our solution is to create all of our threads in the highest thread |
|
361 // group that we have access to, given our own security clearance. |
|
362 // |
|
363 try { |
|
364 // try to get a thread group that's as high in the threadgroup |
|
365 // parent-child hierarchy, as we can get to. |
|
366 // this will prevent an ORB thread created during applet-init from |
|
367 // being killed when an applet dies. |
|
368 threadGroup = (ThreadGroup) AccessController.doPrivileged( |
|
369 new PrivilegedAction() { |
|
370 public Object run() { |
|
371 ThreadGroup tg = Thread.currentThread().getThreadGroup() ; |
|
372 ThreadGroup ptg = tg ; |
|
373 try { |
|
374 while (ptg != null) { |
|
375 tg = ptg; |
|
376 ptg = tg.getParent(); |
|
377 } |
|
378 } catch (SecurityException se) { |
|
379 // Discontinue going higher on a security exception. |
|
380 } |
|
381 return new ThreadGroup(tg, "ORB ThreadGroup"); |
|
382 } |
|
383 } |
|
384 ); |
|
385 } catch (SecurityException e) { |
|
386 // something wrong, we go back to the original code |
|
387 threadGroup = Thread.currentThread().getThreadGroup(); |
|
388 } |
|
389 |
361 |
390 // This is the unique id of this server (JVM). Multiple incarnations |
362 // This is the unique id of this server (JVM). Multiple incarnations |
391 // of this server will get different ids. |
363 // of this server will get different ids. |
392 // Compute transientServerId = milliseconds since Jan 1, 1970 |
364 // Compute transientServerId = milliseconds since Jan 1, 1970 |
393 // Note: transientServerId will wrap in about 2^32 / 86400000 = 49.7 days. |
365 // Note: transientServerId will wrap in about 2^32 / 86400000 = 49.7 days. |
1251 runObj.wait(); |
1239 runObj.wait(); |
1252 } catch ( InterruptedException ex ) {} |
1240 } catch ( InterruptedException ex ) {} |
1253 } |
1241 } |
1254 } |
1242 } |
1255 |
1243 |
1256 public void shutdown(boolean wait_for_completion) |
1244 public void shutdown(boolean wait_for_completion) { |
1257 { |
1245 boolean wait = false; |
1258 // to wait for completion, we would deadlock, so throw a standard |
1246 |
1259 // OMG exception. |
1247 synchronized (this) { |
1260 if (wait_for_completion && ((Boolean)isProcessingInvocation.get()).booleanValue()) { |
1248 checkShutdownState(); |
1261 throw omgWrapper.shutdownWaitForCompletionDeadlock() ; |
1249 |
1262 } |
1250 // This is to avoid deadlock: don't allow a thread that is |
1263 |
1251 // processing a request to call shutdown( true ), because |
1264 boolean doShutdown = false ; |
1252 // the shutdown would block waiting for the request to complete, |
1265 |
1253 // while the request would block waiting for shutdown to complete. |
1266 synchronized (this) { |
1254 if (wait_for_completion && |
1267 checkShutdownState() ; |
1255 isProcessingInvocation.get() == Boolean.TRUE) { |
|
1256 throw omgWrapper.shutdownWaitForCompletionDeadlock(); |
|
1257 } |
1268 |
1258 |
1269 if (status == STATUS_SHUTTING_DOWN) { |
1259 if (status == STATUS_SHUTTING_DOWN) { |
1270 if (!wait_for_completion) |
1260 if (wait_for_completion) { |
1271 // If we are already shutting down and don't want |
1261 wait = true; |
1272 // to wait, nothing to do: return. |
1262 } else { |
1273 return ; |
1263 return; |
|
1264 } |
|
1265 } |
|
1266 |
|
1267 status = STATUS_SHUTTING_DOWN; |
|
1268 } |
|
1269 |
|
1270 // Avoid more than one thread performing shutdown at a time. |
|
1271 synchronized (shutdownObj) { |
|
1272 // At this point, the ORB status is certainly STATUS_SHUTTING_DOWN. |
|
1273 // If wait is true, another thread already called shutdown( true ), |
|
1274 // and so we wait for completion |
|
1275 if (wait) { |
|
1276 while (true) { |
|
1277 synchronized (this) { |
|
1278 if (status == STATUS_SHUTDOWN) |
|
1279 break; |
|
1280 } |
|
1281 |
|
1282 try { |
|
1283 shutdownObj.wait(); |
|
1284 } catch (InterruptedException exc) { |
|
1285 // NOP: just loop and wait until state is changed |
|
1286 } |
|
1287 } |
1274 } else { |
1288 } else { |
1275 // The ORB status was STATUS_OPERATING, so start the shutdown. |
1289 // perform the actual shutdown |
1276 status = STATUS_SHUTTING_DOWN ; |
|
1277 doShutdown = true ; |
|
1278 } |
|
1279 } |
|
1280 |
|
1281 // At this point, status is SHUTTING_DOWN. |
|
1282 // All shutdown calls with wait_for_completion == true must synchronize |
|
1283 // here. Only the first call will be made with doShutdown == true. |
|
1284 synchronized (shutdownObj) { |
|
1285 if (doShutdown) { |
|
1286 // shutdownServants will set all POAManagers into the |
|
1287 // INACTIVE state, causing request to be rejected. |
|
1288 // If wait_for_completion is true, this will not return until |
|
1289 // all invocations have completed. |
|
1290 shutdownServants(wait_for_completion); |
1290 shutdownServants(wait_for_completion); |
|
1291 |
|
1292 if (wait_for_completion) { |
|
1293 synchronized ( waitForCompletionObj ) { |
|
1294 while (numInvocations > 0) { |
|
1295 try { |
|
1296 waitForCompletionObj.wait(); |
|
1297 } catch (InterruptedException ex) {} |
|
1298 } |
|
1299 } |
|
1300 } |
1291 |
1301 |
1292 synchronized (runObj) { |
1302 synchronized (runObj) { |
1293 runObj.notifyAll(); |
1303 runObj.notifyAll(); |
1294 } |
1304 } |
1295 |
1305 |
1296 synchronized (this) { |
1306 status = STATUS_SHUTDOWN; |
1297 status = STATUS_SHUTDOWN; |
1307 |
1298 } |
1308 shutdownObj.notifyAll(); |
1299 } |
1309 } |
1300 } |
1310 } |
1301 } |
1311 } |
1302 |
1312 |
1303 /** This method shuts down the ORB and causes orb.run() to return. |
1313 // Cause all ObjectAdapaterFactories to clean up all of their internal state, which |
1304 * It will cause all POAManagers to be deactivated, which in turn |
1314 // may include activated objects that have associated state and callbacks that must |
1305 * will cause all POAs to be deactivated. |
1315 // complete in order to shutdown. This will cause new request to be rejected. |
1306 */ |
|
1307 protected void shutdownServants(boolean wait_for_completion) { |
1316 protected void shutdownServants(boolean wait_for_completion) { |
1308 Iterator iter = requestDispatcherRegistry.getObjectAdapterFactories().iterator() ; |
1317 Set<ObjectAdapterFactory> oaset; |
1309 while (iter.hasNext()) { |
1318 synchronized (this) { |
1310 ObjectAdapterFactory oaf = (ObjectAdapterFactory)iter.next() ; |
1319 oaset = new HashSet<>(requestDispatcherRegistry.getObjectAdapterFactories()); |
1311 oaf.shutdown( wait_for_completion ) ; |
1320 } |
1312 } |
1321 |
1313 } |
1322 for (ObjectAdapterFactory oaf : oaset) |
1314 |
1323 oaf.shutdown(wait_for_completion); |
1315 // REVISIT: was protected - made public for framework |
1324 } |
|
1325 |
1316 // Note that the caller must hold the ORBImpl lock. |
1326 // Note that the caller must hold the ORBImpl lock. |
1317 public void checkShutdownState() |
1327 public void checkShutdownState() |
1318 { |
1328 { |
1319 if (status == STATUS_DESTROYED) { |
1329 if (status == STATUS_DESTROYED) { |
1320 throw wrapper.orbDestroyed() ; |
1330 throw wrapper.orbDestroyed() ; |
1325 } |
1335 } |
1326 } |
1336 } |
1327 |
1337 |
1328 public boolean isDuringDispatch() |
1338 public boolean isDuringDispatch() |
1329 { |
1339 { |
|
1340 synchronized (this) { |
|
1341 checkShutdownState(); |
|
1342 } |
1330 Boolean value = (Boolean)(isProcessingInvocation.get()) ; |
1343 Boolean value = (Boolean)(isProcessingInvocation.get()) ; |
1331 return value.booleanValue() ; |
1344 return value.booleanValue() ; |
1332 } |
1345 } |
1333 |
1346 |
1334 public void startingDispatch() |
1347 public void startingDispatch() |
1335 { |
1348 { |
|
1349 synchronized (this) { |
|
1350 checkShutdownState(); |
|
1351 } |
1336 synchronized (invocationObj) { |
1352 synchronized (invocationObj) { |
1337 isProcessingInvocation.set(Boolean.TRUE); |
1353 isProcessingInvocation.set(Boolean.TRUE); |
|
1354 numInvocations++; |
1338 } |
1355 } |
1339 } |
1356 } |
1340 |
1357 |
1341 public void finishedDispatch() |
1358 public void finishedDispatch() |
1342 { |
1359 { |
|
1360 synchronized (this) { |
|
1361 checkShutdownState(); |
|
1362 } |
1343 synchronized (invocationObj) { |
1363 synchronized (invocationObj) { |
1344 isProcessingInvocation.set(Boolean.FALSE); |
1364 numInvocations--; |
|
1365 isProcessingInvocation.set(false); |
|
1366 if (numInvocations == 0) { |
|
1367 synchronized (waitForCompletionObj) { |
|
1368 waitForCompletionObj.notifyAll(); |
|
1369 } |
|
1370 } else if (numInvocations < 0) { |
|
1371 throw wrapper.numInvocationsAlreadyZero( |
|
1372 CompletionStatus.COMPLETED_YES); |
|
1373 } |
1345 } |
1374 } |
1346 } |
1375 } |
1347 |
1376 |
1348 /** |
1377 /** |
1349 * formal/99-10-07 p 159: "If destroy is called on an ORB that has |
1378 * formal/99-10-07 p 159: "If destroy is called on an ORB that has |
1350 * not been shut down, it will start the shutdown process and block until |
1379 * not been shut down, it will start the shutdown process and block until |
1351 * the ORB has shut down before it destroys the ORB." |
1380 * the ORB has shut down before it destroys the ORB." |
1352 */ |
1381 */ |
1353 public synchronized void destroy() |
1382 public void destroy() |
1354 { |
1383 { |
1355 boolean shutdownFirst = false ; |
1384 boolean shutdownFirst = false; |
1356 |
1385 |
1357 synchronized (this) { |
1386 synchronized (this) { |
1358 shutdownFirst = (status == STATUS_OPERATING) ; |
1387 shutdownFirst = (status == STATUS_OPERATING); |
1359 } |
1388 } |
1360 |
1389 |
1361 if (shutdownFirst) { |
1390 if (shutdownFirst) { |
1362 shutdown(true); |
1391 shutdown(true); |
1363 } |
1392 } |
1364 |
1393 |
1365 synchronized (this) { |
1394 synchronized (this) { |
1366 if (status < STATUS_DESTROYED) { |
1395 if (status < STATUS_DESTROYED) { |
1367 getCorbaTransportManager().close(); |
1396 getCorbaTransportManager().close(); |
1368 getPIHandler().destroyInterceptors() ; |
1397 getPIHandler().destroyInterceptors(); |
1369 status = STATUS_DESTROYED; |
1398 status = STATUS_DESTROYED; |
1370 } |
1399 } |
1371 } |
1400 } |
1372 |
1401 synchronized (threadPoolManagerAccessLock) { |
|
1402 if (orbOwnsThreadPoolManager) { |
|
1403 try { |
|
1404 threadpoolMgr.close(); |
|
1405 threadpoolMgr = null; |
|
1406 } catch (IOException exc) { |
|
1407 wrapper.ioExceptionOnClose(exc); |
|
1408 } |
|
1409 } |
|
1410 } |
|
1411 |
|
1412 try { |
|
1413 monitoringManager.close(); |
|
1414 monitoringManager = null; |
|
1415 } catch (IOException exc) { |
|
1416 wrapper.ioExceptionOnClose(exc); |
|
1417 } |
|
1418 |
|
1419 CachedCodeBase.cleanCache(this); |
|
1420 try { |
|
1421 pihandler.close(); |
|
1422 } catch (IOException exc) { |
|
1423 wrapper.ioExceptionOnClose(exc); |
|
1424 } |
|
1425 |
|
1426 super.destroy(); |
|
1427 |
|
1428 badServerIdHandlerAccessLock = null; |
|
1429 clientDelegateFactoryAccessorLock = null; |
|
1430 corbaContactInfoListFactoryAccessLock = null; |
|
1431 |
|
1432 objectKeyFactoryAccessLock = null; |
|
1433 legacyServerSocketManagerAccessLock = null; |
|
1434 threadPoolManagerAccessLock = null; |
|
1435 transportManager = null; |
|
1436 legacyServerSocketManager = null; |
|
1437 OAInvocationInfoStack = null; |
|
1438 clientInvocationInfoStack = null; |
|
1439 codeBaseIOR = null; |
|
1440 dynamicRequests = null; |
|
1441 svResponseReceived = null; |
|
1442 runObj = null; |
|
1443 shutdownObj = null; |
|
1444 waitForCompletionObj = null; |
|
1445 invocationObj = null; |
|
1446 isProcessingInvocation = null; |
|
1447 typeCodeForClassMap = null; |
|
1448 valueFactoryCache = null; |
|
1449 orbVersionThreadLocal = null; |
|
1450 requestDispatcherRegistry = null; |
|
1451 copierManager = null; |
|
1452 toaFactory = null; |
|
1453 poaFactory = null; |
|
1454 pihandler = null; |
|
1455 configData = null; |
|
1456 badServerIdHandler = null; |
|
1457 clientDelegateFactory = null; |
|
1458 corbaContactInfoListFactory = null; |
|
1459 resolver = null; |
|
1460 localResolver = null; |
|
1461 insNamingDelegate = null; |
|
1462 urlOperation = null; |
|
1463 taggedComponentFactoryFinder = null; |
|
1464 taggedProfileFactoryFinder = null; |
|
1465 taggedProfileTemplateFactoryFinder = null; |
|
1466 objectKeyFactory = null; |
1373 } |
1467 } |
1374 |
1468 |
1375 /** |
1469 /** |
1376 * Registers a value factory for a particular repository ID. |
1470 * Registers a value factory for a particular repository ID. |
1377 * |
1471 * |
1717 |
1853 |
1718 private Object clientDelegateFactoryAccessorLock = new Object(); |
1854 private Object clientDelegateFactoryAccessorLock = new Object(); |
1719 |
1855 |
1720 public void setClientDelegateFactory( ClientDelegateFactory factory ) |
1856 public void setClientDelegateFactory( ClientDelegateFactory factory ) |
1721 { |
1857 { |
|
1858 synchronized (this) { |
|
1859 checkShutdownState(); |
|
1860 } |
1722 synchronized (clientDelegateFactoryAccessorLock) { |
1861 synchronized (clientDelegateFactoryAccessorLock) { |
1723 clientDelegateFactory = factory ; |
1862 clientDelegateFactory = factory ; |
1724 } |
1863 } |
1725 } |
1864 } |
1726 |
1865 |
1727 public ClientDelegateFactory getClientDelegateFactory() |
1866 public ClientDelegateFactory getClientDelegateFactory() |
1728 { |
1867 { |
|
1868 synchronized (this) { |
|
1869 checkShutdownState(); |
|
1870 } |
1729 synchronized (clientDelegateFactoryAccessorLock) { |
1871 synchronized (clientDelegateFactoryAccessorLock) { |
1730 return clientDelegateFactory ; |
1872 return clientDelegateFactory ; |
1731 } |
1873 } |
1732 } |
1874 } |
1733 |
1875 |
1734 private Object corbaContactInfoListFactoryAccessLock = new Object(); |
1876 private Object corbaContactInfoListFactoryAccessLock = new Object(); |
1735 |
1877 |
1736 public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory ) |
1878 public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory ) |
1737 { |
1879 { |
|
1880 synchronized (this) { |
|
1881 checkShutdownState(); |
|
1882 } |
1738 synchronized (corbaContactInfoListFactoryAccessLock) { |
1883 synchronized (corbaContactInfoListFactoryAccessLock) { |
1739 corbaContactInfoListFactory = factory ; |
1884 corbaContactInfoListFactory = factory ; |
1740 } |
1885 } |
1741 } |
1886 } |
1742 |
1887 |
1743 public synchronized CorbaContactInfoListFactory getCorbaContactInfoListFactory() |
1888 public synchronized CorbaContactInfoListFactory getCorbaContactInfoListFactory() |
1744 { |
1889 { |
|
1890 checkShutdownState(); |
1745 return corbaContactInfoListFactory ; |
1891 return corbaContactInfoListFactory ; |
1746 } |
1892 } |
1747 |
1893 |
1748 /** Set the resolver used in this ORB. This resolver will be used for list_initial_services |
1894 /** Set the resolver used in this ORB. This resolver will be used for list_initial_services |
1749 * and resolve_initial_references. |
1895 * and resolve_initial_references. |
1750 */ |
1896 */ |
1751 public void setResolver( Resolver resolver ) |
1897 public void setResolver( Resolver resolver ) |
1752 { |
1898 { |
|
1899 synchronized (this) { |
|
1900 checkShutdownState(); |
|
1901 } |
1753 synchronized (resolverLock) { |
1902 synchronized (resolverLock) { |
1754 this.resolver = resolver ; |
1903 this.resolver = resolver ; |
1755 } |
1904 } |
1756 } |
1905 } |
1757 |
1906 |
1758 /** Get the resolver used in this ORB. This resolver will be used for list_initial_services |
1907 /** Get the resolver used in this ORB. This resolver will be used for list_initial_services |
1759 * and resolve_initial_references. |
1908 * and resolve_initial_references. |
1760 */ |
1909 */ |
1761 public Resolver getResolver() |
1910 public Resolver getResolver() |
1762 { |
1911 { |
|
1912 synchronized (this) { |
|
1913 checkShutdownState(); |
|
1914 } |
1763 synchronized (resolverLock) { |
1915 synchronized (resolverLock) { |
1764 return resolver ; |
1916 return resolver ; |
1765 } |
1917 } |
1766 } |
1918 } |
1767 |
1919 |
1768 /** Set the LocalResolver used in this ORB. This LocalResolver is used for |
1920 /** Set the LocalResolver used in this ORB. This LocalResolver is used for |
1769 * register_initial_reference only. |
1921 * register_initial_reference only. |
1770 */ |
1922 */ |
1771 public void setLocalResolver( LocalResolver resolver ) |
1923 public void setLocalResolver( LocalResolver resolver ) |
1772 { |
1924 { |
|
1925 synchronized (this) { |
|
1926 checkShutdownState(); |
|
1927 } |
1773 synchronized (resolverLock) { |
1928 synchronized (resolverLock) { |
1774 this.localResolver = resolver ; |
1929 this.localResolver = resolver ; |
1775 } |
1930 } |
1776 } |
1931 } |
1777 |
1932 |
1778 /** Get the LocalResolver used in this ORB. This LocalResolver is used for |
1933 /** Get the LocalResolver used in this ORB. This LocalResolver is used for |
1779 * register_initial_reference only. |
1934 * register_initial_reference only. |
1780 */ |
1935 */ |
1781 public LocalResolver getLocalResolver() |
1936 public LocalResolver getLocalResolver() |
1782 { |
1937 { |
|
1938 synchronized (this) { |
|
1939 checkShutdownState(); |
|
1940 } |
1783 synchronized (resolverLock) { |
1941 synchronized (resolverLock) { |
1784 return localResolver ; |
1942 return localResolver ; |
1785 } |
1943 } |
1786 } |
1944 } |
1787 |
1945 |
1788 /** Set the operation used in string_to_object calls. The Operation must expect a |
1946 /** Set the operation used in string_to_object calls. The Operation must expect a |
1789 * String and return an org.omg.CORBA.Object. |
1947 * String and return an org.omg.CORBA.Object. |
1790 */ |
1948 */ |
1791 public void setURLOperation( Operation stringToObject ) |
1949 public void setURLOperation( Operation stringToObject ) |
1792 { |
1950 { |
|
1951 synchronized (this) { |
|
1952 checkShutdownState(); |
|
1953 } |
1793 synchronized (urlOperationLock) { |
1954 synchronized (urlOperationLock) { |
1794 urlOperation = stringToObject ; |
1955 urlOperation = stringToObject ; |
1795 } |
1956 } |
1796 } |
1957 } |
1797 |
1958 |
1798 /** Get the operation used in string_to_object calls. The Operation must expect a |
1959 /** Get the operation used in string_to_object calls. The Operation must expect a |
1799 * String and return an org.omg.CORBA.Object. |
1960 * String and return an org.omg.CORBA.Object. |
1800 */ |
1961 */ |
1801 public Operation getURLOperation() |
1962 public Operation getURLOperation() |
1802 { |
1963 { |
|
1964 synchronized (this) { |
|
1965 checkShutdownState(); |
|
1966 } |
1803 synchronized (urlOperationLock) { |
1967 synchronized (urlOperationLock) { |
1804 return urlOperation ; |
1968 return urlOperation ; |
1805 } |
1969 } |
1806 } |
1970 } |
1807 |
1971 |
1808 public void setINSDelegate( CorbaServerRequestDispatcher sdel ) |
1972 public void setINSDelegate( CorbaServerRequestDispatcher sdel ) |
1809 { |
1973 { |
|
1974 synchronized (this) { |
|
1975 checkShutdownState(); |
|
1976 } |
1810 synchronized (resolverLock) { |
1977 synchronized (resolverLock) { |
1811 insNamingDelegate = sdel ; |
1978 insNamingDelegate = sdel ; |
1812 } |
1979 } |
1813 } |
1980 } |
1814 |
1981 |
1815 public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() |
1982 public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() |
1816 { |
1983 { |
|
1984 synchronized (this) { |
|
1985 checkShutdownState(); |
|
1986 } |
1817 return taggedComponentFactoryFinder ; |
1987 return taggedComponentFactoryFinder ; |
1818 } |
1988 } |
1819 |
1989 |
1820 public IdentifiableFactoryFinder getTaggedProfileFactoryFinder() |
1990 public IdentifiableFactoryFinder getTaggedProfileFactoryFinder() |
1821 { |
1991 { |
|
1992 synchronized (this) { |
|
1993 checkShutdownState(); |
|
1994 } |
1822 return taggedProfileFactoryFinder ; |
1995 return taggedProfileFactoryFinder ; |
1823 } |
1996 } |
1824 |
1997 |
1825 public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() |
1998 public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() |
1826 { |
1999 { |
|
2000 synchronized (this) { |
|
2001 checkShutdownState(); |
|
2002 } |
1827 return taggedProfileTemplateFactoryFinder ; |
2003 return taggedProfileTemplateFactoryFinder ; |
1828 } |
2004 } |
1829 |
2005 |
1830 private Object objectKeyFactoryAccessLock = new Object(); |
2006 private Object objectKeyFactoryAccessLock = new Object(); |
1831 |
2007 |
1832 public ObjectKeyFactory getObjectKeyFactory() |
2008 public ObjectKeyFactory getObjectKeyFactory() |
1833 { |
2009 { |
|
2010 synchronized (this) { |
|
2011 checkShutdownState(); |
|
2012 } |
1834 synchronized (objectKeyFactoryAccessLock) { |
2013 synchronized (objectKeyFactoryAccessLock) { |
1835 return objectKeyFactory ; |
2014 return objectKeyFactory ; |
1836 } |
2015 } |
1837 } |
2016 } |
1838 |
2017 |
1839 public void setObjectKeyFactory( ObjectKeyFactory factory ) |
2018 public void setObjectKeyFactory( ObjectKeyFactory factory ) |
1840 { |
2019 { |
|
2020 synchronized (this) { |
|
2021 checkShutdownState(); |
|
2022 } |
1841 synchronized (objectKeyFactoryAccessLock) { |
2023 synchronized (objectKeyFactoryAccessLock) { |
1842 objectKeyFactory = factory ; |
2024 objectKeyFactory = factory ; |
1843 } |
2025 } |
1844 } |
2026 } |
1845 |
2027 |
1874 |
2059 |
1875 private Object threadPoolManagerAccessLock = new Object(); |
2060 private Object threadPoolManagerAccessLock = new Object(); |
1876 |
2061 |
1877 public void setThreadPoolManager(ThreadPoolManager mgr) |
2062 public void setThreadPoolManager(ThreadPoolManager mgr) |
1878 { |
2063 { |
|
2064 synchronized (this) { |
|
2065 checkShutdownState(); |
|
2066 } |
1879 synchronized (threadPoolManagerAccessLock) { |
2067 synchronized (threadPoolManagerAccessLock) { |
1880 threadpoolMgr = mgr; |
2068 threadpoolMgr = mgr; |
1881 } |
2069 } |
1882 } |
2070 } |
1883 |
2071 |
1884 public ThreadPoolManager getThreadPoolManager() |
2072 public ThreadPoolManager getThreadPoolManager() |
1885 { |
2073 { |
|
2074 synchronized (this) { |
|
2075 checkShutdownState(); |
|
2076 } |
1886 synchronized (threadPoolManagerAccessLock) { |
2077 synchronized (threadPoolManagerAccessLock) { |
1887 if (threadpoolMgr == null) { |
2078 if (threadpoolMgr == null) { |
1888 threadpoolMgr = new ThreadPoolManagerImpl( threadGroup ); |
2079 threadpoolMgr = new ThreadPoolManagerImpl(); |
|
2080 orbOwnsThreadPoolManager = true; |
1889 } |
2081 } |
1890 return threadpoolMgr; |
2082 return threadpoolMgr; |
1891 } |
2083 } |
1892 } |
2084 } |
1893 |
2085 |
1894 public CopierManager getCopierManager() |
2086 public CopierManager getCopierManager() |
1895 { |
2087 { |
|
2088 synchronized (this) { |
|
2089 checkShutdownState(); |
|
2090 } |
1896 return copierManager ; |
2091 return copierManager ; |
1897 } |
2092 } |
1898 } // Class ORBImpl |
2093 } // Class ORBImpl |
1899 |
2094 |
1900 //////////////////////////////////////////////////////////////////////// |
2095 //////////////////////////////////////////////////////////////////////// |