6948223: Corba issue, fail to reload object
authorskoppar
Thu, 07 Oct 2010 01:03:51 -0700
changeset 7583 63bce69d3e5b
parent 7582 f7528916cb2d
child 7584 012316fca11a
6948223: Corba issue, fail to reload object Reviewed-by: asaha
corba/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java
corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java
--- a/corba/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java	Thu Oct 07 00:53:49 2010 -0700
+++ b/corba/src/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java	Thu Oct 07 01:03:51 2010 -0700
@@ -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.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 @@
         }
     } ;
 
+    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 @@
         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 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 ) ; }
 }
--- a/corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java	Thu Oct 07 00:53:49 2010 -0700
+++ b/corba/src/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java	Thu Oct 07 01:03:51 2010 -0700
@@ -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 @@
             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 ) ;
 
-        AOMEntry entry = activeObjectMap.get( key ) ;
+        // Check for an ObjectAlreadyActive error
         entry.activateObject() ;
         activateServant( key, entry, servant ) ;
     }