tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject svn commit: r532877 - in /tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport: PooledSender.java bio/PooledMultiSender.java nio/PooledParallelSender.java
Date Thu, 26 Apr 2007 21:41:48 GMT
Author: pero
Date: Thu Apr 26 14:41:47 2007
New Revision: 532877

URL: http://svn.apache.org/viewvc?view=rev&rev=532877
Log:
Remove senders as member disappeared..

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/PooledSender.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/PooledMultiSender.java
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/PooledSender.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/PooledSender.java?view=diff&rev=532877&r1=532876&r2=532877
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/PooledSender.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/PooledSender.java Thu Apr
26 14:41:47 2007
@@ -19,6 +19,8 @@
 import java.io.IOException;
 import java.util.List;
 
+import org.apache.catalina.tribes.Member;
+
 /**
  * <p>Title: </p>
  *
@@ -83,7 +85,13 @@
         return (queue==null)?false:queue.checkIdleKeepAlive();
     }
 
+    public void add(Member member) {
+        // we don't need it senders are pooled...
+    }
     
+    public void remove(Member member) {
+        queue.remove(member) ;
+    }     
 
     //  ----------------------------------------------------- Inner Class
 
@@ -92,17 +100,17 @@
 
         PooledSender parent = null;
 
-        private List notinuse = null;
+        private List<DataSender> notinuse = null;
 
-        private List inuse = null;
+        private List<DataSender> inuse = null;
 
         private boolean isOpen = true;
 
         public SenderQueue(PooledSender parent, int limit) {
             this.limit = limit;
             this.parent = parent;
-            notinuse = new java.util.LinkedList();
-            inuse = new java.util.LinkedList();
+            notinuse = new java.util.LinkedList<DataSender>();
+            inuse = new java.util.LinkedList<DataSender>();
         }
 
         /**
@@ -141,6 +149,18 @@
             return result;
         }
 
+        // FIXME: remove also inuse senders. but then we must synch with sendMessage!
+        public synchronized void remove(Member member) {
+            if (isOpen) {
+                DataSender[] list = new DataSender[notinuse.size()];
+                notinuse.toArray(list);
+                for (int i=0; i<list.length; i++) {
+                    if(list[i] instanceof MultiPointSender)
+                        ((MultiPointSender)list[i]).remove(member);
+                }
+            }
+        }
+        
         public synchronized DataSender getSender(long timeout) {
             long start = System.currentTimeMillis();
             while ( true ) {
@@ -193,9 +213,6 @@
             notinuse.clear();
             inuse.clear();
             notify();
-            
-
-
         }
 
         public synchronized void open() {

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/PooledMultiSender.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/PooledMultiSender.java?view=diff&rev=532877&r1=532876&r2=532877
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/PooledMultiSender.java
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/bio/PooledMultiSender.java
Thu Apr 26 14:41:47 2007
@@ -69,13 +69,4 @@
         return sender;
     }
 
-
-    public void add(Member member) {
-
-    }
-
-    public void remove(Member member) {
-        //disconnect senders
-    } 
-
 }

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java?view=diff&rev=532877&r1=532876&r2=532877
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/tribes/transport/nio/PooledParallelSender.java
Thu Apr 26 14:41:47 2007
@@ -72,12 +72,5 @@
         this.connected = true;
         super.connect();
     }
-
-    public void add(Member member) {
-    
-    }
-    
-    public void remove(Member member) {
-        //disconnect senders
-    }    
+   
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message