[gf-corba-v3-mirror~gfv2-master:25] Merge

  • From: kcavanaugh@kenai.com
  • To: commits@gf-corba-v3-mirror.kenai.com
  • Subject: [gf-corba-v3-mirror~gfv2-master:25] Merge
  • Date: Wed, 31 Mar 2010 01:39:53 +0000

Project:    gf-corba-v3-mirror
Repository: gfv2-master
Revision:   25
Author:     kcavanaugh
Date:       2010-03-31 01:39:02 UTC
Link:       

Log Message:
------------
Fixed for 6733574: lock contention in POAManager.

The basic problem is that a single POAManager is shared for all
POAs for ReferenceFactory instances created in the ReferenceFactoryManager.
To fix this, the field

POAManager manager

is replaced with

Set<POAManager> managers

and some mainly obvious changes are made in the code so that a new
POAManager is created for each POA created.

The main source of difficulty is that manager was fixed for the life of the
RFM (which is the lifetime of the GF server instance), but the contents of
managers changes each time a ReferenceFactory is created or destroyed,
or the cluster shape change (which destroys and re-creates ALL POAs).
This requires careful update to managers in order to avoid memory leaks,
and to avoid removing POAManager instances too early.

The getState interface also needed to change, since return the manager state
no longer made sense.  Instead, the internal RFMState enum is exposed in the
API, which gives essentially the same information.

I made a few minor test clean ups as well.

Note that more testing is still required, so this is not necessarily the final
version of the change.
Merge


Revisions:
----------
24
25


Modified Paths:
---------------
nbproject/private/private.xml
optional/src/share/classes/com/sun/corba/se/impl/folb/ServerGroupManager.java
optional/test/src/share/classes/corba/folb/Client.java
optional/test/src/share/classes/corba/folb/FolbTest.java
optional/test/src/share/classes/corba/folb/Server.java
src/share/classes/com/sun/corba/se/impl/oa/rfm/ReferenceFactoryManagerImpl.java
src/share/classes/com/sun/corba/se/spi/oa/rfm/ReferenceFactoryManager.java
optional/src/share/classes/com/sun/corba/se/impl/orbutil/copyobject/ClassCopierBase.java
optional/src/share/classes/com/sun/corba/se/impl/orbutil/copyobject/ClassCopierFactoryPipelineImpl.java
src/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java
src/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java
src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java
src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java
src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java
src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java


Diffs:
------
diff -r bacad2e82c36 -r b1e569c6f966 nbproject/private/private.xml
--- a/nbproject/private/private.xml     Fri Aug 14 17:19:16 2009 -0700
+++ b/nbproject/private/private.xml     Tue Mar 30 18:26:19 2010 -0700
@@ -5,5 +5,8 @@
         
<file>file:/space/ws/mercurial/CORBA/corba-gfv2-master/src/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java</file>
         
<file>file:/space/ws/mercurial/CORBA/corba-gfv2-master/test/src/share/classes/corba/misc/Client.java</file>
         
<file>file:/space/ws/mercurial/CORBA/corba-gfv2-master/test/src/share/classes/corba/misc/MiscTest.java</file>
+        
<file>file:/space/ws/mercurial/CORBA/corba-gfv2-master/src/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListImpl.java</file>
+        
<file>file:/space/ws/mercurial/CORBA/corba-gfv2-master/src/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java</file>
+        
<file>file:/space/ws/mercurial/CORBA/corba-gfv2-master/src/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListIteratorImpl.java</file>
     </open-files>
 </project-private>

diff -r bacad2e82c36 -r b1e569c6f966 
optional/src/share/classes/com/sun/corba/se/impl/folb/ServerGroupManager.java
--- 
a/optional/src/share/classes/com/sun/corba/se/impl/folb/ServerGroupManager.java
     Fri Aug 14 17:19:16 2009 -0700
+++ 
b/optional/src/share/classes/com/sun/corba/se/impl/folb/ServerGroupManager.java
     Tue Mar 30 18:26:19 2010 -0700
@@ -579,11 +579,11 @@
 
            if (orb.folbDebugFlag) { dprint(point + "->:", adapterName); }
 
