geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server JmxProgressObject.java
Date Mon, 24 Nov 2003 14:23:08 GMT
ammulder    2003/11/24 06:23:08

  Modified:    modules/core/src/java/org/apache/geronimo/enterprise/deploy/server
                        JmxProgressObject.java
  Log:
  Change to make notification listener remove properly
   - add equals and hashCode to filter
   - call remove method that accepts a filter as one of the args
  
  Revision  Changes    Path
  1.4       +21 -3     incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxProgressObject.java
  
  Index: JmxProgressObject.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxProgressObject.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JmxProgressObject.java	22 Nov 2003 20:08:54 -0000	1.3
  +++ JmxProgressObject.java	24 Nov 2003 14:23:08 -0000	1.4
  @@ -101,6 +101,7 @@
       private JobDeploymentStatus status;
       private EventListenerList listenerList = new EventListenerList();
       private NotificationListener listener;
  +    private NotificationFilter filter;
   
       public JmxProgressObject(int jobID, MBeanServer server, CommandType command) {
           status = new JobDeploymentStatus(command);
  @@ -108,7 +109,7 @@
           this.server = server;
           try {
               server.addNotificationListener(CONTROLLER, listener = new PONotificationListener(),
  -                    new PONotificationFilter(jobID),null);
  +                    filter = new PONotificationFilter(jobID),null);
               server.invoke(CONTROLLER, "startDeploymentJob", new Object[]{new Integer(jobID)},
new String[]{Integer.TYPE.toString()});
           } catch(InstanceNotFoundException e) {
               throw new RuntimeException("ProgressObject unable to register with server");
  @@ -470,13 +471,15 @@
                   }
                   if(status.isCompleted() || status.isFailed()) {
                       try {
  -                        server.removeNotificationListener(CONTROLLER, listener);
  +                        server.removeNotificationListener(CONTROLLER, listener, filter,
null);
                       } catch(InstanceNotFoundException e) {
                           log.error("Unable to remove notification listener", e);
                       } catch(ListenerNotFoundException e) {
                           log.error("Unable to remove notification listener", e);
                       }
                   }
  +            } else {
  +                log.error("Got a notification for "+dn.getDeploymentID()+", expecting "+jobID);
               }
           }
       }
  @@ -502,6 +505,21 @@
                   result = ((DeploymentNotification)notification).getDeploymentID() == jobID;
               }
               return result;
  +        }
  +
  +        public boolean equals(Object o) {
  +            if(this == o) return true;
  +            if(!(o instanceof PONotificationFilter)) return false;
  +
  +            final PONotificationFilter poNotificationFilter = (PONotificationFilter)o;
  +
  +            if(jobID != poNotificationFilter.jobID) return false;
  +
  +            return true;
  +        }
  +
  +        public int hashCode() {
  +            return jobID;
           }
       }
   }
  
  
  

Mime
View raw message