Author: mes
Date: 2011-03-10 14:02:13 -0800 (Thu, 10 Mar 2011)
New Revision: 24397

Modified:
   core3/event-impl/trunk/impl/pom.xml
   
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyMicroListenerAdapter.java
   
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/ServiceComparator.java
   core3/event-impl/trunk/it/pom.xml
Log:
applied Aurelien's patch to fix problem with adding and removing multiple 
microlisteners and got things working with maven 3

Modified: core3/event-impl/trunk/impl/pom.xml
===================================================================
--- core3/event-impl/trunk/impl/pom.xml 2011-03-10 22:01:15 UTC (rev 24396)
+++ core3/event-impl/trunk/impl/pom.xml 2011-03-10 22:02:13 UTC (rev 24397)
@@ -25,6 +25,7 @@
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-plugin</artifactId>
+                               
<version>${maven-surefire-plugin.version}</version>
                                <configuration>
                                        
<redirectTestOutputToFile>true</redirectTestOutputToFile>
                                </configuration>
@@ -32,7 +33,7 @@
                        <plugin>
                                <groupId>org.ops4j</groupId>
                                <artifactId>maven-pax-plugin</artifactId>
-                               <version>1.4</version>
+                               <version>${maven-pax-plugin.version}</version>
                                <extensions>true</extensions>
                        </plugin>
                        <plugin>
@@ -42,7 +43,7 @@
                                <configuration>
                                        <instructions>
                                                
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
-                                               
<Bundle-Version>${pom.version}</Bundle-Version>
+                                               
<Bundle-Version>${project.version}</Bundle-Version>
                                                <_include>-osgi.bnd</_include>
                                        </instructions>
                                </configuration>

Modified: 
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyMicroListenerAdapter.java
===================================================================
--- 
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyMicroListenerAdapter.java
  2011-03-10 22:01:15 UTC (rev 24396)
+++ 
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/CyMicroListenerAdapter.java
  2011-03-10 22:02:13 UTC (rev 24397)
@@ -133,25 +133,26 @@
                        SortedSet<Object> classListeners = 
sourceListeners.get(clazz);
                        if ( classListeners != null ) {
                                classListeners.remove(service);
-                               if ( classListeners.size() == 0 )
+                               if ( classListeners.size() == 0 ) {
                                        sourceListeners.remove( clazz );
-                       }
-                                       
-                       // this gets rid of the reference to the source object, 
which should
-                       // help with garbage collection
-                       if ( sourceListeners.size() == 0 )
-                               listeners.remove(source);
-               }
 
-               // clean up the proxys
-               Map<Class<?>,Object> sourceProxys = proxys.get(source);
-               if ( sourceProxys != null ) {
-                       sourceProxys.remove(clazz);
+                                       // this gets rid of the reference to 
the source object, which should
+                                       // help with garbage collection
+                                       if ( sourceListeners.size() == 0 )
+                                               listeners.remove(source);
 
-                       // this gets rid of the reference to the source object, 
which should
-                       // help with garbage collection
-                       if ( sourceProxys.size() == 0 )
-                               proxys.remove(source);
+                                       // clean up the proxys
+                                       Map<Class<?>,Object> sourceProxys = 
proxys.get(source);
+                                       if ( sourceProxys != null ) {
+                                               sourceProxys.remove(clazz);
+
+                                               // this gets rid of the 
reference to the source object, which should
+                                               // help with garbage collection
+                                               if ( sourceProxys.size() == 0 )
+                                                       proxys.remove(source);
+                                       }
+                       }
+                       }
                }
        }
 

Modified: 
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/ServiceComparator.java
===================================================================
--- 
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/ServiceComparator.java
       2011-03-10 22:01:15 UTC (rev 24396)
+++ 
core3/event-impl/trunk/impl/src/main/java/org/cytoscape/event/internal/ServiceComparator.java
       2011-03-10 22:02:13 UTC (rev 24397)
@@ -42,8 +42,16 @@
  */
 class ServiceComparator implements Comparator<Object> {
        public int compare(Object a, Object b) {
-               final int aId = a.getClass().getName().hashCode();
-               final int bId = b.getClass().getName().hashCode(); 
+               final Class<?> aCl = a.getClass();
+               final Class<?> bCl = b.getClass();
+               final int aId, bId;
+               if (aCl == bCl) {
+                       aId = a.hashCode();
+                       bId = b.hashCode();
+               } else {
+                       aId = aCl.getName().hashCode();
+                       bId = bCl.getName().hashCode();
+               }
                if ( aId < bId ) 
                        return -1;
                else if ( aId > bId )

Modified: core3/event-impl/trunk/it/pom.xml
===================================================================
--- core3/event-impl/trunk/it/pom.xml   2011-03-10 22:01:15 UTC (rev 24396)
+++ core3/event-impl/trunk/it/pom.xml   2011-03-10 22:02:13 UTC (rev 24397)
@@ -25,6 +25,7 @@
                        <plugin>
                                <groupId>org.ops4j.pax.exam</groupId>
                                <artifactId>maven-paxexam-plugin</artifactId>
+                               
<version>${maven-paxexam-plugin.version}</version>
                                <executions>
                                        <execution>
                                                <id>generate-config</id>
@@ -43,6 +44,7 @@
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-surefire-plugin</artifactId>
+                               
<version>${maven-surefire-plugin.version}</version>
                                <configuration>
                                        
<redirectTestOutputToFile>true</redirectTestOutputToFile>
                                </configuration>
@@ -58,7 +60,7 @@
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>event-impl</artifactId>
-                       <version>${version}</version>
+                       <version>${project.version}</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to