aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlana <none@none>2010-12-20 17:18:56 -0800
committerlana <none@none>2010-12-20 17:18:56 -0800
commit070801b5bc20903d0818103436435308d22b8f20 (patch)
tree6f43faf230a82f9398744ac9b2451900772cde9f
parent022a902fcda382a610ed99f0aaccf26e857329d3 (diff)
parent0402366848e089168005f8053ca68733cfbc481a (diff)
-rw-r--r--src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java10
-rw-r--r--src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java9
-rw-r--r--src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java28
-rw-r--r--src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java10
-rw-r--r--src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java24
-rw-r--r--src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java30
-rw-r--r--src/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java11
-rw-r--r--src/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java11
-rw-r--r--src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java16
-rw-r--r--src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java23
-rw-r--r--src/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java6
-rw-r--r--src/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java4
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java16
13 files changed, 160 insertions, 38 deletions
diff --git a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java
index da369f9..0c78443 100644
--- a/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java
+++ b/src/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java
@@ -30,12 +30,14 @@ import com.sun.corba.se.impl.orbutil.ORBConstants;
import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
import com.sun.corba.se.impl.encoding.BufferManagerWrite;
import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
import com.sun.corba.se.impl.encoding.CDROutputObject;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.pept.transport.Connection;
import com.sun.corba.se.pept.encoding.OutputObject;
+import org.omg.CORBA.SystemException;
/**
* Streaming buffer manager.
@@ -66,7 +68,13 @@ public class BufferManagerWriteStream extends BufferManagerWrite
// Set the fragment's moreFragments field to true
MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);
- sendFragment(false);
+ try {
+ sendFragment(false);
+ } catch(SystemException se){
+ orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.SYSTEM_EXCEPTION, se);
+ throw se;
+ }
// Reuse the old buffer
diff --git a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
index 09eb3d2..a8f5567 100644
--- a/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
+++ b/src/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
@@ -85,6 +85,9 @@ public class ObjectStreamClass implements java.io.Serializable {
private static Hashtable translatedFields;
+ /** true if represents enum type */
+ private boolean isEnum;
+
private static final Bridge bridge =
(Bridge)AccessController.doPrivileged(
new PrivilegedAction() {
@@ -359,6 +362,7 @@ public class ObjectStreamClass implements java.io.Serializable {
}
name = cl.getName();
+ isEnum = Enum.class.isAssignableFrom(cl);
superclass = superdesc;
serializable = serial;
if (!forProxyClass) {
@@ -401,7 +405,8 @@ public class ObjectStreamClass implements java.io.Serializable {
if (!serializable ||
externalizable ||
forProxyClass ||
- name.equals("java.lang.String")) {
+ name.equals("java.lang.String") ||
+ isEnum) {
fields = NO_FIELDS;
} else if (serializable) {
/* Ask for permission to override field access checks.
@@ -502,7 +507,7 @@ public class ObjectStreamClass implements java.io.Serializable {
*
* NonSerializable classes have a serialVerisonUID of 0L.
*/
- if (isNonSerializable()) {
+ if (isNonSerializable() || isEnum) {
suid = 0L;
} else {
// Lookup special Serializable members using reflection.
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java
index b7564e7..d906afe 100644
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java
+++ b/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, 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
@@ -45,6 +45,10 @@ import com.sun.corba.se.spi.orbutil.fsm.StateEngineFactory ;
import com.sun.corba.se.impl.orbutil.concurrent.Mutex ;
import com.sun.corba.se.impl.orbutil.concurrent.CondVar ;
+import org.omg.CORBA.SystemException ;
+
+import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
+
/** AOMEntry represents a Servant or potential Servant in the ActiveObjectMap.
* It may be in several states to allow for long incarnate or etherealize operations.
* The methods on this class mostly represent input symbols to the state machine
@@ -121,6 +125,12 @@ public class AOMEntry extends FSMImpl {
}
} ;
+ private static Action oaaAction = new ActionBase( "throwObjectAlreadyActive" ) {
+ public void doIt( FSM fsm, Input in ) {
+ throw new RuntimeException( new ObjectAlreadyActive() ) ;
+ }
+ } ;
+
private static Guard waitGuard = new GuardBase( "wait" ) {
public Guard.Result evaluate( FSM fsm, Input in ) {
AOMEntry entry = (AOMEntry)fsm ;
@@ -173,19 +183,23 @@ public class AOMEntry extends FSMImpl {
engine.add( INCARN, START_ETH, waitGuard, null, INCARN ) ;
engine.add( INCARN, INC_DONE, null, VALID ) ;
engine.add( INCARN, INC_FAIL, decrementAction, INVALID ) ;
+ engine.add( INCARN, ACTIVATE, oaaAction, INCARN ) ;
engine.add( VALID, ENTER, incrementAction, VALID ) ;
engine.add( VALID, EXIT, decrementAction, VALID ) ;
engine.add( VALID, START_ETH, greaterZeroGuard, null, ETHP ) ;
engine.add( VALID, START_ETH, zeroGuard, null, ETH ) ;
+ engine.add( VALID, ACTIVATE, oaaAction, VALID ) ;
engine.add( ETHP, ENTER, waitGuard, null, ETHP ) ;
engine.add( ETHP, START_ETH, null, ETHP ) ;
engine.add( ETHP, EXIT, greaterOneGuard, decrementAction, ETHP ) ;
engine.add( ETHP, EXIT, oneGuard, decrementAction, ETH ) ;
+ engine.add( ETHP, ACTIVATE, oaaAction, ETHP ) ;
engine.add( ETH, START_ETH, null, ETH ) ;
engine.add( ETH, ETH_DONE, null, DESTROYED ) ;
+ engine.add( ETH, ACTIVATE, oaaAction, ETH ) ;
engine.add( ETH, ENTER, waitGuard, null, ETH ) ;
engine.setDefault( DESTROYED, throwIllegalStateExceptionAction, DESTROYED ) ;
@@ -217,7 +231,17 @@ public class AOMEntry extends FSMImpl {
public void etherealizeComplete() { doIt( ETH_DONE ) ; }
public void incarnateComplete() { doIt( INC_DONE ) ; }
public void incarnateFailure() { doIt( INC_FAIL ) ; }
- public void activateObject() { doIt( ACTIVATE ) ; }
+ public void activateObject() throws ObjectAlreadyActive {
+ try {
+ doIt( ACTIVATE ) ;
+ } catch (RuntimeException exc) {
+ Throwable thr = exc.getCause() ;
+ if (thr instanceof ObjectAlreadyActive)
+ throw (ObjectAlreadyActive)thr ;
+ else
+ throw exc ;
+ }
+ }
public void enter() { doIt( ENTER ) ; }
public void exit() { doIt( EXIT ) ; }
}
diff --git a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java
index b396ac5..1bc9130 100644
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java
+++ b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, 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
@@ -107,13 +107,9 @@ public abstract class POAPolicyMediatorBase_R extends POAPolicyMediatorBase {
throw new ServantAlreadyActive();
ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
- // Note that this can't happen for system assigned IDs since the
- // POA never hands out the same ID. However, we make this redundant
- // check here to share the code.
- if (activeObjectMap.containsKey(key))
- throw new ObjectAlreadyActive() ;
-
AOMEntry entry = activeObjectMap.get( key ) ;
+
+ // Check for an ObjectAlreadyActive error
entry.activateObject() ;
activateServant( key, entry, servant ) ;
}
diff --git a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
index 0bdd107..65d8246 100644
--- a/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
+++ b/src/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2010, 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
@@ -245,7 +245,14 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
// All access to resolver, localResolver, and urlOperation must be protected using
// resolverLock. Do not hold the ORBImpl lock while accessing
// resolver, or deadlocks may occur.
- private Object resolverLock ;
+ // Note that we now have separate locks for each resolver type. This is due
+ // to bug 6980681 and 6238477, which was caused by a deadlock while resolving a
+ // corbaname: URL that contained a reference to the same ORB as the
+ // ORB making the call to string_to_object. This caused a deadlock between the
+ // client thread holding the single lock for access to the urlOperation,
+ // and the server thread handling the client is_a request waiting on the
+ // same lock to access the localResolver.
+
// Used for resolver_initial_references and list_initial_services
private Resolver resolver ;
@@ -255,8 +262,14 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
// Converts strings to object references for resolvers and string_to_object
private Operation urlOperation ;
+ private final Object urlOperationLock = new java.lang.Object() ;
private CorbaServerRequestDispatcher insNamingDelegate ;
+ // resolverLock must be used for all access to either resolver or
+ // localResolver, since it is possible for the resolver to indirectly
+ // refer to the localResolver. Also used to protect access to
+ // insNamingDelegate.
+ private final Object resolverLock = new Object() ;
private TaggedComponentFactoryFinder taggedComponentFactoryFinder ;
@@ -396,7 +409,6 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
}
};
- resolverLock = new java.lang.Object() ;
requestDispatcherRegistry = new RequestDispatcherRegistryImpl(
this, ORBConstants.DEFAULT_SCID);
@@ -832,7 +844,7 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
if (str == null)
throw wrapper.nullParam() ;
- synchronized (resolverLock) {
+ synchronized (urlOperationLock) {
org.omg.CORBA.Object obj = (org.omg.CORBA.Object)op.operate( str ) ;
return obj ;
}
@@ -1778,7 +1790,7 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
*/
public void setURLOperation( Operation stringToObject )
{
- synchronized (resolverLock) {
+ synchronized (urlOperationLock) {
urlOperation = stringToObject ;
}
}
@@ -1788,7 +1800,7 @@ public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
*/
public Operation getURLOperation()
{
- synchronized (resolverLock) {
+ synchronized (urlOperationLock) {
return urlOperation ;
}
}
diff --git a/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java b/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java
index 5c7555f..7728a67 100644
--- a/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java
+++ b/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, 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
@@ -122,9 +122,6 @@ public class CorbaClientRequestDispatcherImpl
implements
ClientRequestDispatcher
{
- // Used for locking
- private Object lock = new Object();
-
public OutputObject beginRequest(Object self, String opName,
boolean isOneWay, ContactInfo contactInfo)
{
@@ -151,7 +148,8 @@ public class CorbaClientRequestDispatcherImpl
// This locking is done so that multiple connections are not created
// for the same endpoint
- synchronized (lock) {
+ //6929137 - Synchronized on contactInfo to avoid blocking across multiple endpoints
+ synchronized (contactInfo) {
if (contactInfo.isConnectionBased()) {
if (contactInfo.shouldCacheConnection()) {
connection = (CorbaConnection)
@@ -256,7 +254,7 @@ public class CorbaClientRequestDispatcherImpl
registerWaiter(messageMediator);
// Do connection reclaim now
- synchronized (lock) {
+ synchronized (contactInfo) {
if (contactInfo.isConnectionBased()) {
if (contactInfo.shouldCacheConnection()) {
OutboundConnectionCache connectionCache =
@@ -387,11 +385,15 @@ public class CorbaClientRequestDispatcherImpl
boolean retry =
getContactInfoListIterator(orb)
.reportException(messageMediator.getContactInfo(), e);
- if (retry) {
- // Must run interceptor end point before retrying.
- Exception newException =
+
+ //Bug 6382377: must not lose exception in PI
+
+ // Must run interceptor end point before retrying.
+ Exception newException =
orb.getPIHandler().invokeClientPIEndingPoint(
- ReplyMessage.SYSTEM_EXCEPTION, e);
+ ReplyMessage.SYSTEM_EXCEPTION, e);
+
+ if (retry) {
if (newException == e) {
continueOrThrowSystemOrRemarshal(messageMediator,
new RemarshalException());
@@ -400,6 +402,14 @@ public class CorbaClientRequestDispatcherImpl
newException);
}
} else {
+ if (newException instanceof RuntimeException){
+ throw (RuntimeException)newException;
+ }
+ else if (newException instanceof RemarshalException)
+ {
+ throw (RemarshalException)newException;
+ }
+
// NOTE: Interceptor ending point will run in releaseReply.
throw e;
}
diff --git a/src/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java b/src/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java
index d8608f2..0cbce53 100644
--- a/src/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java
+++ b/src/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2010, 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,6 +34,7 @@ import com.sun.corba.se.pept.transport.ConnectionCache;
import com.sun.corba.se.spi.logging.CORBALogDomains;
import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaConnection;
import com.sun.corba.se.spi.transport.CorbaConnectionCache;
import com.sun.corba.se.impl.logging.ORBUtilSystemException;
@@ -87,6 +88,14 @@ public abstract class CorbaConnectionCacheBase
}
}
+ public void close() {
+ synchronized (backingStore()) {
+ for (Object obj : values()) {
+ ((CorbaConnection)obj).closeConnectionResources() ;
+ }
+ }
+ }
+
public long numberOfIdleConnections()
{
long count = 0;
diff --git a/src/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java b/src/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java
index 5f56b56..fae2d15 100644
--- a/src/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java
+++ b/src/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010 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
@@ -38,6 +38,7 @@ import org.omg.CORBA.INTERNAL;
import org.omg.CORBA.CompletionStatus;
import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.ConnectionCache;
import com.sun.corba.se.pept.transport.ByteBufferPool;
import com.sun.corba.se.pept.transport.ContactInfo;
import com.sun.corba.se.pept.transport.InboundConnectionCache;
@@ -49,6 +50,8 @@ import com.sun.corba.se.spi.ior.ObjectAdapterId;
import com.sun.corba.se.spi.orb.ORB;
import com.sun.corba.se.spi.transport.CorbaAcceptor;
import com.sun.corba.se.spi.transport.CorbaTransportManager;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ConnectionCache;
// REVISIT - impl/poa specific:
import com.sun.corba.se.impl.oa.poa.Policies;
@@ -182,6 +185,12 @@ public class CorbaTransportManagerImpl
if (orb.transportDebugFlag) {
dprint(".close->");
}
+ for (Object cc : outboundConnectionCaches.values()) {
+ ((ConnectionCache)cc).close() ;
+ }
+ for (Object cc : inboundConnectionCaches.values()) {
+ ((ConnectionCache)cc).close() ;
+ }
getSelector(0).close();
} finally {
if (orb.transportDebugFlag) {
diff --git a/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java b/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java
index 8686439..1c60088 100644
--- a/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java
+++ b/src/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, 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
@@ -32,6 +32,7 @@ import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Map;
import java.util.Iterator;
import java.util.List;
@@ -66,7 +67,7 @@ public class SelectorImpl
private List deferredRegistrations;
private List interestOpsList;
private HashMap listenerThreads;
- private HashMap readerThreads;
+ private Map readerThreads;
private boolean selectorStarted;
private boolean closed;
private ORBUtilSystemException wrapper ;
@@ -81,7 +82,7 @@ public class SelectorImpl
deferredRegistrations = new ArrayList();
interestOpsList = new ArrayList();
listenerThreads = new HashMap();
- readerThreads = new HashMap();
+ readerThreads = java.util.Collections.synchronizedMap(new HashMap());
closed = false;
wrapper = ORBUtilSystemException.get(orb,CORBALogDomains.RPC_TRANSPORT);
}
@@ -178,8 +179,13 @@ public class SelectorImpl
}
if (eventHandler.shouldUseSelectThreadToWait()) {
- SelectionKey selectionKey = eventHandler.getSelectionKey();
- selectionKey.cancel();
+ SelectionKey selectionKey ;
+ synchronized(deferredRegistrations) {
+ selectionKey = eventHandler.getSelectionKey();
+ }
+ if (selectionKey != null) {
+ selectionKey.cancel();
+ }
selector.wakeup();
return;
}
diff --git a/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java b/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
index e294067..913cd90 100644
--- a/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
+++ b/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
@@ -811,6 +811,7 @@ public class SocketOrChannelConnectionImpl
dprint(".close: " + this, e);
}
}
+ closeConnectionResources();
} finally {
if (orb.transportDebugFlag) {
dprint(".close<-: " + this);
@@ -818,6 +819,28 @@ public class SocketOrChannelConnectionImpl
}
}
+ public void closeConnectionResources() {
+ if (orb.transportDebugFlag) {
+ dprint(".closeConnectionResources->: " + this);
+ }
+ Selector selector = orb.getTransportManager().getSelector(0);
+ selector.unregisterForEvent(this);
+ try {
+ if (socketChannel != null)
+ socketChannel.close() ;
+ if (socket != null && !socket.isClosed())
+ socket.close() ;
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint( ".closeConnectionResources: " + this, e ) ;
+ }
+ }
+ if (orb.transportDebugFlag) {
+ dprint(".closeConnectionResources<-: " + this);
+ }
+ }
+
+
public Acceptor getAcceptor()
{
return acceptor;
diff --git a/src/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java b/src/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java
index d5bee7d..ac926d0 100644
--- a/src/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java
+++ b/src/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java
@@ -41,6 +41,12 @@ public interface ConnectionCache
public long numberOfBusyConnections();
public boolean reclaim();
+
+ /** Close all connections in the connection cache.
+ * This is used as a final cleanup, and will result
+ * in abrupt termination of any pending communications.
+ */
+ public void close();
}
// End of file.
diff --git a/src/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java b/src/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java
index b0e3f6f..c7ec1ac 100644
--- a/src/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java
+++ b/src/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java
@@ -163,6 +163,10 @@ public interface CorbaConnection
// REVISIT - MessageMediator parameter?
public void serverRequestProcessingBegins();
public void serverRequestProcessingEnds();
+
+ /** Clean up all connection resources. Used when shutting down an ORB.
+ */
+ public void closeConnectionResources();
}
// End of file.
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java
index 3efe560..c305ada 100644
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java
+++ b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2010, 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
@@ -344,17 +344,27 @@ public class Stub implements AuxGen
stream.println (" String str = s.readUTF ();");
stream.println (" String[] args = null;");
stream.println (" java.util.Properties props = null;");
- stream.println (" org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);");
+ stream.println (" org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);");
+ stream.println (" try {");
+ stream.println (" org.omg.CORBA.Object obj = orb.string_to_object (str);");
stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();");
stream.println (" _set_delegate (delegate);");
+ stream.println (" } finally {");
+ stream.println (" orb.destroy() ;");
+ stream.println (" }");
stream.println (" }");
stream.println ();
stream.println (" private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException");
stream.println (" {");
stream.println (" String[] args = null;");
stream.println (" java.util.Properties props = null;");
- stream.println (" String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);");
+ stream.println (" org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);");
+ stream.println (" try {");
+ stream.println (" String str = orb.object_to_string (this);");
stream.println (" s.writeUTF (str);");
+ stream.println (" } finally {");
+ stream.println (" orb.destroy() ;");
+ stream.println (" }");
stream.println (" }");
}