提交 70b68b06 编写于 作者: C coffeys

7162902: Umbrella port of a number of corba bug fixes from JDK 6 to jdk7u/8

Reviewed-by: lancea
上级 fb2bcd7f
/*
* Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -22,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.corba.se.impl.encoding;
import java.util.Hashtable;
......@@ -32,7 +31,8 @@ import com.sun.org.omg.SendingContext.CodeBaseHelper;
import com.sun.org.omg.SendingContext._CodeBaseImplBase;
import com.sun.org.omg.SendingContext._CodeBaseStub;
import com.sun.corba.se.spi.transport.CorbaConnection;
import com.sun.corba.se.spi.ior.IOR;
import com.sun.corba.se.spi.orb.ORB;
/**
* Provides the reading side with a per connection cache of
* info obtained via calls to the remote CodeBase.
......@@ -51,14 +51,24 @@ import com.sun.corba.se.spi.transport.CorbaConnection;
*
* Needs cache management.
*/
// REVISIT: revert to package protected after framework merge.
public class CachedCodeBase extends _CodeBaseImplBase
{
private Hashtable implementations, fvds, bases;
private CodeBase delegate;
private volatile CodeBase delegate;
private CorbaConnection conn;
private static Hashtable iorToCodeBaseObjMap = new Hashtable();
private static Object iorMapLock = new Object();
private static Hashtable<IOR,CodeBase> iorMap = new Hashtable<>();
public static synchronized void cleanCache( ORB orb ) {
synchronized (iorMapLock) {
for (IOR ior : iorMap.keySet()) {
if (ior.getORB() == orb) {
iorMap.remove(ior);
}
}
}
}
public CachedCodeBase(CorbaConnection connection) {
conn = connection;
......@@ -68,7 +78,7 @@ public class CachedCodeBase extends _CodeBaseImplBase
return null;
}
public String implementation (String repId) {
public synchronized String implementation (String repId) {
String urlResult = null;
if (implementations == null)
......@@ -86,7 +96,7 @@ public class CachedCodeBase extends _CodeBaseImplBase
return urlResult;
}
public String[] implementations (String[] repIds) {
public synchronized String[] implementations (String[] repIds) {
String[] urlResults = new String[repIds.length];
for (int i = 0; i < urlResults.length; i++)
......@@ -95,7 +105,7 @@ public class CachedCodeBase extends _CodeBaseImplBase
return urlResults;
}
public FullValueDescription meta (String repId) {
public synchronized FullValueDescription meta (String repId) {
FullValueDescription result = null;
if (fvds == null)
......@@ -113,7 +123,7 @@ public class CachedCodeBase extends _CodeBaseImplBase
return result;
}
public FullValueDescription[] metas (String[] repIds) {
public synchronized FullValueDescription[] metas (String[] repIds) {
FullValueDescription[] results
= new FullValueDescription[repIds.length];
......@@ -123,7 +133,7 @@ public class CachedCodeBase extends _CodeBaseImplBase
return results;
}
public String[] bases (String repId) {
public synchronized String[] bases (String repId) {
String[] results = null;
......@@ -145,7 +155,7 @@ public class CachedCodeBase extends _CodeBaseImplBase
// Ensures that we've used the connection's IOR to create
// a valid CodeBase delegate. If this returns false, then
// it is not valid to access the delegate.
private boolean connectedCodeBase() {
private synchronized boolean connectedCodeBase() {
if (delegate != null)
return true;
......@@ -165,7 +175,7 @@ public class CachedCodeBase extends _CodeBaseImplBase
return false;
}
synchronized(this) {
synchronized(iorMapLock) {
// Recheck the condition to make sure another
// thread didn't already do this while we waited
......@@ -173,7 +183,8 @@ public class CachedCodeBase extends _CodeBaseImplBase
return true;
// Do we have a reference initialized by another connection?
delegate = (CodeBase)CachedCodeBase.iorToCodeBaseObjMap.get(conn.getCodeBaseIOR());
delegate = CachedCodeBase.iorMap.get(conn.getCodeBaseIOR());
if (delegate != null)
return true;
......@@ -181,8 +192,7 @@ public class CachedCodeBase extends _CodeBaseImplBase
delegate = CodeBaseHelper.narrow(getObjectFromIOR());
// Save it for the benefit of other connections
CachedCodeBase.iorToCodeBaseObjMap.put(conn.getCodeBaseIOR(),
delegate);
CachedCodeBase.iorMap.put(conn.getCodeBaseIOR(), delegate);
}
// It's now safe to use the delegate
......
/*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -58,7 +58,7 @@ import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
import org.omg.PortableInterceptor.TRANSPORT_RETRY;
import org.omg.PortableInterceptor.USER_EXCEPTION;
import org.omg.PortableInterceptor.PolicyFactory;
import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
import org.omg.PortableInterceptor.ObjectReferenceTemplate;
import com.sun.corba.se.pept.encoding.OutputObject;
......@@ -112,10 +112,10 @@ public class PIHandlerImpl implements PIHandler
}
}
private ORB orb ;
InterceptorsSystemException wrapper ;
ORBUtilSystemException orbutilWrapper ;
OMGSystemException omgWrapper ;
private ORB orb;
InterceptorsSystemException wrapper;
ORBUtilSystemException orbutilWrapper;
OMGSystemException omgWrapper;
// A unique id used in ServerRequestInfo.
// This does not correspond to the GIOP request id.
......@@ -178,6 +178,21 @@ public class PIHandlerImpl implements PIHandler
}
};
public void close() {
orb = null;
wrapper = null;
orbutilWrapper = null;
omgWrapper = null;
codecFactory = null;
arguments = null;
interceptorList = null;
interceptorInvoker = null;
current = null;
policyFactoryTable = null;
threadLocalClientRequestInfoStack = null;
threadLocalServerRequestInfoStack = null;
}
// Class to contain all ThreadLocal data for ClientRequestInfo
// maintenance.
//
......
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -69,6 +69,9 @@ public class PINoOpHandlerImpl implements PIHandler
public PINoOpHandlerImpl( ) {
}
public void close() {
}
public void initialize() {
}
......
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -34,14 +34,18 @@ public class MonitoringManagerFactoryImpl implements MonitoringManagerFactory {
private HashMap monitoringManagerTable = new HashMap();
public synchronized MonitoringManager createMonitoringManager(
String nameOfTheRoot, String description )
String nameOfTheRoot, String description)
{
MonitoringManagerImpl m = null;
m = (MonitoringManagerImpl)monitoringManagerTable.get(nameOfTheRoot);
if (m == null) {
m = new MonitoringManagerImpl( nameOfTheRoot, description );
m = new MonitoringManagerImpl(nameOfTheRoot, description);
monitoringManagerTable.put(nameOfTheRoot, m);
}
return m;
}
public synchronized void remove(String nameOfTheRoot) {
monitoringManagerTable.remove(nameOfTheRoot);
}
}
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -26,6 +26,7 @@
package com.sun.corba.se.impl.monitoring;
import com.sun.corba.se.spi.monitoring.MonitoringManager;
import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
import com.sun.corba.se.spi.monitoring.MonitoredObject;
import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory;
import com.sun.corba.se.spi.monitoring.MonitoringFactories;
......@@ -33,18 +34,24 @@ import com.sun.corba.se.spi.monitoring.MonitoringFactories;
public class MonitoringManagerImpl implements MonitoringManager {
private final MonitoredObject rootMonitoredObject;
MonitoringManagerImpl( String nameOfTheRoot, String description ) {
MonitoringManagerImpl(String nameOfTheRoot, String description) {
MonitoredObjectFactory f =
MonitoringFactories.getMonitoredObjectFactory();
rootMonitoredObject =
f.createMonitoredObject( nameOfTheRoot, description );
f.createMonitoredObject(nameOfTheRoot, description);
}
public void clearState( ) {
rootMonitoredObject.clearState( );
public void clearState() {
rootMonitoredObject.clearState();
}
public MonitoredObject getRootMonitoredObject( ) {
public MonitoredObject getRootMonitoredObject() {
return rootMonitoredObject;
}
public void close() {
MonitoringManagerFactory f =
MonitoringFactories.getMonitoringManagerFactory();
f.remove(rootMonitoredObject.getName());
}
}
/*
* Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,6 +25,15 @@
package com.sun.corba.se.impl.orbutil.threadpool;
import java.io.IOException;
import java.security.PrivilegedAction;
import java.security.AccessController;
import java.util.concurrent.atomic.AtomicInteger;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException;
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool;
import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
......@@ -33,21 +42,102 @@ import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolChooser;
import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl;
import com.sun.corba.se.impl.orbutil.ORBConstants;
import com.sun.corba.se.impl.logging.ORBUtilSystemException;
import com.sun.corba.se.impl.orbutil.ORBConstants;
import com.sun.corba.se.spi.logging.CORBALogDomains;
public class ThreadPoolManagerImpl implements ThreadPoolManager
{
private ThreadPool threadPool ;
public ThreadPoolManagerImpl( ThreadGroup tg )
{
// Use unbounded threadpool in J2SE ORB
// ThreadPoolManager from s1as appserver code base can be set in the
// ORB. ThreadPools in the appserver are bounded. In that situation
// the ThreadPool in this ThreadPoolManager will have its threads
// die after the idle timeout.
// XXX Should there be cleanup when ORB.shutdown is called if the
// ORB owns the ThreadPool?
threadPool = new ThreadPoolImpl( tg,
ORBConstants.THREADPOOL_DEFAULT_NAME ) ;
private ThreadPool threadPool;
private ThreadGroup threadGroup;
private static final ORBUtilSystemException wrapper =
ORBUtilSystemException.get(CORBALogDomains.RPC_TRANSPORT);
public ThreadPoolManagerImpl() {
threadGroup = getThreadGroup();
threadPool = new ThreadPoolImpl(threadGroup,
ORBConstants.THREADPOOL_DEFAULT_NAME);
}
private static AtomicInteger tgCount = new AtomicInteger();
private ThreadGroup getThreadGroup() {
ThreadGroup tg;
// See bugs 4916766 and 4936203
// We intend to create new threads in a reliable thread group.
// This avoids problems if the application/applet
// creates a thread group, makes JavaIDL calls which create a new
// connection and ReaderThread, and then destroys the thread
// group. If our ReaderThreads were to be part of such destroyed thread
// group then it might get killed and cause other invoking threads
// sharing the same connection to get a non-restartable
// CommunicationFailure. We'd like to avoid that.
//
// Our solution is to create all of our threads in the highest thread
// group that we have access to, given our own security clearance.
//
try {
// try to get a thread group that's as high in the threadgroup
// parent-child hierarchy, as we can get to.
// this will prevent an ORB thread created during applet-init from
// being killed when an applet dies.
tg = AccessController.doPrivileged(
new PrivilegedAction<ThreadGroup>() {
public ThreadGroup run() {
ThreadGroup tg = Thread.currentThread().getThreadGroup();
ThreadGroup ptg = tg;
try {
while (ptg != null) {
tg = ptg;
ptg = tg.getParent();
}
} catch (SecurityException se) {
// Discontinue going higher on a security exception.
}
return new ThreadGroup(tg, "ORB ThreadGroup " + tgCount.getAndIncrement());
}
}
);
} catch (SecurityException e) {
// something wrong, we go back to the original code
tg = Thread.currentThread().getThreadGroup();
}
return tg;
}
public void close() {
try {
threadPool.close();
} catch (IOException exc) {
wrapper.threadPoolCloseError();
}
try {
boolean isDestroyed = threadGroup.isDestroyed();
int numThreads = threadGroup.activeCount();
int numGroups = threadGroup.activeGroupCount();
if (isDestroyed) {
wrapper.threadGroupIsDestroyed(threadGroup);
} else {
if (numThreads > 0)
wrapper.threadGroupHasActiveThreadsInClose(threadGroup, numThreads);
if (numGroups > 0)
wrapper.threadGroupHasSubGroupsInClose(threadGroup, numGroups);
threadGroup.destroy();
}
} catch (IllegalThreadStateException exc) {
wrapper.threadGroupDestroyFailed(exc, threadGroup);
}
threadGroup = null;
}
/**
......
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -111,24 +111,23 @@ public class WorkQueueImpl implements WorkQueue
return workqueueMonitoredObject;
}
public void addWork(Work work) {
synchronized (this) {
public synchronized void addWork(Work work) {
workItemsAdded++;
work.setEnqueueTime(System.currentTimeMillis());
theWorkQueue.addLast(work);
((ThreadPoolImpl)workerThreadPool).notifyForAvailableWork(this);
}
}
Work requestWork(long waitTime)
throws TimeoutException, InterruptedException
synchronized Work requestWork(long waitTime) throws TimeoutException, InterruptedException
{
Work workItem;
synchronized (this) {
((ThreadPoolImpl)workerThreadPool).incrementNumberOfAvailableThreads();
if (theWorkQueue.size() != 0) {
workItem = (Work)theWorkQueue.removeFirst();
totalTimeInQueue += System.currentTimeMillis() - workItem.getEnqueueTime();
workItemsDequeued++;
((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads();
return workItem;
}
......@@ -145,6 +144,7 @@ public class WorkQueueImpl implements WorkQueue
workItem = (Work)theWorkQueue.removeFirst();
totalTimeInQueue += System.currentTimeMillis() - workItem.getEnqueueTime();
workItemsDequeued++;
((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads();
return workItem;
}
......@@ -152,12 +152,13 @@ public class WorkQueueImpl implements WorkQueue
} while (remainingWaitTime > 0);
((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads();
throw new TimeoutException();
} catch (InterruptedException ie) {
((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads();
throw ie;
}
}
}
public void setThreadPool(ThreadPool workerThreadPool) {
......
/*
* Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -1666,7 +1666,9 @@ public class CorbaMessageMediatorImpl
((CDRInputObject)messageMediator.getInputObject()).unmarshalHeader();
ORB orb = (ORB)messageMediator.getBroker();
orb.checkShutdownState();
synchronized (orb) {
orb.checkShutdownState();
}
ObjectKey okey = messageMediator.getObjectKey();
if (orb.subcontractDebugFlag) {
......
/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -69,8 +69,8 @@ public class SelectorImpl
private HashMap listenerThreads;
private Map readerThreads;
private boolean selectorStarted;
private boolean closed;
private ORBUtilSystemException wrapper ;
private volatile boolean closed;
private ORBUtilSystemException wrapper;
public SelectorImpl(ORB orb)
......
;
; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
; Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
;
; This code is free software; you can redistribute it and/or modify it
......@@ -62,6 +62,7 @@
(IS_LOCAL_REQUIRES_STUB 43 WARNING "Call to StubAdapter.isLocal did not pass a stub")
(REQUEST_REQUIRES_STUB 44 WARNING "Call to StubAdapter.request did not pass a stub")
(BAD_ACTIVATE_TIE_CALL 45 WARNING "Call to StubAdapter.activateTie did not pass a valid Tie")
(IO_EXCEPTION_ON_CLOSE 46 FINE "Useless exception on call to Closeable.close()")
)
(BAD_PARAM
(NULL_PARAM 1 WARNING "Null parameter")
......@@ -291,7 +292,31 @@
(JAVA_STREAM_INIT_FAILED 95 WARNING "Java stream initialization failed")
(DUPLICATE_ORB_VERSION_SERVICE_CONTEXT 96 WARNING "An ORBVersionServiceContext was already in the service context list")
(DUPLICATE_SENDING_CONTEXT_SERVICE_CONTEXT 97 WARNING "A SendingContextServiceContext was already in the service context list")
(WORK_QUEUE_THREAD_INTERRUPTED 98 FINE "Worker Thread from thread pool {0} was interrupted: closeCalled is {1}.")
(WORKER_THREAD_CREATED
104 FINE "Worker thread {0} has been created with ClassLoader {1}")
(WORKER_THREAD_THROWABLE_FROM_REQUEST_WORK
109 FINE "Worker thread {0} caught throwable {1} when requesting work from work queue {2}.")
(WORKER_THREAD_NOT_NEEDED
110 FINE "Worker thread {0} will exit; current thread count, {1}, greater than minunum worker threads needed, {2}.")
(WORKER_THREAD_DO_WORK_THROWABLE
111 FINE "Worker thread {0} caught throwable {1} while executing work.")
(WORKER_THREAD_CAUGHT_UNEXPECTED_THROWABLE
112 WARNING "Worker thread {0} caught unexpected throwable {1}.")
(WORKER_THREAD_CREATION_FAILURE
113 SEVERE "Worker thread creation failure; cause {0}.")
(WORKER_THREAD_SET_NAME_FAILURE
114 WARNING "Unable to set worker thread {0} name to {1}; cause {2}.")
(WORK_QUEUE_REQUEST_WORK_NO_WORK_FOUND
116 WARNING "Ignoring unexpected {0} when retrieving of work from work queue, {1}.")
(THREAD_POOL_CLOSE_ERROR 126 WARNING "Error in closing ThreadPool")
(THREAD_GROUP_IS_DESTROYED 127 WARNING "ThreadGroup {0} is already destroyed: can't destroy it")
(THREAD_GROUP_HAS_ACTIVE_THREADS_IN_CLOSE 128 WARNING "ThreadGroup {0} has {1} active threads: destroy may cause exception")
(THREAD_GROUP_HAS_SUB_GROUPS_IN_CLOSE 129 WARNING "ThreadGroup {0} has {1} sub-thread groups: destroy may cause exception")
(THREAD_GROUP_DESTROY_FAILED 130 WARNING "ThreadGroup {0} could not be destroyed")
(INTERRUPTED_JOIN_CALL_WHILE_CLOSING_THREAD_POOL 131 WARNING "Join was interrupted on thread {0} while closing ThreadPool {1}")
)
(MARSHAL
(CHUNK_OVERFLOW 1 WARNING "Data read past end of chunk without closing the chunk")
(UNEXPECTED_EOF 2 WARNING "Grow buffer strategy called underflow handler")
......
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -24,6 +24,7 @@
*/
package com.sun.corba.se.spi.monitoring;
import java.io.Closeable;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.monitoring.MonitoredObject;
import java.util.*;
......@@ -39,7 +40,7 @@ import java.util.*;
* @author Hemanth Puttaswamy
* </p>
*/
public interface MonitoringManager {
public interface MonitoringManager extends Closeable {
///////////////////////////////////////
// operations
......
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -40,4 +40,6 @@ public interface MonitoringManagerFactory {
*/
MonitoringManager createMonitoringManager( String nameOfTheRoot,
String description );
void remove(String nameOfTheRoot);
}
/*
* Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -171,7 +171,7 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
private static Map staticWrapperMap = new ConcurrentHashMap();
private MonitoringManager monitoringManager;
protected MonitoringManager monitoringManager;
// There is only one instance of the PresentationManager
// that is shared between all ORBs. This is necessary
......@@ -226,6 +226,14 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
globalPM.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
}
public void destroy() {
wrapper = null;
omgWrapper = null;
typeCodeMap = null;
primitiveTypeCodeConstants = null;
byteBufferPool = null;
}
/** Get the single instance of the PresentationManager
*/
public static PresentationManager getPresentationManager()
......@@ -302,6 +310,9 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
// Typecode support: needed in both ORBImpl and ORBSingleton
public TypeCodeImpl get_primitive_tc(int kind)
{
synchronized (this) {
checkShutdownState();
}
try {
return primitiveTypeCodeConstants[kind] ;
} catch (Throwable t) {
......@@ -311,15 +322,20 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
public synchronized void setTypeCode(String id, TypeCodeImpl code)
{
checkShutdownState();
typeCodeMap.put(id, code);
}
public synchronized TypeCodeImpl getTypeCode(String id)
{
checkShutdownState();
return (TypeCodeImpl)typeCodeMap.get(id);
}
public MonitoringManager getMonitoringManager( ) {
synchronized (this) {
checkShutdownState();
}
return monitoringManager;
}
......@@ -434,6 +450,9 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
*/
public Logger getLogger( String domain )
{
synchronized (this) {
checkShutdownState();
}
ORBData odata = getORBData() ;
// Determine the correct ORBId. There are 3 cases:
......@@ -510,6 +529,9 @@ public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
// This method must also be inherited by both ORB and ORBSingleton.
public ByteBufferPool getByteBufferPool()
{
synchronized (this) {
checkShutdownState();
}
if (byteBufferPool == null)
byteBufferPool = new ByteBufferPoolImpl(this);
......
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,9 +25,15 @@
package com.sun.corba.se.spi.orbutil.threadpool;
import java.io.Closeable;
public interface ThreadPool
/** This interface defines a thread pool execution service. The ORB uses this
* interface, which preceeds the JDK 5 ExecutorService. Note that the close
* method must be called in order to reclaim thread resources.
*/
public interface ThreadPool extends Closeable
{
/**
* This method will return any instance of the WorkQueue. If the ThreadPool
* instance only services one WorkQueue then that WorkQueue instance will
......
/*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,7 +25,9 @@
package com.sun.corba.se.spi.orbutil.threadpool;
public interface ThreadPoolManager
import java.io.Closeable;
public interface ThreadPoolManager extends Closeable
{
/**
* This method will return an instance of the threadpool given a threadpoolId,
......
/*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,6 +25,8 @@
package com.sun.corba.se.spi.protocol;
import java.io.Closeable;
import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
import org.omg.PortableInterceptor.Interceptor ;
import org.omg.PortableInterceptor.Current ;
......@@ -51,7 +53,7 @@ import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage ;
/** This interface defines the PI interface that is used to interface the rest of the
* ORB to the PI implementation.
*/
public interface PIHandler {
public interface PIHandler extends Closeable {
/** Complete the initialization of the PIHandler. This will execute the methods
* on the ORBInitializers, if any are defined. This must be done here so that
* the ORB can obtain the PIHandler BEFORE the ORBInitializers run, since they
......
/*
* Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -37,33 +37,59 @@ import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
* This is a registry of all subcontract ID dependent objects. This includes:
* LocalClientRequestDispatcherFactory, ClientRequestDispatcher, ServerRequestDispatcher, and
* ObjectAdapterFactory.
* XXX Should the registerXXX methods take an scid or not? I think we
* want to do this so that the same instance can be shared across multiple
* scids (and this is already true for ObjectAdapterFactory and LocalClientRequestDispatcherFactory),
* but this will require some changes for ClientRequestDispatcher and ServerRequestDispatcher.
*/
public interface RequestDispatcherRegistry {
// XXX needs javadocs!
/** Register a ClientRequestDispatcher for a particular subcontract ID.
* The subcontract ID appears in the ObjectKey of an object reference, and is used
* to control how a remote method invocation is processed by the ORB for a
* particular kind of object reference.
*/
void registerClientRequestDispatcher( ClientRequestDispatcher csc, int scid) ;
/** Get the ClientRequestDispatcher for subcontract ID scid.
*/
ClientRequestDispatcher getClientRequestDispatcher( int scid ) ;
/** Register a LocalClientRequestDispatcher for a particular subcontract ID.
* The subcontract ID appears in the ObjectKey of an object reference, and is used
* to control how a particular kind of colocated request is processed.
*/
void registerLocalClientRequestDispatcherFactory( LocalClientRequestDispatcherFactory csc, int scid) ;
/** Get the LocalClientRequestDispatcher for subcontract ID scid.
*/
LocalClientRequestDispatcherFactory getLocalClientRequestDispatcherFactory( int scid ) ;
/** Register a CorbaServerRequestDispatcher for a particular subcontract ID.
* The subcontract ID appears in the ObjectKey of an object reference, and is used
* to control how a particular kind of request is processed when received by the ORB.
*/
void registerServerRequestDispatcher( CorbaServerRequestDispatcher ssc, int scid) ;
/** Get the CorbaServerRequestDispatcher for subcontract ID scid.
*/
CorbaServerRequestDispatcher getServerRequestDispatcher(int scid) ;
/** Register a CorbaServerRequestDispatcher for handling an explicit object key name.
* This is used for non-standard invocations such as INS and the bootstrap name service.
*/
void registerServerRequestDispatcher( CorbaServerRequestDispatcher ssc, String name ) ;
/** Get the CorbaServerRequestDispatcher for a particular object key.
*/
CorbaServerRequestDispatcher getServerRequestDispatcher( String name ) ;
/** Register an ObjectAdapterFactory for a particular subcontract ID.
* This controls how Object references are created and managed.
*/
void registerObjectAdapterFactory( ObjectAdapterFactory oaf, int scid) ;
/** Get the ObjectAdapterFactory for a particular subcontract ID scid.
*/
ObjectAdapterFactory getObjectAdapterFactory( int scid ) ;
Set getObjectAdapterFactories() ;
/** Return the set of all ObjectAdapterFactory instances that are registered.
*/
Set<ObjectAdapterFactory> getObjectAdapterFactories();
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册