diff options
Diffstat (limited to 'libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java')
-rw-r--r-- | libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java | 60 |
1 files changed, 54 insertions, 6 deletions
diff --git a/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java b/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java index 6c1b5644f36..7710306b748 100644 --- a/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java +++ b/libjava/classpath/gnu/CORBA/Poa/gnuPOAManager.java @@ -40,6 +40,8 @@ package gnu.CORBA.Poa; import org.omg.CORBA.BAD_INV_ORDER; import org.omg.CORBA.LocalObject; +import org.omg.PortableInterceptor.NON_EXISTENT; +import org.omg.PortableInterceptor.ObjectReferenceTemplate; import org.omg.PortableServer.POAManager; import org.omg.PortableServer.POAManagerPackage.AdapterInactive; import org.omg.PortableServer.POAManagerPackage.State; @@ -59,18 +61,22 @@ public class gnuPOAManager extends LocalObject implements POAManager { + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1; + /** - * The POAs, controlled by this manager. The members must be instances of - * the gnuAbstractPOA. + * The POAs, controlled by this manager. */ - HashSet POAs = new HashSet(); + private HashSet POAs = new HashSet(); /** * The state of the manager. The newly created manager is always * in the holding state. */ State state = State.HOLDING; - + /** * Get the state of the POA manager. */ @@ -94,6 +100,8 @@ public class gnuPOAManager state = State.ACTIVE; else throw new AdapterInactive(); + + notifyInterceptors(state.value()); } /** @@ -113,6 +121,9 @@ public class gnuPOAManager state = State.HOLDING; else throw new AdapterInactive(); + + notifyInterceptors(state.value()); + if (wait_for_completion) waitForIdle(); } @@ -144,6 +155,9 @@ public class gnuPOAManager if (state == State.INACTIVE) throw new AdapterInactive("Repetetive inactivation"); state = State.INACTIVE; + + notifyInterceptors(state.value()); + if (wait_for_completion) waitForIdle(); @@ -178,6 +192,9 @@ public class gnuPOAManager state = State.DISCARDING; else throw new AdapterInactive(); + + notifyInterceptors(state.value()); + if (wait_for_completion) waitForIdle(); } @@ -193,11 +210,13 @@ public class gnuPOAManager { if (state == State.ACTIVE) throw new BAD_INV_ORDER("The state is active"); - + + gnuPOA poa; Iterator iter = POAs.iterator(); + while (iter.hasNext()) { - gnuPOA poa = (gnuPOA) iter.next(); + poa = (gnuPOA) iter.next(); poa.waitWhileRunning(); } } @@ -222,4 +241,33 @@ public class gnuPOAManager { POAs.remove(poa); } + + /** + * This method is called when POA is destryed. The interceptors are + * notified. + */ + public void poaDestroyed(gnuPOA poa) + { + notifyInterceptors(NON_EXISTENT.value); + } + + /** + * Notify CORBA 3.0 interceptors about the status change. + */ + public synchronized void notifyInterceptors(int new_state) + { + gnuPOA poa; + Iterator iter = POAs.iterator(); + + // The System.identityHashCode is also called in gnuIorInfo. + while (iter.hasNext()) + { + poa = (gnuPOA) iter.next(); + if (poa.m_orb.iIor != null) + { + poa.m_orb.iIor.adapter_manager_state_changed( + System.identityHashCode(this), (short) new_state); + } + } + } }
\ No newline at end of file |