-           if (referenceFactoryManager.getState().value() == 
-               org.omg.PortableServer.POAManagerPackage.State._HOLDING) 
+           if (referenceFactoryManager.getState() == 
+               ReferenceFactoryManager.RFMState.SUSPENDED) 
             {
                if (orb.folbDebugFlag) {
-                   dprint(point + ": RFM in HOLDING - therefore no action");
+                   dprint(point + ": RFM is SUSPENDED - therefore no 
action");
                }
                return;
            }

diff -r bacad2e82c36 -r b1e569c6f966 
optional/test/src/share/classes/corba/folb/Client.java
--- a/optional/test/src/share/classes/corba/folb/Client.java    Fri Aug 14 
17:19:16 2009 -0700
+++ b/optional/test/src/share/classes/corba/folb/Client.java    Tue Mar 30 
18:26:19 2010 -0700
@@ -95,8 +95,7 @@
        //
 
        props.setProperty(ORBConstants.DEBUG_PROPERTY,
-                         //"giop,transport,subcontract,poa"
-                         "transport"
+                         "subcontract,poa,folb"
                          );
 
 

diff -r bacad2e82c36 -r b1e569c6f966 
optional/test/src/share/classes/corba/folb/FolbTest.java
--- a/optional/test/src/share/classes/corba/folb/FolbTest.java  Fri Aug 14 
17:19:16 2009 -0700
+++ b/optional/test/src/share/classes/corba/folb/FolbTest.java  Tue Mar 30 
18:26:19 2010 -0700
@@ -55,79 +55,49 @@
     extends
        CORBATest
 {
+    private void run( Controller server, Controller client, 
+       int tmo ) throws Exception {
+        server.start();
+        client.start();
+
+        client.waitFor(tmo);
+
+        client.stop();
+        server.stop();
+    }
+
     protected void doTest()
        throws Exception
     {
        String thisPackage = FolbTest.class.getPackage().getName();
 
        Controller orbd = createORBD();
-       Controller server;
-       Controller client;
-
        orbd.start();
 
-       //
-       // Main test
-       //
+        try {
+            // Main test
+            Controller server = createServer(thisPackage+"."+"Server", 
"Server");
+            Controller client = createClient(thisPackage+"."+"Client", 
"Client");
+            run( server, client, 180000 ) ;
 
-       server = createServer(thisPackage+"."+"Server", "Server");
-       client = createClient(thisPackage+"."+"Client", "Client");
+            // ClientMulti test
+            server = createServer(thisPackage+"."+"Server", "ServerMulti");
+            client = createClient(thisPackage+"."+"ClientMulti", 
"ClientMulti");
+            run( server, client, 300000 ) ;
 
-       server.start();
-       client.start();
+            // ClientCircular test
+            server = createServer(thisPackage+"."+"Server", 
"ServerCircular");
+            client = createClient(thisPackage+"."+"ClientCircular", 
"ClientCircular");
+            run( server, client, 180000 ) ;
 
-       client.waitFor(180000);
-
-       client.stop();
-       server.stop();
-
-       //
-       // ClientMulti test
-       //
-
-       server = createServer(thisPackage+"."+"Server", "ServerMulti");
-       client = createClient(thisPackage+"."+"ClientMulti", "ClientMulti");
-       server.start();
-       client.start();
-       
-       client.waitFor(300000); // 5 minutes
-
-       client.stop();
-       server.stop();
-
-       //
-       // ClientCircular test
-       //
-
-       server = createServer(thisPackage+"."+"Server", "ServerCircular");
-       client = createClient(thisPackage+"."+"ClientCircular", 
"ClientCircular");
-       server.start();
-       client.start();
-       
-       client.waitFor(180000);
-
-       client.stop();
-       server.stop();
-
-       //
-       // ClientWaitTimeout test
-       //
-
-       server = createServer(thisPackage+"."+"Server", "ServerWaitTimeout");
-       client = createClient(thisPackage+"."+"ClientWaitTimeout", 
"ClientWaitTimeout");
-       server.start();
-       client.start();
-       
-       client.waitFor(120000);
-
-       client.stop();
-       server.stop();
-
-       //
-       // Cleanup
-       //
-
-       orbd.stop();
+            // ClientWaitTimeout test
+            server = createServer(thisPackage+"."+"Server", 
"ServerWaitTimeout");
+            client = createClient(thisPackage+"."+"ClientWaitTimeout", 
"ClientWaitTimeout");
+            run( server, client, 120000 ) ;
+        } finally {
+            // Cleanup
+            orbd.stop();
+        }
     }
 }
 

diff -r bacad2e82c36 -r b1e569c6f966 
optional/test/src/share/classes/corba/folb/Server.java
--- a/optional/test/src/share/classes/corba/folb/Server.java    Fri Aug 14 
17:19:16 2009 -0700
+++ b/optional/test/src/share/classes/corba/folb/Server.java    Tue Mar 30 
18:26:19 2010 -0700
@@ -89,8 +89,7 @@
        //
 
        props.setProperty(ORBConstants.DEBUG_PROPERTY,
-                         //"giop,transport,subcontract,poa"
-                         "transport"
+                         "subcontract,poa,folb"
                          );
 
 

diff -r bacad2e82c36 -r b1e569c6f966 
src/share/classes/com/sun/corba/se/impl/oa/rfm/ReferenceFactoryManagerImpl.java
--- 
a/src/share/classes/com/sun/corba/se/impl/oa/rfm/ReferenceFactoryManagerImpl.java
   Fri Aug 14 17:19:16 2009 -0700
+++ 
b/src/share/classes/com/sun/corba/se/impl/oa/rfm/ReferenceFactoryManagerImpl.java
   Tue Mar 30 18:26:19 2010 -0700
@@ -40,6 +40,8 @@
 import java.util.ArrayList ;
 import java.util.Map ;
 import java.util.HashMap ;
+import java.util.Set ;
+import java.util.HashSet ;
 import java.util.Arrays ;
 
 import java.util.concurrent.locks.ReentrantLock ;
@@ -74,23 +76,23 @@
     extends org.omg.CORBA.LocalObject
     implements ReferenceFactoryManager
 {
-    private enum RFMState { READY, SUSPENDED } ;
-
     private static final String PARENT_POA_NAME = 
        "#INTERNAL#ReferenceFactoryManagerBase#INTERNAL#" ;
 
     // Initialized in the constructor
     private RFMState state ;
-    private ReentrantLock lock ;
-    private Condition suspendCondition ;
-    private ORB orb ;
-    private POASystemException wrapper ;
+    private final ReentrantLock lock ;
+    private final Condition suspendCondition ;
+    private final ORB orb ;
+    private final POASystemException wrapper ;
     // poatable contains the mapping from the ReferenceFactory name to
     // the ServantLocator and list of policies.  Note that the policy
     // list is stored in the form passed to the create() call: that is,
     // it does not contain the standard policies.
-    private Map<String,Pair<ServantLocator,List<Policy>>> poatable ;
-    private Map<String,ReferenceFactory> factories ;
+    private final Map<String,Pair<ServantLocator,List<Policy>>> poatable ;
+    private final Map<String,ReferenceFactory> factories ;
+    private final Set<POAManager> managers ; 
+    private final AdapterActivator activator ; 
 
     private volatile boolean isActive ;
 
@@ -99,16 +101,27 @@
     private List<Policy> standardPolicies ;
     private POA parentPOA ;
     private String[] parentPOAAdapterName ;
-    private POAManager manager ; 
-    private AdapterActivator activator ; 
-       
+
+    public ReferenceFactoryManagerImpl( ORB orb ) 
+    {
+       state = RFMState.READY ;
+       lock = new ReentrantLock() ;
+       suspendCondition = lock.newCondition() ;
+       this.orb = orb ;
+       wrapper = orb.getLogWrapperTable().get_OA_LIFECYCLE_POA() ;
+       poatable = new HashMap<String,Pair<ServantLocator,List<Policy>>>() ;
+       factories = new HashMap<String,ReferenceFactory>() ;
+        managers = new HashSet<POAManager>() ; 
+        activator = new AdapterActivatorImpl() ;
+       isActive = false ;
+    }
+
     private class AdapterActivatorImpl 
        extends LocalObject 
        implements AdapterActivator 
     {
        public boolean unknown_adapter( POA parent, String name ) {
            dprint(".unknown_adapter->: " + parent + " " + name);
-           // lock.lock() ;
            try {
                Pair<ServantLocator,List<Policy>> data = null ;
                synchronized (poatable) {
@@ -129,8 +142,18 @@
                        policies.addAll( standardPolicies ) ;
                        Policy[] arr = policies.toArray( new 
Policy[policies.size()] ) ;
 
-                       POA child = parentPOA.create_POA( name, manager, arr 
) ;
+                       POA child = parentPOA.create_POA( name, null, arr ) ;
+                        POAManager pm = child.the_POAManager() ;
+
+                        lock.lock() ;
+                        try {
+                            managers.add( pm ) ;
+                        } finally {
+                            lock.unlock() ;
+                        }
+
                        child.set_servant_manager( data.first() ) ; 
+                        pm.activate() ;
                        return true ;
                    } catch (Exception exc) {
                        wrapper.rfmAdapterActivatorFailed( exc ) ;
@@ -138,7 +161,6 @@
                    }
                }
            } finally {
-               // lock.unlock() ;
                dprint(".unknown_adapter<-: " + parent + " " + name);
            }
        }
@@ -172,21 +194,14 @@
        }
     }
 
