User: andreas
Date: 00/09/10 20:22:03
Modified: src/main/org/jboss/jmx/client RMIClientConnectorImpl.java
Log:
Fixed a problem with concurrent access to a list through
different iterators when the JMX Connector client is
shut down.
Revision Changes Path
1.2 +38 -24 jboss/src/main/org/jboss/jmx/client/RMIClientConnectorImpl.java
Index: RMIClientConnectorImpl.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/jmx/client/RMIClientConnectorImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RMIClientConnectorImpl.java 2000/08/31 17:42:59 1.1
+++ RMIClientConnectorImpl.java 2000/09/11 03:22:03 1.2
@@ -112,11 +112,18 @@
System.out.println( "RMIClientConnectorImpl.stop(),
remove listener: " +
lRemoteListener
);
- removeNotificationListener(
- lRemoteListener.getObjectName(),
- lRemoteListener.getLocalListener()
- );
- i.remove();
+ try {
+ mRemoteConnector.removeNotificationListener(
+ lRemoteListener.getObjectName(),
+ lRemoteListener
+ );
+ }
+ catch( RemoteException re ) {
+ re.printStackTrace();
+ }
+ finally {
+ i.remove();
+ }
}
catch( Exception e ) {
e.printStackTrace();
@@ -527,26 +534,31 @@
ListenerNotFoundException
{
// Lookup if the given listener is registered
- int lIndex = mListeners.indexOf(
- new Listener(
- pListener,
- null,
- pName
- )
- );
- // If found then get the remote listener and remove it from the
- // the Connector
- if( lIndex >= 0 ) {
- try {
- Listener lRemoteListener = (Listener)
mListeners.elementAt( lIndex );
- mRemoteConnector.removeNotificationListener(
- pName,
- lRemoteListener
- );
- mListeners.removeElementAt( lIndex );
+ Iterator i = mListeners.iterator();
+ while( i.hasNext() ) {
+ Listener lListener = (Listener) i.next();
+ if(
+ new Listener(
+ pListener,
+ null,
+ pName
+ ).equals( lListener )
+ ) {
+ // If found then get the remote listener and remove it
from the
+ // the Connector
+ try {
+ mRemoteConnector.removeNotificationListener(
+ pName,
+ lListener
+ );
+ }
+ catch( RemoteException re ) {
+ re.printStackTrace();
+ }
+ finally {
+ i.remove();
+ }
}
- catch( RemoteException re ) {
- }
}
}
@@ -621,6 +633,8 @@
}
// Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
/**
* Listener wrapper around the remote RMI Notification Listener
- [jBoss-Dev] CVS update: jboss/src/main/org/jboss/jmx... jBoss CVS Development
- [jBoss-Dev] CVS update: jboss/src/main/org/jbos... jBoss CVS Development
- RE: [jBoss-Dev] CVS update:jboss/src/main/o... marc fleury
- [jBoss-Dev] CVS update: jboss/src/main/org/jbos... jBoss CVS Development
