tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r380864 - in /tomcat/container/tc5.5.x/modules: groupcom/src/share/org/apache/catalina/cluster/ groupcom/src/share/org/apache/catalina/cluster/demos/ groupcom/src/share/org/apache/catalina/cluster/group/ groupcom/src/share/org/apache/catali...
Date Fri, 24 Feb 2006 23:33:13 GMT
Author: fhanik
Date: Fri Feb 24 15:33:10 2006
New Revision: 380864

URL: http://svn.apache.org/viewcvs?rev=380864&view=rev
Log:
Major refactoring going on

Added:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/InterceptorPayload.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/GzipInterceptor.java
Removed:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ClusterData.java
Modified:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ChannelInterceptor.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterChannel.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterMessage.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/MessageListener.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/demos/Draw.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelCoordinator.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelInterceptorBase.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/GroupChannel.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/FragmentationInterceptor.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ListenCallback.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ObjectReader.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/SocketObjectReader.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/XByteBuffer.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastMember.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastService.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastServiceImpl.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/DataSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/IDataSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/PooledSocketSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java
    tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java
    tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FileMessage.java
    tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/UndeployMessage.java
    tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/ClusterSessionListener.java
    tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/DeltaManager.java
    tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/JvmRouteSessionIDBinderListener.java
    tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionIDMessage.java
    tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionMessageImpl.java
    tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ChannelInterceptor.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ChannelInterceptor.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ChannelInterceptor.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ChannelInterceptor.java Fri Feb 24 15:33:10 2006
@@ -20,6 +20,7 @@
 import org.apache.catalina.cluster.MembershipListener;
 import org.apache.catalina.cluster.MessageListener;
 import java.io.IOException;
+import org.apache.catalina.cluster.io.ClusterData;
 
 /**
  * Abstract class for the interceptor base class.
@@ -27,7 +28,7 @@
  * @version $Revision: 304032 $, $Date: 2005-07-27 10:11:55 -0500 (Wed, 27 Jul 2005) $
  */
 
-public interface ChannelInterceptor extends MembershipListener, MessageListener {
+public interface ChannelInterceptor extends MembershipListener {
 
     public void setNext(ChannelInterceptor next) ;
 
@@ -37,7 +38,9 @@
 
     public ChannelInterceptor getPrevious();
 
-    public ClusterMessage[] sendMessage(Member[] destination, ClusterMessage msg, int options) throws IOException;
+    public ClusterMessage[] sendMessage(Member[] destination, ClusterData msg, InterceptorPayload payload) throws IOException;
+    
+    public void messageReceived(ClusterData data);
     
     public void heartbeat();
 }

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterChannel.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterChannel.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterChannel.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterChannel.java Fri Feb 24 15:33:10 2006
@@ -79,4 +79,12 @@
     public void setClusterReceiver(ClusterReceiver receiver);
     public void setMembershipService(MembershipService service);
     
+    /**
+     * Sends a heart beat through the interceptor stacks
+     */
+    public void heartbeat();
+    
+    public void setMembershipListener(MembershipListener listener);
+    public void setMessageListener(MessageListener listener);
+    
 }

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterMessage.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterMessage.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterMessage.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterMessage.java Fri Feb 24 15:33:10 2006
@@ -24,9 +24,9 @@
  */
 public interface ClusterMessage extends Serializable {
     
-    public final static int FLAG_FORBIDDEN = 0 ;
-    public final static int FLAG_ALLOWED = 1 ;
-    public final static int FLAG_DEFAULT = 2 ;
+    public final static int RESEND_FORBIDDEN = 0 ;
+    public final static int RESEND_ALLOWED = 1 ;
+    public final static int RESEND_DEFAULT = 2 ;
     
     /**
      * Get the address that this message originated from.  This would be set
@@ -66,35 +66,6 @@
      */
     public String getUniqueId();
 
-    /**
-     * Each message can made the desicion that resend is allowed or not or handle by default.
-     * @return 0 Forbidden, 1 allowed, 2 default
-     * @since 5.5.10
-     */
-    public int getResend();
     
-    /**
-     * set desicion that resend is allowed or not or handle by default.
-     *
-     * @param resend 0 Forbidden, 1 allowed, 2 default
-     * @since 5.5.10
-     */
-    public void setResend(int resend) ;
-
-    /**
-     * Each message can made the desicion that compress is allowed or not or handle by default.
-     *
-     * @return 0 Forbidden, 1 allowed, 2 default
-     * @since 5.5.10
-     */
-    public int getCompress();
-    
-    /**
-     * set desicion that compress is allowed or not or handle by default.
-     *
-     * @param compress 0 Forbidden, 1 allowed, 2 default
-     * @since 5.5.10
-     */
-    public void setCompress(int compress) ;
 
 }

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterSender.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterSender.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/ClusterSender.java Fri Feb 24 15:33:10 2006
@@ -16,6 +16,8 @@
 
 package org.apache.catalina.cluster;
 
+import org.apache.catalina.cluster.io.ClusterData;
+
 /**
  * 
  * @author Filip Hanik
@@ -35,11 +37,11 @@
 
     public void heartbeat() ;
 
-    public void sendMessage(ClusterMessage message, Member member) throws java.io.IOException;
+    public void sendMessage(ClusterData message, Member member) throws java.io.IOException;
 
-    public void sendMessage(ClusterMessage message) throws java.io.IOException;
+    public void sendMessage(ClusterData message) throws java.io.IOException;
     
-    public void sendMessageClusterDomain(ClusterMessage message) throws java.io.IOException;
+    public void sendMessageClusterDomain(ClusterData message) throws java.io.IOException;
 
     public boolean isWaitForAck();
     public void setWaitForAck(boolean isWaitForAck);

Added: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/InterceptorPayload.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/InterceptorPayload.java?rev=380864&view=auto
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/InterceptorPayload.java (added)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/InterceptorPayload.java Fri Feb 24 15:33:10 2006
@@ -0,0 +1,33 @@
+/*
+ * Copyright 1999,2004-2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.catalina.cluster;
+
+/**
+ * <p>Title: </p>
+ *
+ * <p>Description: </p>
+ *
+ * <p>Copyright: Copyright (c) 2005</p>
+ *
+ * <p>Company: </p>
+ *
+ * @author Filip Hanik
+ * @version 1.0
+ */
+public class InterceptorPayload {
+    public InterceptorPayload() {
+    }
+}
\ No newline at end of file

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/MessageListener.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/MessageListener.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/MessageListener.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/MessageListener.java Fri Feb 24 15:33:10 2006
@@ -15,11 +15,20 @@
  */
 package org.apache.catalina.cluster;
 