-    public ReferenceFactoryManagerImpl( ORB orb ) 
+    public RFMState getState()
     {
-       lock = new ReentrantLock() ;
-       suspendCondition = lock.newCondition() ;
-       state = RFMState.READY ;
-       this.orb = orb ;
-       wrapper = orb.getLogWrapperTable().get_OA_LIFECYCLE_POA() ;
-       poatable = new HashMap<String,Pair<ServantLocator,List<Policy>>>() ;
-       factories = new HashMap<String,ReferenceFactory>() ;
-       isActive = false ;
-    }
-
-    public org.omg.PortableServer.POAManagerPackage.State getState()
-    {
-       return manager.get_state();
+        lock.lock() ;
+        try {
+            return state ;
+        } finally {
+            lock.unlock() ;
+        }
     }
 
     public void activate() 
@@ -217,10 +232,9 @@
                .getIORTemplate().getObjectKeyTemplate().getObjectAdapterId()
                .getAdapterName() ;
 
-           manager = parentPOA.the_POAManager() ;
-           activator = new AdapterActivatorImpl() ;
+           POAManager pm = parentPOA.the_POAManager() ;
            parentPOA.the_activator( activator ) ;
-           manager.activate() ;
+           pm.activate() ;
 
            // Don't activate if there is a failure
            isActive = true ;