+import org.apache.catalina.cluster.io.ClusterData;
+
 public interface MessageListener {
     
-    public void messageReceived(ClusterMessage msg);
+    /**
+     * Receive a message from the cluster.
+     * @param msg ClusterMessage
+     * @return ClusterMessage - response to the message sent. <br>
+     * The response object may be ignored and is not required for the 
+     * implementation to send back to the sender.
+     */
+    public void messageReceived(ClusterData msg);
     
-    public boolean accept(ClusterMessage msg);
+    public boolean accept(ClusterData msg);
     
     public boolean equals(Object listener);
     

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/demos/Draw.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/demos/Draw.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/demos/Draw.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/demos/Draw.java Fri Feb 24 15:33:10 2006
@@ -29,6 +29,7 @@
 import org.apache.catalina.cluster.tcp.ReplicationListener;
 import org.apache.catalina.cluster.tcp.ReplicationTransmitter;
 import org.apache.commons.logging.impl.LogFactoryImpl;
+import org.apache.catalina.cluster.ClusterChannel;
 /**
  * Shared whiteboard, each new instance joins the same group. Each instance chooses a random color,
  * mouse moves are broadcast to all group members, which then apply them to their canvas<p>
@@ -40,7 +41,7 @@
     
     private final ByteArrayOutputStream out = new ByteArrayOutputStream();
     String groupname = "DrawGroupDemo";
-    private GroupChannel channel = null;
+    private ClusterChannel channel = null;
     private int member_size = 1;
     final boolean first = true;
     final boolean cummulative = true;
@@ -208,9 +209,9 @@
         if (title != null) {
             mainFrame.setTitle(title);
         } else {
-            if (channel.getMembershipService().getLocalMember() != null)
-                tmp += channel.getMembershipService().getLocalMember().getName();
-            tmp += " (" + channel.getMembershipService().getMembers().length + ")";
+            if (((GroupChannel)channel).getMembershipService().getLocalMember() != null)
+                tmp += ((GroupChannel)channel).getMembershipService().getLocalMember().getName();
+            tmp += " (" + ((GroupChannel)channel).getMembershipService().getMembers().length + ")";
             mainFrame.setTitle(tmp);
         }
     }
@@ -232,9 +233,9 @@
     
     public DrawMessage getEmptyMessage() {
         DrawMessage msg = new DrawMessage();
-        msg.setAddress(channel.getMembershipService().getLocalMember());
+        msg.setAddress(((GroupChannel)channel).getMembershipService().getLocalMember());
         msg.setTimestamp(System.currentTimeMillis());
-        msg.setCompress(0);
+        msg.setOptions(0);
         return msg;
     }
 
@@ -313,6 +314,7 @@
         } else {
             System.out.println("Invalid message="+msg);
         }
+        return;
     }
     
     
@@ -321,7 +323,7 @@
         private long timestamp;
         private String id;
         private int resend;
-        private int compress;
+        private int options;
         private DrawCommand comm;
         public Member getAddress() { return address;}
         public void setAddress(Member member) { address = member;}
@@ -330,8 +332,8 @@
         public String getUniqueId() {return id;}
         public int getResend() { return resend;}
         public void setResend(int resend) {this.resend = resend;}
-        public int getCompress() {return compress;}
-        public void setCompress(int compress) {this.compress = compress;}
+        public int getOptions() {return options;}
+        public void setOptions(int options) {this.options = options;}
         public DrawCommand getDrawCommand(){return comm;}
         public void setDrawCommand(DrawCommand command) {this.comm = command;}
 

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelCoordinator.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelCoordinator.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelCoordinator.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelCoordinator.java Fri Feb 24 15:33:10 2006
@@ -23,6 +23,9 @@
 import org.apache.catalina.cluster.ClusterReceiver;
 import org.apache.catalina.cluster.ClusterChannel;
 import java.io.IOException;
+import org.apache.catalina.cluster.InterceptorPayload;
+import org.apache.catalina.cluster.io.ClusterData;
+import org.apache.catalina.cluster.MessageListener;
 
 
 /**
@@ -32,7 +35,7 @@
  * @author Filip Hanik
  * @version $Revision: 304032 $, $Date: 2005-07-27 10:11:55 -0500 (Wed, 27 Jul 2005) $
  */
-public class ChannelCoordinator extends ChannelInterceptorBase {
+public class ChannelCoordinator extends ChannelInterceptorBase implements MessageListener {
     private ClusterReceiver clusterReceiver;
     private ClusterSender clusterSender;
     private MembershipService membershipService;
@@ -57,7 +60,7 @@
      * @param options int - sender options, see class documentation
      * @return ClusterMessage[] - the replies from the members, if any.
      */
-    public ClusterMessage[] sendMessage(Member[] destination, ClusterMessage msg, int options) throws IOException {
+    public ClusterMessage[] sendMessage(Member[] destination, ClusterData msg, InterceptorPayload payload) throws IOException {
         if ( destination == null ) destination = membershipService.getMembers();
         for ( int i=0; i<destination.length; i++ ) {
             clusterSender.sendMessage(msg,destination[i]);
@@ -127,6 +130,10 @@
     public void memberDisappeared(Member member){
         if ( clusterSender!=null ) clusterSender.remove(member);
         super.memberDisappeared(member);
+    }
+    
+    public void messageReceived(ClusterMessage msg) {
+        if ( msg instanceof ClusterData ) this.messageReceived((ClusterData)msg);
     }
 
 

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelInterceptorBase.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelInterceptorBase.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelInterceptorBase.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/ChannelInterceptorBase.java Fri Feb 24 15:33:10 2006
@@ -21,6 +21,8 @@
 import org.apache.catalina.cluster.MessageListener;
 import java.io.IOException;
 import org.apache.catalina.cluster.ChannelInterceptor;
+import org.apache.catalina.cluster.InterceptorPayload;
+import org.apache.catalina.cluster.io.ClusterData;
 
 /**
  * Abstract class for the interceptor base class.
@@ -30,6 +32,8 @@
 
 public abstract class ChannelInterceptorBase implements ChannelInterceptor{
     
+    protected static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(ChannelInterceptorBase.class);
+    
     private ChannelInterceptor next;
     private ChannelInterceptor previous;
     
@@ -53,11 +57,11 @@
         return previous;
     }
 
-    public ClusterMessage[] sendMessage(Member[] destination, ClusterMessage msg, int options) throws IOException {
-        return getNext().sendMessage(destination, msg,options);
+    public ClusterMessage[] sendMessage(Member[] destination, ClusterData msg, InterceptorPayload payload) throws IOException {
+        return getNext().sendMessage(destination, msg,payload);
     }
     
-    public void messageReceived(ClusterMessage msg) {
+    public void messageReceived(ClusterData msg) {
         getPrevious().messageReceived(msg);
     }
 

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/GroupChannel.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/GroupChannel.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/GroupChannel.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/GroupChannel.java Fri Feb 24 15:33:10 2006
@@ -17,14 +17,17 @@
 
 
 import org.apache.catalina.cluster.ChannelException;
+import org.apache.catalina.cluster.ChannelInterceptor;
 import org.apache.catalina.cluster.ClusterChannel;
+import org.apache.catalina.cluster.ClusterMessage;
 import org.apache.catalina.cluster.ClusterReceiver;
 import org.apache.catalina.cluster.ClusterSender;
-import org.apache.catalina.cluster.MembershipService;
-import org.apache.catalina.cluster.ClusterMessage;
 import org.apache.catalina.cluster.Member;
-import org.apache.catalina.cluster.ChannelInterceptor;
-
+import org.apache.catalina.cluster.MembershipListener;
+import org.apache.catalina.cluster.MembershipService;
+import org.apache.catalina.cluster.MessageListener;
+import org.apache.catalina.cluster.io.ClusterData;
+import org.apache.catalina.cluster.io.XByteBuffer;
 
 /**
  * The GroupChannel manages the replication channel. It coordinates
@@ -34,11 +37,14 @@
  * @author Filip Hanik
  * @version $Revision: 304032 $, $Date: 2005-07-27 10:11:55 -0500 (Wed, 27 Jul 2005) $
  */
-public class GroupChannel implements ClusterChannel {
+public class GroupChannel extends ChannelInterceptorBase implements ClusterChannel {
     private ChannelCoordinator coordinator = new ChannelCoordinator();
     private ChannelInterceptor interceptors = null;
+    private MembershipListener membershipListener;
+    private MessageListener messageListener;
 
     public GroupChannel() {
+        addInterceptor(this);
     }
     
     
@@ -50,7 +56,7 @@
         if ( interceptors == null ) {
             this.interceptors = interceptor;
             this.interceptors.setNext(coordinator);
-            coordinator.setPrevious(this.interceptors);
+            this.interceptors.setPrevious(null);
         } else {
             ChannelInterceptor last = interceptors;
             while ( last.getNext() != coordinator ) {
@@ -64,7 +70,7 @@
     }
     
     public void heartbeat() {
-        getFirstInterceptor().heartbeat();
+        super.heartbeat();
     }
     
     /**
@@ -77,16 +83,39 @@
     public ClusterMessage[] send(Member[] destination, ClusterMessage msg, int options) throws ChannelException {
         if ( msg == null ) return null;
         msg.setAddress(getMembershipService().getLocalMember());
-        msg.setCompress(msg.FLAG_ALLOWED);
         msg.setTimestamp(System.currentTimeMillis());
-        msg.setResend(msg.FLAG_FORBIDDEN);
         try {
-            return getFirstInterceptor().sendMessage(destination, msg, options);
+            ClusterData data = XByteBuffer.serialize(msg, options,false);
+            return getFirstInterceptor().sendMessage(destination, data, null);
         }catch ( Exception x ) {
             throw new ChannelException(x);
         }
     }
     
+    public void messageReceived(ClusterMessage msg) {
+        if ( msg == null ) return;
+        else if ( msg instanceof ClusterData ) {
+            try {
+                ClusterMessage fwd = XByteBuffer.deserialize( (ClusterData) msg, false);
+                if ( messageListener != null ) messageListener.messageReceived(fwd);
+            }catch ( Exception x ) {
+                log.error("Unable to deserialize channel message.",x);
+            }
+        } else {
+            log.error("Recieved a message that is not a ClusterData instance. class="+msg.getClass().getName()+ " obj="+msg);
+        }
+    }
+    
+    public void memberAdded(Member member) {
+        //notify upwards
+        if (membershipListener != null) membershipListener.memberAdded(member);
+    }
+    
+    public void memberDisappeared(Member member) {
+        //notify upwards
+        if (membershipListener != null) membershipListener.memberDisappeared(member);
+    }    
+    
     public ChannelInterceptor getFirstInterceptor() {
         if (interceptors != null) return interceptors;
         else return coordinator;
@@ -144,6 +173,22 @@
 
     public void setMembershipService(MembershipService membershipService) {
         coordinator.setMembershipService(membershipService);
+    }
+
+    public void setMembershipListener(MembershipListener membershipListener) {
+        this.membershipListener = membershipListener;
+    }
+
+    public void setMessageListener(MessageListener messageListener) {
+        this.messageListener = messageListener;
+    }
+
+    public MembershipListener getMembershipListener() {
+        return membershipListener;
+    }
+
+    public MessageListener getMessageListener() {
+        return messageListener;
     }
 
 }

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/FragmentationInterceptor.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/FragmentationInterceptor.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/FragmentationInterceptor.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/FragmentationInterceptor.java Fri Feb 24 15:33:10 2006
@@ -18,13 +18,7 @@
 import org.apache.catalina.cluster.group.ChannelInterceptorBase;
 
 /**
- * <p>Title: </p>
  *
- * <p>Description: </p>
- *
- * <p>Copyright: Copyright (c) 2005</p>
- *
- * <p>Company: </p>
  *
  * @author Filip Hanik
  * @version 1.0

Added: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/GzipInterceptor.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/GzipInterceptor.java?rev=380864&view=auto
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/GzipInterceptor.java (added)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/group/interceptors/GzipInterceptor.java Fri Feb 24 15:33:10 2006
@@ -0,0 +1,78 @@
+/*
+ * Copyright 1999,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ */
+
+package org.apache.catalina.cluster.group.interceptors;
+
+import org.apache.catalina.cluster.group.ChannelInterceptorBase;
+import org.apache.catalina.cluster.InterceptorPayload;
+import org.apache.catalina.cluster.Member;
+import java.io.IOException;
+import org.apache.catalina.cluster.ClusterMessage;
+import org.apache.catalina.cluster.io.ClusterData;
+import java.io.ByteArrayOutputStream;
+import java.io.ByteArrayInputStream;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+
+
+/**
+ *
+ *
+ * @author Filip Hanik
+ * @version 1.0
+ */
+public class GzipInterceptor extends ChannelInterceptorBase {
+   
+    public ClusterMessage[] sendMessage(Member[] destination, ClusterData msg, InterceptorPayload payload) throws IOException {
+        try {
+            msg.setMessage(compress(msg.getMessage()));
+            return getNext().sendMessage(destination, msg, payload);
+        } catch ( IOException x ) {
+            log.error("Unable to compress byte contents");
+            throw x;
+        }
+    }
+
+    public void messageReceived(ClusterData msg) {
+        try {
+            msg.setMessage(decompress(msg.getMessage()));
+            getPrevious().messageReceived(msg);
+        } catch ( IOException x ) {
+            log.error("Unable to decompress byte contents");
+        }
+
+    }
+    
+    public byte[] compress(byte[] data) throws IOException {
+        ByteArrayOutputStream bout = new ByteArrayOutputStream();
+        GZIPOutputStream gout = new GZIPOutputStream(bout);
+        gout.write(data);
+        gout.flush();
+        gout.close();
+        return bout.toByteArray();
+    }
+    
+    public byte[] decompress(byte[] data) throws IOException {
+        ByteArrayInputStream bin = new ByteArrayInputStream(data);
+        GZIPInputStream gin = new GZIPInputStream(bin);
+        byte[] tmp = new byte[data.length];
+        int length = gin.read(tmp);
+        byte[] result = new byte[length];
+        System.arraycopy(tmp,0,result,0,length);
+        return result;
+    }
+    
+}

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ListenCallback.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ListenCallback.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ListenCallback.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ListenCallback.java Fri Feb 24 15:33:10 2006
@@ -16,7 +16,7 @@
 
 package org.apache.catalina.cluster.io;
 
-import org.apache.catalina.cluster.tcp.ClusterData ;
+
 
 /**
  * The listen callback interface is used by the replication system

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ObjectReader.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ObjectReader.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ObjectReader.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/ObjectReader.java Fri Feb 24 15:33:10 2006
@@ -19,7 +19,7 @@
 import java.nio.channels.Selector;
 import java.nio.channels.SocketChannel;
 
-import org.apache.catalina.cluster.tcp.ClusterData;
+
 
 /**
  * The object reader object is an object used in conjunction with

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/SocketObjectReader.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/SocketObjectReader.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/SocketObjectReader.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/SocketObjectReader.java Fri Feb 24 15:33:10 2006
@@ -19,7 +19,7 @@
 
 import java.net.Socket;
 
-import org.apache.catalina.cluster.tcp.ClusterData;
+
 
 /**
  * The object reader object is an object used in conjunction with

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/XByteBuffer.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/XByteBuffer.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/XByteBuffer.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/io/XByteBuffer.java Fri Feb 24 15:33:10 2006
@@ -17,7 +17,7 @@
 package org.apache.catalina.cluster.io;
 
 import org.apache.catalina.cluster.ClusterMessage;
-import org.apache.catalina.cluster.tcp.ClusterData;
+
 import java.io.ObjectOutputStream;
 import java.util.zip.GZIPOutputStream;
 import java.io.ByteArrayOutputStream;
@@ -204,13 +204,13 @@
             throws java.io.IOException {
         int psize = countPackages();
         if (psize == 0) throw new java.lang.IllegalStateException("No package exists in XByteBuffer");
-        int compress = toInt(buf, START_DATA.length);
+        int options = toInt(buf, START_DATA.length);
         int size = toInt(buf, START_DATA.length +4);
         byte[] data = new byte[size];
         System.arraycopy(buf, START_DATA.length + 8, data, 0, size);
         ClusterData cdata = new ClusterData() ;
         cdata.setMessage(data);
-        cdata.setCompress(compress);
+        cdata.setOptions(options);
         if (clearFromBuffer) {
             int totalsize = START_DATA.length + 8 + size + END_DATA.length;
             bufSize = bufSize - totalsize;
@@ -348,16 +348,16 @@
     public static byte[] createDataPackage(ClusterData cdata)
             throws java.io.IOException {
         byte[] data = cdata.getMessage();
-        byte[] comprdata = XByteBuffer.toBytes(cdata.getCompress());
+        byte[] options = XByteBuffer.toBytes(cdata.getOptions());
         int length = 
             START_DATA.length + //header length
-            4 + //compression flag
+            4 + //options flag
             4 + //data length indicator
             data.length + //actual data length
             END_DATA.length; //footer length
         byte[] result = new byte[length];
         System.arraycopy(START_DATA, 0, result, 0, START_DATA.length);
-        System.arraycopy(comprdata, 0, result, START_DATA.length, 4);
+        System.arraycopy(options, 0, result, START_DATA.length, 4);
         System.arraycopy(toBytes(data.length), 0, result, START_DATA.length + 4, 4);
         System.arraycopy(data, 0, result, START_DATA.length + 8, data.length);
         System.arraycopy(END_DATA, 0, result, START_DATA.length + 8 + data.length, END_DATA.length);
@@ -394,7 +394,7 @@
      * @return ClusterData
      * @throws IOException
      */
-    public static ClusterData serialize(ClusterMessage msg, boolean compress) throws IOException {
+    public static ClusterData serialize(ClusterMessage msg, int options, boolean compress) throws IOException {
         msg.setTimestamp(System.currentTimeMillis());
         ByteArrayOutputStream outs = new ByteArrayOutputStream();
         ObjectOutputStream out;
@@ -403,8 +403,9 @@
         data.setType(msg.getClass().getName());
         data.setUniqueId(msg.getUniqueId());
         data.setTimestamp(msg.getTimestamp());
-        data.setCompress(msg.getCompress());
-        data.setResend(msg.getResend());
+        data.setOptions(options);
+        data.setResend(data.RESEND_DEFAULT);
+        data.setAddress(msg.getAddress());
         if (compress) {
             gout = new GZIPOutputStream(outs);
             out = new ObjectOutputStream(gout);

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastMember.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastMember.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastMember.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastMember.java Fri Feb 24 15:33:10 2006
@@ -16,6 +16,10 @@
 
 package org.apache.catalina.cluster.mcast;
 
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+
 import org.apache.catalina.cluster.Member;
 import org.apache.catalina.cluster.io.XByteBuffer;
 
@@ -28,7 +32,7 @@
  * @author Peter Rossbach
  * @version $Revision: 304032 $, $Date: 2005-07-27 10:11:55 -0500 (Wed, 27 Jul 2005) $
  */
-public class McastMember implements Member, java.io.Serializable {
+public class McastMember implements Member, java.io.Externalizable {
 
     /**
      * Digits, used for "superfast" de-serialization of an
@@ -54,10 +58,6 @@
      * The tcp listen port for this member
      */
     protected int port;
-    /**
-     * The name for this member, has be be unique within the cluster.
-     */
-    private String name;
 
     /**
      * The name of the cluster domain from this node
@@ -73,7 +73,18 @@
      * created, is kept track of using the start time
      */
     protected long memberAliveTime = 0;
+    
+    /**
+     * For the local member only
+     */
+    protected transient long serviceStartTime;
 
+    /**
+     * Empty constructor for serialization
+     */
+    public McastMember() {
+        
+    }
 
     /**
      * Construct a new member object
@@ -82,14 +93,12 @@
      * @param host - the tcp listen host
      * @param port - the tcp listen port
      */
-    public McastMember(String name,
-                       String domain,
+    public McastMember(String domain,
                        String host,
                        int port,
                        long aliveTime) {
         this.host = host;
         this.port = port;
-        this.name = name;
         this.domain = domain;
         this.memberAliveTime=aliveTime;
     }
@@ -105,7 +114,7 @@
         java.util.HashMap map = new java.util.HashMap(2);
         map.put(McastMember.TCP_LISTEN_HOST,this.host);
         map.put(McastMember.TCP_LISTEN_PORT,String.valueOf(this.port));
-        map.put(McastMember.MEMBER_NAME,name);
+        map.put(McastMember.MEMBER_NAME,getName());
         map.put(McastMember.MEMBER_DOMAIN,domain);
         return map;
     }
@@ -123,27 +132,22 @@
      * @return - the bytes for this member deserialized
      * @throws Exception
      */
-    protected byte[] getData(long startTime) throws Exception {
+    protected byte[] getData() throws IOException {
         //package looks like
         //alive - 8 bytes
         //port - 4 bytes
         //host - 4 bytes
-        //nlen - 4 bytes
-        //name - nlen bytes
         //dlen - 4 bytes
         //domain - dlen bytes
-        byte[] named = getName().getBytes();
         byte[] domaind = getDomain().getBytes();
         byte[] addr = java.net.InetAddress.getByName(host).getAddress();
-        byte[] data = new byte[8+4+addr.length+4+named.length+4+domaind.length];
-        long alive=System.currentTimeMillis()-startTime;
+        byte[] data = new byte[8+4+addr.length+4+domaind.length];
+        long alive=System.currentTimeMillis()-getServiceStartTime();
         System.arraycopy(XByteBuffer.toBytes((long)alive),0,data,0,8);
         System.arraycopy(XByteBuffer.toBytes(port),0,data,8,4);
         System.arraycopy(addr,0,data,12,addr.length);
-        System.arraycopy(XByteBuffer.toBytes(named.length),0,data,16,4);
-        System.arraycopy(named,0,data,20,named.length);
-        System.arraycopy(XByteBuffer.toBytes(domaind.length),0,data,named.length+20,4);
-        System.arraycopy(domaind,0,data,named.length+24,domaind.length);
+        System.arraycopy(XByteBuffer.toBytes(domaind.length),0,data,16,4);
+        System.arraycopy(domaind,0,data,20,domaind.length);
         return data;
     }
     /**
@@ -151,13 +155,11 @@
      * @param data - the bytes received
      * @return a member object.
      */
-    protected static McastMember getMember(byte[] data) {
+    protected static McastMember getMember(byte[] data, McastMember member) {
        //package looks like
        //alive - 8 bytes
        //port - 4 bytes
        //host - 4 bytes
-       //nlen - 4 bytes
-       //name - nlen bytes
        //dlen - 4 bytes
        //domain - dlen bytes
        byte[] alived = new byte[8];
@@ -167,22 +169,21 @@
        byte[] addr = new byte[4];
        System.arraycopy(data, 12, addr, 0, 4);
        //FIXME control the nlen
-       byte[] nlend = new byte[4];
-       System.arraycopy(data, 16, nlend, 0, 4);
-       int nlen = XByteBuffer.toInt(nlend, 0);
-       byte[] named = new byte[nlen];
-       System.arraycopy(data, 20, named, 0, named.length);
        //FIXME control the dlen
        byte[] dlend = new byte[4];
-       System.arraycopy(data, nlen + 20, dlend, 0, 4);
+       System.arraycopy(data, 16, dlend, 0, 4);
        int dlen = XByteBuffer.toInt(dlend, 0);
        byte[] domaind = new byte[dlen];
-       System.arraycopy(data, nlen + 24, domaind, 0, domaind.length);
-       return new McastMember(new String(named),
-                              new String(domaind),
-                              addressToString(addr),
-                              XByteBuffer.toInt(portd, 0),
-                              XByteBuffer.toLong(alived, 0));
+       System.arraycopy(data, 20, domaind, 0, domaind.length);
+       member.setDomain(new String(domaind));
+       member.setHost(addressToString(addr));
+       member.setPort(XByteBuffer.toInt(portd, 0));
+       member.setMemberAliveTime(XByteBuffer.toLong(alived, 0));
+       return member;
+    }
+
+    protected static McastMember getMember(byte[] data) {
+       return getMember(data,new McastMember());
     }
 
     /**
@@ -190,7 +191,7 @@
      * @return a unique name to the cluster
      */
     public String getName() {
-        return name;
+        return "tcp://"+host+":"+port;
     }
     
     /**
@@ -227,6 +228,10 @@
        return memberAliveTime;
     }
 
+    public long getServiceStartTime() {
+        return serviceStartTime;
+    }
+
     public void setMemberAliveTime(long time) {
        memberAliveTime=time;
     }
@@ -237,7 +242,7 @@
      * String representation of this object
      */
     public String toString()  {
-        return "org.apache.catalina.cluster.mcast.McastMember["+name+","+domain+","+host+","+port+", alive="+memberAliveTime+"]";
+        return "org.apache.catalina.cluster.mcast.McastMember["+getName()+","+domain+","+host+","+port+", alive="+memberAliveTime+"]";
     }
 
     /**
@@ -245,7 +250,7 @@
      * @return The hash code
      */
     public int hashCode() {
-        return this.name.hashCode();
+        return this.getName().hashCode();
     }
 
     /**
@@ -254,7 +259,7 @@
      */
     public boolean equals(Object o) {
         if ( o instanceof McastMember )    {
-            return this.name.equals(((McastMember)o).getName());
+            return this.getName().equals(((McastMember)o).getName());
         }
         else
             return false;
@@ -326,13 +331,30 @@
     public void setMsgCount(int msgCount) {
         this.msgCount = msgCount;
     }
-    public void setName(String name) {
-        this.name = name;
-    }
+
     public void setDomain(String domain) {
         this.domain = domain;
     }
     public void setPort(int port) {
         this.port = port;
     }
+
+    public void setServiceStartTime(long serviceStartTime) {
+        this.serviceStartTime = serviceStartTime;
+    }
+
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        int length = in.readInt();
+        byte[] message = new byte[length];
+        in.read(message);
+        getMember(message,this);
+        
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException {
+        byte[] data = this.getData();
+        out.writeInt(data.length);
+        out.write(data);
+    }
+
 }

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastService.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastService.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastService.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastService.java Fri Feb 24 15:33:10 2006
@@ -243,16 +243,16 @@
         String host = getProperties().getProperty("tcpListenHost");
         String domain = getProperties().getProperty("mcastClusterDomain");
         int port = Integer.parseInt(getProperties().getProperty("tcpListenPort"));
-        String name = "tcp://"+host+":"+port;
+        
         if ( localMember == null ) {
-            localMember = new McastMember(name, domain, host, port, 100);
+            localMember = new McastMember(domain, host, port, 100);
         } else {
-            localMember.setName(name);
             localMember.setDomain(domain);
             localMember.setHost(host);
             localMember.setPort(port);
             localMember.setMemberAliveTime(100);
         }
+        localMember.setServiceStartTime(System.currentTimeMillis());
         java.net.InetAddress bind = null;
         if ( properties.getProperty("mcastBindAddress")!= null ) {
             bind = java.net.InetAddress.getByName(properties.getProperty("mcastBindAddress"));
@@ -282,7 +282,7 @@
                                     ttl,
                                     soTimeout,
                                     this);
-
+        
         impl.start(level);
 		long memberwait = (Long.parseLong(properties.getProperty("msgFrequency"))*4);
         if(log.isInfoEnabled())

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastServiceImpl.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastServiceImpl.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastServiceImpl.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/mcast/McastServiceImpl.java Fri Feb 24 15:33:10 2006
@@ -231,7 +231,7 @@
         member.inc();
         if(log.isDebugEnabled())
             log.debug("Mcast send ping from member " + member);
-        byte[] data = member.getData(this.serviceStartTime);
+        byte[] data = member.getData();
         DatagramPacket p = new DatagramPacket(data,data.length);
         p.setAddress(address);
         p.setPort(port);

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java Fri Feb 24 15:33:10 2006
@@ -19,6 +19,7 @@
 import java.net.InetAddress;
 
 import org.apache.catalina.cluster.util.SmartQueue;
+import org.apache.catalina.cluster.io.*;
 
 /**
  * Send cluster messages from a Message queue with only one socket. Ack and keep

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/DataSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/DataSender.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/DataSender.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/DataSender.java Fri Feb 24 15:33:10 2006
@@ -25,6 +25,7 @@
 import org.apache.catalina.cluster.ClusterMessage;
 import org.apache.catalina.cluster.io.XByteBuffer;
 import org.apache.catalina.util.StringManager;
+import org.apache.catalina.cluster.io.*;
 
 /**
  * Send cluster messages with only one socket. Ack and keep Alive Handling is
@@ -809,8 +810,8 @@
              writeData(data);
              messageTransfered = true ;
         } catch (java.io.IOException x) {
-            if(data.getResend() == ClusterMessage.FLAG_ALLOWED || 
-                    (data.getResend() == ClusterMessage.FLAG_DEFAULT && isResend() )) {
+            if(data.getResend() == ClusterMessage.RESEND_ALLOWED || 
+                    (data.getResend() == ClusterMessage.RESEND_DEFAULT && isResend() )) {
                 // second try with fresh connection
                 dataResendCounter++;
                 if (log.isTraceEnabled())

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/FastAsyncSocketSender.java Fri Feb 24 15:33:10 2006
@@ -18,9 +18,10 @@
 
 import java.net.InetAddress;
 
+import org.apache.catalina.cluster.io.ClusterData;
 import org.apache.catalina.cluster.util.FastQueue;
-import org.apache.catalina.cluster.util.LinkObject;
 import org.apache.catalina.cluster.util.IQueue;
+import org.apache.catalina.cluster.util.LinkObject;
 
 /**
  * Send cluster messages from a Message queue with only one socket. Ack and keep

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/IDataSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/IDataSender.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/IDataSender.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/IDataSender.java Fri Feb 24 15:33:10 2006
@@ -16,6 +16,8 @@
 
 package org.apache.catalina.cluster.tcp;
 
+import org.apache.catalina.cluster.io.*;
+
 /**
  * @author Peter Rossbach
  * @version $Revision: 303993 $ $Date: 2005-07-16 16:05:54 -0500 (Sat, 16 Jul 2005) $

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/PooledSocketSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/PooledSocketSender.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/PooledSocketSender.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/PooledSocketSender.java Fri Feb 24 15:33:10 2006
@@ -19,6 +19,7 @@
 import java.io.IOException;
 import java.net.InetAddress;
 import java.util.LinkedList;
+import org.apache.catalina.cluster.io.*;
 
 /**
  * Send cluster messages with a pool of sockets (25).

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java Fri Feb 24 15:33:10 2006
@@ -28,12 +28,12 @@
 
 import org.apache.catalina.cluster.ClusterMessage;
 import org.apache.catalina.cluster.ClusterReceiver;
-import org.apache.catalina.cluster.group.ChannelInterceptorBase;
+import org.apache.catalina.cluster.MessageListener;
+import org.apache.catalina.cluster.io.ClusterData;
 import org.apache.catalina.cluster.io.ListenCallback;
 import org.apache.catalina.cluster.io.ObjectReader;
 import org.apache.catalina.cluster.io.XByteBuffer;
 import org.apache.catalina.util.StringManager;
-import org.apache.catalina.cluster.MessageListener;
 
 /**
  * @author Filip Hanik
@@ -249,7 +249,7 @@
      */
     //protected ClusterMessage deserialize(byte[] data)
     protected ClusterMessage deserialize(ClusterData data) throws IOException, ClassNotFoundException {
-        boolean compress = isCompress() || data.getCompress() == ClusterMessage.FLAG_ALLOWED;
+        boolean compress = false;
         ClusterMessage message = null;
         if (data != null) {
             message = XByteBuffer.deserialize(data, compress);

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java Fri Feb 24 15:33:10 2006
@@ -36,6 +36,7 @@
 import org.apache.catalina.util.StringManager;
 import org.apache.tomcat.util.IntrospectionUtils;
 import org.apache.catalina.cluster.io.XByteBuffer;
+import org.apache.catalina.cluster.io.*;
 
 /**
  * Transmit message to other cluster members
@@ -410,7 +411,9 @@
             time = System.currentTimeMillis();
         }
         try {
-            ClusterData data = serialize(message);
+            ClusterData data = null;
+            if ( message instanceof ClusterData ) data = (ClusterData)message;
+            else data = serialize(message);
             String key = getKey(member);
             IDataSender sender = (IDataSender) map.get(key);
             sendMessageData(data, sender);
@@ -638,9 +641,7 @@
      * @since 5.5.10
      */
     protected ClusterData serialize(ClusterMessage msg) throws IOException {
-        boolean compress = ((isCompress() && msg.getCompress() != ClusterMessage.FLAG_FORBIDDEN)
-                             || msg.getCompress() == ClusterMessage.FLAG_ALLOWED);
-        return XByteBuffer.serialize(msg,compress);
+        return XByteBuffer.serialize(msg, 0, false);
     }
  
 

Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FarmWarDeployer.java Fri Feb 24 15:33:10 2006
@@ -186,6 +186,8 @@
      * @param msg
      *            ClusterMessage - the message received from the cluster
      */
+    
+    
     public void messageReceived(ClusterMessage msg) {
         try {
             if (msg instanceof FileMessage && msg != null) {
@@ -254,6 +256,7 @@
         } catch (java.io.IOException x) {
             log.error("Unable to read farm deploy file message.", x);
         }
+        return;
     }
 
     /**

Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FileMessage.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FileMessage.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FileMessage.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/FileMessage.java Fri Feb 24 15:33:10 2006
@@ -16,9 +16,10 @@
 
 package org.apache.catalina.cluster.deploy;
 
+import java.io.Serializable;
+
 import org.apache.catalina.cluster.ClusterMessage;
 import org.apache.catalina.cluster.Member;
-import java.io.Serializable;
 
 /**
  * Contains the data for a file being transferred over TCP, this is 
@@ -38,8 +39,8 @@
     private long totalNrOfMsgs;
     private String fileName;
     private String contextPath;
-    private int resend = ClusterMessage.FLAG_FORBIDDEN;
-    private int compress = ClusterMessage.FLAG_DEFAULT ;
+    private int resend = ClusterMessage.RESEND_FORBIDDEN;
+    private int options = ClusterMessage.RESEND_DEFAULT ;
     
     public FileMessage(Member source,
                        String fileName,
@@ -125,15 +126,17 @@
      * @return Returns the compress.
      * @since 5.5.10 
      */
-    public int getCompress() {
-        return compress;
+    public int getOptions() {
+
+        return options;
     }
     /**
      * @param compress The compress to set.
      * @since 5.5.10
      */
-    public void setCompress(int compress) {
-        this.compress = compress;
+    public void setOptions(int options) {
+
+        this.options = options;
     }
     /**
      * @return Returns the resend.

Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/UndeployMessage.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/UndeployMessage.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/UndeployMessage.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/deploy/UndeployMessage.java Fri Feb 24 15:33:10 2006
@@ -16,17 +16,18 @@
 
 package org.apache.catalina.cluster.deploy;
 
+import java.io.Serializable;
+
 import org.apache.catalina.cluster.ClusterMessage;
 import org.apache.catalina.cluster.Member;
-import java.io.Serializable;
 public class UndeployMessage implements ClusterMessage,Serializable {
     private Member address;
     private long timestamp;
     private String uniqueId;
     private String contextPath;
     private boolean undeploy;
-    private int resend = ClusterMessage.FLAG_DEFAULT ;
-    private int compress = ClusterMessage.FLAG_DEFAULT ;
+    private int resend = ClusterMessage.RESEND_DEFAULT ;
+    private int options = ClusterMessage.RESEND_DEFAULT ;
 
     public UndeployMessage() {} //for serialization
     public UndeployMessage(Member address,
@@ -85,15 +86,17 @@
      * @return Returns the compress.
      * @since 5.5.10 
      */
-    public int getCompress() {
-        return compress;
+    public int getOptions() {
+
+        return options;
     }
     /**
      * @param compress The compress to set.
      * @since 5.5.10
      */
-    public void setCompress(int compress) {
-        this.compress = compress;
+    public void setOptions(int options) {
+
+        this.options = options;
     }
     /**
      * @return Returns the resend.

Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/ClusterSessionListener.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/ClusterSessionListener.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/ClusterSessionListener.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/ClusterSessionListener.java Fri Feb 24 15:33:10 2006
@@ -88,6 +88,7 @@
                     log.warn("Context manager doesn't exist:" + ctxname);
             }
         }
+        return;
     }
 
     /**

Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/DeltaManager.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/DeltaManager.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/DeltaManager.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/DeltaManager.java Fri Feb 24 15:33:10 2006
@@ -600,18 +600,15 @@
 
         if ((maxActiveSessions >= 0) && (sessions.size() >= maxActiveSessions)) {
             rejectedSessions++;
-            throw new IllegalStateException(sm
-                    .getString("deltaManager.createSession.ise"));
+            throw new IllegalStateException(sm.getString("deltaManager.createSession.ise"));
         }
 
         DeltaSession session = (DeltaSession) super.createSession(sessionId) ;
-        session.resetDeltaRequest();
         if (distribute) {
             sendCreateSession(session.getId(), session);
         }
         if (log.isDebugEnabled())
-            log.debug(sm.getString("deltaManager.createSession.newSession",
-                    session.getId(), new Integer(sessions.size())));
+            log.debug(sm.getString("deltaManager.createSession.newSession",session.getId(), new Integer(sessions.size())));
 
         return (session);
 
@@ -624,16 +621,17 @@
      */
     protected void sendCreateSession(String sessionId, DeltaSession session) {
         if(cluster.getMembers().length > 0 ) {
-            SessionMessage msg = new SessionMessageImpl(getName(),
-                    SessionMessage.EVT_SESSION_CREATED, null, sessionId,
-                    sessionId + "-" + System.currentTimeMillis());
+            SessionMessage msg = 
+                new SessionMessageImpl(getName(),
+                                       SessionMessage.EVT_SESSION_CREATED, 
+                                       null, 
+                                       sessionId,
+                                       sessionId + "-" + System.currentTimeMillis());
             if (log.isDebugEnabled())
-                log.debug(sm.getString("deltaManager.sendMessage.newSession",
-                        name, sessionId));
+                log.debug(sm.getString("deltaManager.sendMessage.newSession",name, sessionId));
             counterSend_EVT_SESSION_CREATED++;
             send(msg);
         }
-        session.resetDeltaRequest();
     }
     
     /**
@@ -943,7 +941,6 @@
             SessionMessage msg = new SessionMessageImpl(this.getName(),
                     SessionMessage.EVT_GET_ALL_SESSIONS, null, "GET-ALL",
                     "GET-ALL-" + getName());
-            msg.setResend(ClusterMessage.FLAG_FORBIDDEN);
             // set reference time
             msg.setTimestamp(beforeSendTime);
             stateTransferCreateSendTime = beforeSendTime ;
@@ -1667,7 +1664,7 @@
                 "SESSION-STATE", "SESSION-STATE-" + getName());
         newmsg.setTimestamp(sendTimestamp);
         //if(isSendSESSIONSTATEcompressed()) {
-        //    newmsg.setCompress(ClusterMessage.FLAG_ALLOWED);
+        //    newmsg.setCompress(ClusterMessage.RESEND_ALLOWED);
         //}
         if (log.isDebugEnabled())
             log.debug(sm.getString(

Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/JvmRouteSessionIDBinderListener.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/JvmRouteSessionIDBinderListener.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/JvmRouteSessionIDBinderListener.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/JvmRouteSessionIDBinderListener.java Fri Feb 24 15:33:10 2006
@@ -147,6 +147,7 @@
             } else if (log.isErrorEnabled())
                 log.error(sm.getString("jvmRoute.hostNotFound", sessionmsg.getContextPath()));
         }
+        return;
     }
 
     /**

Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionIDMessage.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionIDMessage.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionIDMessage.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionIDMessage.java Fri Feb 24 15:33:10 2006
@@ -38,8 +38,8 @@
 
 	private String host ;
 	private String contextPath;
-    private int resend = ClusterMessage.FLAG_DEFAULT ;
-    private int compress = ClusterMessage.FLAG_DEFAULT ;
+    private int resend = ClusterMessage.RESEND_DEFAULT ;
+    private int options = ClusterMessage.RESEND_DEFAULT ;
 
 	public org.apache.catalina.cluster.Member getAddress() {
 		return address;
@@ -62,19 +62,19 @@
 		return result.toString();
 	}
 
-	/**
-         * @return Returns the host.
-         */
-        public String getHost() {
-             return host;
-        }
-    
-        /**
-         * @param host The host to set.
-         */
-         public void setHost(String host) {
-             this.host = host;
-        }
+    /**
+     * @return Returns the host.
+     */
+    public String getHost() {
+        return host;
+    }
+
+    /**
+     * @param host The host to set.
+     */
+    public void setHost(String host) {
+        this.host = host;
+    }
     
 	/**
 	 * @return Returns the contextPath.
@@ -152,15 +152,17 @@
      * @return Returns the compress.
      * @since 5.5.10 
      */
-    public int getCompress() {
-        return compress;
+    public int getOptions() {
+
+        return options;
     }
     /**
      * @param compress The compress to set.
      * @since 5.5.10
      */
-    public void setCompress(int compress) {
-        this.compress = compress;
+    public void setOptions(int options) {
+
+        this.options = options;
     }
     /**
      * @return Returns the resend.

Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionMessageImpl.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionMessageImpl.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionMessageImpl.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/session/SessionMessageImpl.java Fri Feb 24 15:33:10 2006
@@ -45,8 +45,8 @@
     private long serializationTimestamp;
     private boolean timestampSet = false ;
     private String uniqueId;
-    private int resend = ClusterMessage.FLAG_DEFAULT ;
-    private int compress = ClusterMessage.FLAG_DEFAULT ;
+    private int resend = ClusterMessage.RESEND_DEFAULT ;
+    private int options = 0;
 
 
     private SessionMessageImpl( String contextName,
@@ -179,15 +179,17 @@
      * @return Returns the compress.
      * @since 5.5.10 
      */
-    public int getCompress() {
-        return compress;
+    public int getOptions() {
+
+        return options;
     }
     /**
      * @param compress The compress to set.
      * @since 5.5.10
      */
-    public void setCompress(int compress) {
-        this.compress = compress;
+    public void setOptions(int options) {
+
+        this.options = options;
     }
     /**
      * @return Returns the resend.

Modified: tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java?rev=380864&r1=380863&r2=380864&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java (original)
+++ tomcat/container/tc5.5.x/modules/ha/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java Fri Feb 24 15:33:10 2006
@@ -57,6 +57,9 @@
 import org.apache.catalina.cluster.io.ReplicationStream;
 import java.io.ByteArrayInputStream;
 import org.apache.catalina.Loader;
+import org.apache.catalina.cluster.group.interceptors.GzipInterceptor;
+import org.apache.catalina.cluster.MembershipListener;
+import org.apache.catalina.cluster.MessageListener;
 
 /**
  * A <b>Cluster </b> implementation using simple multicast. Responsible for
@@ -71,8 +74,9 @@
  * @author Peter Rossbach
  * @version $Revision: 379550 $, $Date: 2006-02-21 12:06:35 -0600 (Tue, 21 Feb 2006) $
  */
-public class SimpleTcpCluster extends ChannelInterceptorBase 
-    implements CatalinaCluster, Lifecycle, LifecycleListener, IDynamicProperty {
+public class SimpleTcpCluster 
+    implements CatalinaCluster, Lifecycle, LifecycleListener, IDynamicProperty,
+               MembershipListener, MessageListener{
 
     public static Log log = LogFactory.getLog(SimpleTcpCluster.class);
 
@@ -599,7 +603,7 @@
     public void backgroundProcess() {
         if (clusterDeployer != null) clusterDeployer.backgroundProcess();
         //send a heartbeat through the channel
-        heartbeat();
+        if ( channel !=null ) channel.heartbeat();
     }
 
     /**
@@ -670,7 +674,9 @@
         try {
             if ( clusterDeployer != null ) clusterDeployer.setCluster(this);
             this.registerClusterValve();
-            channel.addInterceptor(this);
+            channel.setMembershipListener(this);
+            channel.setMessageListener(this);
+            channel.addInterceptor(new GzipInterceptor());
             channel.start(channel.DEFAULT);
             if (clusterDeployer != null) clusterDeployer.start();
 
@@ -817,7 +823,7 @@
                 } else
                     log.error("Unable to send message to local member " + msg);
             } else {
-                channel.send(null,msg,0);
+                channel.send(null,msg, 0);
             }
         } catch (Exception x) {
             log.error("Unable to send message through cluster sender.", x);
@@ -870,6 +876,10 @@
      * @param message
      *            receveived Message
      */
+    public boolean accept(ClusterMessage message) {
+        return true;
+    }
+    
     public void messageReceived(ClusterMessage message) {
 
         long start = 0;
@@ -901,6 +911,7 @@
                     + message.getClass().getName()
                     + " transfered but no listener registered");
         }
+        return;
     }
 
     // --------------------------------------------------------- Logger



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


Mime
View raw message