@@ -235,7 +249,7 @@
     public ReferenceFactory create( final String name, 
                                    final String repositoryId,
                                    final List<Policy> policies,
-                                   final ServantLocator manager ) 
+                                   final ServantLocator locator ) 
     {
        dprint(".create->:");
        lock.lock() ;
@@ -253,7 +267,7 @@
            // Store an entry for the appropriate POA in the POA table,
            // which is used by the AdapterActivator on the root.
            synchronized (poatable) {
-               poatable.put( name, new Pair( manager, newPolicies ) ) ;
+               poatable.put( name, new Pair( locator, newPolicies ) ) ;
            }
 
            ReferenceFactory factory = new ReferenceFactoryImpl( this, name, 
repositoryId ) ;
@@ -314,12 +328,17 @@
     // hold_requests or discard_requests.  Hold will
     // cause incoming requests to be suspended, which
     // could rapidly consume all of the threads in the
-    // threadpool.  Instead, we will discard the 
-    // requests, which causes a TRANSIENT system
+    // threadpool.  It may be preferable to discard the 
+    // requests, which would cause a TRANSIENT system
     // exception to be sent to the client.  All
     // TRANSIENT system exceptions will be retried
     // on the client side to the same endpoint.
-    // manager.discard_requests( true ) ; 
+    // But at one time, the client retry logic was not
+    // robust enough to handle the resulting TRANSIENT
+    // exceptions.  
+    //
+    // XXX We may still want to switch to discard
+    // semantics, but it requires significant testing.
 
     public void suspend() 
     {
@@ -328,7 +347,10 @@
 
            lock.lock() ;
        
-           // wait until all requests in the manager have completed.
+            // Clone POAManagers so we can safely iterate over it.
+            final Set<POAManager> pms = new HashSet<POAManager>( managers ) ;
+
+           // wait until all requests in the POAManagers have completed.
            try {
                if (!isActive) {
                    throw wrapper.rfmNotActive() ;
@@ -356,7 +378,9 @@
            // could reverse the order, leading to a deadlock.  See bug
            // 6586417.
            try {
-               manager.hold_requests( true ) ;
+                for (POAManager pm : pms) {
+                    pm.hold_requests( true ) ;
+                }
            } catch (AdapterInactive ai) {
                // This should never happen
                throw wrapper.rfmManagerInactive( ai ) ;
@@ -372,6 +396,10 @@
            dprint(".resume->:");
 
            lock.lock() ;
+
+            // Clone POAManagers so we can safely iterate over it.
+            final Set<POAManager> pms = new HashSet<POAManager>( managers ) ;
+        
            try {
                if (!isActive)
                    throw wrapper.rfmNotActive() ;
@@ -384,13 +412,41 @@
 
            // Allow new requests to start.  This will lazily 
            // re-create POAs as needed through the parentPOA's 
-           // AdapterActivator.
-           try {
-               manager.activate() ;
+           // AdapterActivator.  
+            //
+            // 6933574: But note that these POAManagers belong to
+            // destroyed POAs (from the restartFactories call), 
+            // so the activation here results in
+            // an OADestroyed exception, which causes a retry in 
+            // the server request dispatcher.  Re-creating the
+            // POA also re-creates the POAManager, so after 
+            // activating the POAManagers, we remove the (old)
+            // POAManagers from the list.  Note that the list
+            // may (will) have changed by then, since other
+            // threads may (will) be re-creating the POAs and hence
+            // re-creating the POAManagers and adding the new POAManagers
+            // to managers.
+
+            try {
+                for (POAManager pm : pms) {
+                    pm.activate() ;
+                }
            } catch (AdapterInactive ai) {
                // This should never happen
                throw wrapper.rfmManagerInactive( ai ) ;
            } 
+
+            lock.lock() ;
+            try {
+                // 6933574: As noted above, we need to remove
+                // all of the old POAManagers (to avoid a memory
+                // leak).  Note that managers may contain new
+                // POAManagers by this time, so we can't just
+                // clear it.
+                managers.removeAll( pms ) ;
+            } finally {
+                lock.unlock() ;
+            }
        } finally {
            dprint(".resume<-:");
        }
@@ -505,6 +561,8 @@
                lock.lock() ;
                try {
                    factories.remove( name ) ;
+                    POAManager pm = child.the_POAManager() ;
+                    managers.remove( pm ) ;
                } finally {
                    lock.unlock() ;
                }
@@ -529,7 +587,7 @@
        if (!isActive)
            return ;
 
-       // Only check the case where poa does not have the reference manager
+       // Only check the case where poa does not have the ReferenceManager
        // policy.  We assume that we handle the policy correctly inside
        // the RFM itself.
        Policy policy = ObjectAdapter.class.cast(poa).getEffectivePolicy( 
@@ -547,10 +605,16 @@
        if (parentPolicy != null)
            throw wrapper.rfmIllegalParentPoaUsage() ;
 
-       // If poa's POAManager is the manager for the RFM, we have
+       // If poa's POAManager is one of the POAManagers for the RFM, we have
        // an error.
-       if (poa.the_POAManager() == manager) 
-           throw wrapper.rfmIllegalPoaManagerUsage() ;
+        lock.lock() ;
+        try {
+            if (managers.contains( poa.the_POAManager() ) ) {
+                throw wrapper.rfmIllegalPoaManagerUsage() ;
+            }
+        } finally {
+            lock.unlock() ;
+        }
     }
 
     private void dprint(String msg)

diff -r bacad2e82c36 -r b1e569c6f966 
src/share/classes/com/sun/corba/se/spi/oa/rfm/ReferenceFactoryManager.java
--- 
a/src/share/classes/com/sun/corba/se/spi/oa/rfm/ReferenceFactoryManager.java  
      Fri Aug 14 17:19:16 2009 -0700
+++ 
b/src/share/classes/com/sun/corba/se/spi/oa/rfm/ReferenceFactoryManager.java  
      Tue Mar 30 18:26:19 2010 -0700
@@ -76,9 +76,11 @@
 public interface ReferenceFactoryManager extends org.omg.CORBA.Object,
     org.omg.CORBA.portable.IDLEntity 
 {
+    public enum RFMState { READY, SUSPENDED } ;
+
     /** The state of the ReferenceFactoryManager.
      */
-    public org.omg.PortableServer.POAManagerPackage.State getState();
+    public RFMState getState();
 
     /** Must be called before any other operation.
      * Used to activate the ORB reference creation function.


diff -r b1e569c6f966 -r 05d0da9b6773 
optional/src/share/classes/com/sun/corba/se/impl/orbutil/copyobject/ClassCopierBase.java
--- 
a/optional/src/share/classes/com/sun/corba/se/impl/orbutil/copyobject/ClassCopierBase.java
  Tue Mar 30 18:26:19 2010 -0700
+++ 
b/optional/src/share/classes/com/sun/corba/se/impl/orbutil/copyobject/ClassCopierBase.java
  Tue Mar 30 18:39:02 2010 -0700
@@ -117,9 +117,13 @@
     {
        Object result = oldToNew.get( source ) ;
        if (result == null) {
-           result = createCopy( source, debug ) ;
-           oldToNew.put( source, result ) ;
-           result = doCopy( oldToNew, source, result, debug ) ;
+            try {
+                 result = createCopy( source, debug ) ;
+                 oldToNew.put( source, result ) ;
+                 result = doCopy( oldToNew, source, result, debug ) ;
+            } catch (StackOverflowError ex) {
+                 throw new ReflectiveCopyException(ex.getMessage(),ex);
+            }
        }
        return result ;
     }

diff -r b1e569c6f966 -r 05d0da9b6773 
optional/src/share/classes/com/sun/corba/se/impl/orbutil/copyobject/ClassCopierFactoryPipelineImpl.java
--- 
a/optional/src/share/classes/com/sun/corba/se/impl/orbutil/copyobject/ClassCopierFactoryPipelineImpl.java
   Tue Mar 30 18:26:19 2010 -0700
+++ 
b/optional/src/share/classes/com/sun/corba/se/impl/orbutil/copyobject/ClassCopierFactoryPipelineImpl.java
   Tue Mar 30 18:39:02 2010 -0700
@@ -84,6 +84,7 @@
        Thread.class, 
        ThreadGroup.class, 
        ProcessBuilder.class,
+        java.util.LinkedHashMap.class,
     } ;
 
     // List of some immutable classes that are copied simply

diff -r b1e569c6f966 -r 05d0da9b6773 
src/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java       Tue 
Mar 30 18:26:19 2010 -0700
+++ b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java       Tue 
Mar 30 18:39:02 2010 -0700
@@ -1638,6 +1638,18 @@
     
     public void getInvocationServant( OAInvocationInfo info ) 
     {
+       if (info == null) {
+           if (debug) {
+               ORBUtility.dprint( this,
+                   "Calling getInvocationServant on poa " + this ) ;
+               ORBUtility.dprint( this,
+                   "OAInvocationInfo info == null! on poa " + this ) ;
+               ORBUtility.dprint( this,
+                   "Exiting getInvocationServant on poa " + this ) ;
+           }
+           return ;
+       }
+
        try {
            lock() ;
 

diff -r b1e569c6f966 -r 05d0da9b6773 
src/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java
--- a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java      
  Tue Mar 30 18:26:19 2010 -0700
+++ b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java      
  Tue Mar 30 18:39:02 2010 -0700
@@ -169,7 +169,7 @@
            }
 
            nWaiters++ ;
-           wait(); 
+           wait(nWaiters*1000L); 
        } catch ( java.lang.InterruptedException ex ) {
            // NOP
        } finally {
@@ -598,6 +598,7 @@
                    + this + " from activeManagers" ) ;
            }
 
+       } finally {
            nInvocations--; 
 
            if ( nInvocations == 0 ) {
@@ -605,7 +606,6 @@
                // wait_for_completion loop in hold/discard/deactivate().
                notifyWaiters();
            }
-       } finally {
            if (debug) {
                ORBUtility.dprint( this,
                    "Exiting exit for POAManagerImpl " + this ) ;

diff -r b1e569c6f966 -r 05d0da9b6773 
src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java
--- 
a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java
  Tue Mar 30 18:26:19 2010 -0700
+++ 
b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java
  Tue Mar 30 18:39:02 2010 -0700
@@ -105,7 +105,7 @@
     public void returnServant() 
     {
        OAInvocationInfo info = orb.peekInvocationInfo();
-       if (locator == null)
+       if (locator == null || info == null)
            return;
 
        try {

diff -r b1e569c6f966 -r 05d0da9b6773 
src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java
--- 
a/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java
   Tue Mar 30 18:26:19 2010 -0700
+++ 
b/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java
   Tue Mar 30 18:39:02 2010 -0700
@@ -238,6 +238,8 @@
     public void returnServant()
     {
        OAInvocationInfo info = orb.peekInvocationInfo();
+       if (info == null)
+           return ;
        byte[] id = info.id() ;
        ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
        AOMEntry entry = activeObjectMap.get( key ) ;

diff -r b1e569c6f966 -r 05d0da9b6773 
src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java
--- 
a/src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java
     Tue Mar 30 18:26:19 2010 -0700
+++ 
b/src/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java
     Tue Mar 30 18:39:02 2010 -0700
@@ -183,10 +183,22 @@
                         ((ThreadPoolImpl)workerThreadPool).
                                               
decrementCurrentNumberOfThreads();
                         throw new WorkerThreadNotNeededException();
-                    } else {
-                        // Keep this thread available.
-                        return null;
-                    }
+                    }/*
+                     * cr#6844972
+                     * Allow the thread to poll the Queue for work.
+                     * If there is work, the thread would return work else
+                     * would return null.
+                     * This helps in resolving delay issues, when there is a 
single work
+                     * stuck in the Queue. When such scenario happens, a 
delay of current
+                     * cycle + 1 was seen. By making the thread to poll, 
this delay 
+                     * disappears. Also, when there is work present in the 
queue, its
+                     * important to allow the thread to process the work.
+                     *  else {
+                      *  // Keep this thread available.
+                      *  return null;
+                      * }
+                     *
+                     */                
                 } // else
                   // If wait(waitTime) returns before waitTime expired,
                   // then there "should" be Work on the WorkQueue ready to be

diff -r b1e569c6f966 -r 05d0da9b6773 
src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
--- 
a/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
      Tue Mar 30 18:26:19 2010 -0700
+++ 
b/src/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
      Tue Mar 30 18:39:02 2010 -0700
@@ -873,42 +873,28 @@
             
             if (socketChannel != null) {
                 closeTemporarySelectors();
-                // NOTE: Until JDK bug 6215050 is fixed in Java 5, do not use
-                //       socketChannel.close(). Instead shutdown input &
-                //       output streams on the Socket and use socket.close().
-                //       JDK bug 6215050 was fixed in JDK 1.5.0_07. Can use
-                //       socketChannel.close() for 1.5.0_07 and later JDKs.
-                if (!socketChannel.socket().isInputShutdown()) {
-                    if (orb.transportDebugFlag) {
-                        dprint("closeSocketAndTemporarySelectors: shutting " 
+
-                               "down Connection socket input stream : " + 
this);
-                    }
-                    socketChannel.socket().shutdownInput();
-                }
-                if (!socketChannel.socket().isOutputShutdown()) {
-                    if (orb.transportDebugFlag) {
-                        dprint("closeSocketAndTemporarySelectors: shutting " 
+
-                               "down Connection socket output stream : " + 
this);
-                    }
-                    socketChannel.socket().shutdownOutput();
-                }
-                if (!socketChannel.socket().isClosed()) {
-                    socketChannel.socket().close();
-                }
+               if (orb.transportDebugFlag) {
+                       dprint("closeSocketAndTemporarySelectors: closing the 
socketChannel") ;
+               }
+               socketChannel.close();
             }
-            
-            if (socket != null && !socket.isClosed()) {
-                socket.close();
-            }
-            
         } catch (IOException e) {
             if (orb.transportDebugFlag) {
                 dprint(".closeSocketAndTemporarySelectors: " + this, e);
             }
         } finally {
-           if (orb.transportDebugFlag) {
+            try {
+               if (socket != null && !socket.isClosed()) {
+                       socket.close();
+               } 
+            } catch (Exception e) {
+               if (orb.transportDebugFlag) {
+                       dprint(".closeSocketAndTemporarySelectors<-: close 
Socket exception"); 
+               }
+            }
+            if (orb.transportDebugFlag) {
                dprint(".closeSocketAndTemporarySelectors<-: " + this);
-            }
+             }
         }
     }
 






[gf-corba-v3-mirror~gfv2-master:25] Merge

kcavanaugh 03/31/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close