Author: fhanik
Date: Tue Feb 21 10:06:35 2006
New Revision: 379550

URL: http://svn.apache.org/viewcvs?rev=379550&view=rev
Log:
Refactored cluster receiver base, this class should not contain IO logic, since 
its a catalina cluster class and not at all participating in the replication 
logic.
Essentially, this refactor is a revert back to where it used to be during the 
original design thoughts, but keeping the class intact and backwards compatible.



Modified:
    tomcat/container/tc5.5.x/catalina/src/conf/server.xml
    
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSet.java
    
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java
    
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/ClusterReceiver.java
    
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java
    
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java
    
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
    
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml

Modified: tomcat/container/tc5.5.x/catalina/src/conf/server.xml
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/conf/server.xml?rev=379550&r1=379549&r2=379550&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/catalina/src/conf/server.xml (original)
+++ tomcat/container/tc5.5.x/catalina/src/conf/server.xml Tue Feb 21 10:06:35 
2006
@@ -294,7 +294,7 @@
                 mcastDropTime="3000"/>
 
             <Receiver 
-                className="org.apache.catalina.cluster.tcp.ReplicationListener"
+                className="org.apache.catalina.cluster.tcp.ClusterReceiverBase"
                 tcpListenAddress="auto"
                 tcpListenPort="4001"
                 tcpSelectorTimeout="100"

Modified: 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSet.java
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSet.java?rev=379550&r1=379549&r2=379550&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSet.java
 (original)
+++ 
tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/startup/ClusterRuleSet.java
 Tue Feb 21 10:06:35 2006
@@ -107,7 +107,7 @@
         digester.addSetProperties(prefix + "Receiver");
         digester.addSetNext(prefix + "Receiver",
                             "setClusterReceiver",
-                            "org.apache.catalina.cluster.ClusterReceiver");
+                            
"org.apache.catalina.cluster.tcp.ClusterReceiverBase");
 
         digester.addObjectCreate(prefix + "Valve",
                                  null, // MUST be specified in the element

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java?rev=379550&r1=379549&r2=379550&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/CatalinaCluster.java
 Tue Feb 21 10:06:35 2006
@@ -23,6 +23,7 @@
 import org.apache.catalina.Manager;
 import org.apache.catalina.Valve;
 import org.apache.commons.logging.Log;
+import org.apache.catalina.cluster.tcp.ClusterReceiverBase;
 
 
 /**
@@ -111,9 +112,9 @@
     
     public ClusterSender getClusterSender();
     
-    public void setClusterReceiver(ClusterReceiver receiver);
+    public void setClusterReceiver(ClusterReceiverBase receiver);
     
-    public ClusterReceiver getClusterReceiver();
+    public ClusterReceiverBase getClusterReceiver();
     
     public void setMembershipService(MembershipService service);
     

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/ClusterReceiver.java
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/ClusterReceiver.java?rev=379550&r1=379549&r2=379550&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/ClusterReceiver.java
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/ClusterReceiver.java
 Tue Feb 21 10:06:35 2006
@@ -35,25 +35,7 @@
      */
     public void stop();
 
-    /**
-     * set callback.
-     *
-     * @param cluster The cluster
-     */
-    public void setCatalinaCluster(CatalinaCluster cluster);
     
-    /**
-     * get Callback.
-     *
-     * @return The cluster
-     */
-    public CatalinaCluster getCatalinaCluster();
-    
-    /**
-     * Send Ack to sender or not.
-     *
-     * @return The flag value
-     */
     public boolean isSendAck();
     
     /**

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java?rev=379550&r1=379549&r2=379550&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ClusterReceiverBase.java
 Tue Feb 21 10:06:35 2006
@@ -16,33 +16,22 @@
 
 package org.apache.catalina.cluster.tcp;
 
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.GZIPInputStream;
-
 import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.apache.catalina.Container;
 import org.apache.catalina.cluster.CatalinaCluster;
 import org.apache.catalina.cluster.ClusterMessage;
-import org.apache.catalina.cluster.ClusterReceiver;
-import org.apache.catalina.cluster.io.ListenCallback;
-import org.apache.catalina.cluster.session.ClusterSessionListener;
-import org.apache.catalina.cluster.session.ReplicationStream;
 import org.apache.catalina.core.StandardHost;
 import org.apache.catalina.util.StringManager;
-import org.apache.catalina.cluster.io.XByteBuffer;
 
 /**
-* FIXME i18n log messages
+* @author Filip Hanik
 * @author Peter Rossbach
 * @version $Revision$ $Date$
 */
 
-public abstract class ClusterReceiverBase implements Runnable, 
ClusterReceiver,ListenCallback {
+public class ClusterReceiverBase extends ReplicationListener {
     
     protected static org.apache.commons.logging.Log log =
         org.apache.commons.logging.LogFactory.getLog( 
ClusterReceiverBase.class );
@@ -53,11 +42,7 @@
     protected StringManager sm = StringManager.getManager(Constants.Package);
 
     private CatalinaCluster cluster;
-    private java.net.InetAddress bind;
-    private String tcpListenAddress;
-    private int tcpListenPort;
-    private boolean sendAck;
-    protected boolean doListen = false;
+    
 
     /**
      * total bytes to recevied
@@ -94,10 +79,6 @@
     private long lastChecked = System.currentTimeMillis();
 
 
-    /**
-     * Compress message data bytes
-     */
-    private boolean compress = true ;
 
     /**
      * Transmitter Mbean name
@@ -111,34 +92,7 @@
         return doListen;
     }
 
-    /**
-     * @return Returns the bind.
-     */
-    public java.net.InetAddress getBind() {
-        if (bind == null) {
-            try {
-                if ("auto".equals(tcpListenAddress)) {
-                    tcpListenAddress = java.net.InetAddress.getLocalHost()
-                            .getHostAddress();
-                }
-                if (log.isDebugEnabled())
-                    log.debug("Starting replication listener on address:"
-                            + tcpListenAddress);
-                bind = java.net.InetAddress.getByName(tcpListenAddress);
-            } catch (IOException ioe) {
-                log.error("Failed bind replication listener on address:"
-                        + tcpListenAddress, ioe);
-            }
-        }
-      return bind;
-    }
     
-    /**
-     * @param bind The bind to set.
-     */
-    public void setBind(java.net.InetAddress bind) {
-        this.bind = bind;
-    }
     public void setCatalinaCluster(CatalinaCluster cluster) {
         this.cluster = cluster;
     }
@@ -164,61 +118,7 @@
         return objectName;
     }
     
-    /**
-     * @return Returns the compress.
-     */
-    public boolean isCompress() {
-        return compress;
-    }
-    
-    /**
-     * @param compressMessageData The compress to set.
-     */
-    public void setCompress(boolean compressMessageData) {
-        this.compress = compressMessageData;
-    }
-    
-    /**
-     * Send ACK to sender
-     * 
-     * @return True if sending ACK
-     */
-    public boolean isSendAck() {
-        return sendAck;
-    }
-
-    /**
-     * set ack mode or not!
-     * 
-     * @param sendAck
-     */
-    public void setSendAck(boolean sendAck) {
-        this.sendAck = sendAck;
-    }
- 
-    public String getTcpListenAddress() {
-        return tcpListenAddress;
-    }
-    
-    public void setTcpListenAddress(String tcpListenAddress) {
-        this.tcpListenAddress = tcpListenAddress;
-    }
-    
-    public int getTcpListenPort() {
-        return tcpListenPort;
-    }
     
-    public void setTcpListenPort(int tcpListenPort) {
-        this.tcpListenPort = tcpListenPort;
-    }
-  
-    public String getHost() {
-        return getTcpListenAddress();
-    }
-
-    public int getPort() {
-        return getTcpListenPort();
-    }
     // ------------------------------------------------------------- stats
 
     /**
@@ -299,14 +199,7 @@
      * @see org.apache.catalina.cluster.ClusterReceiver#start()
      */
     public void start() {
-        try {
-            getBind();
-            Thread t = new Thread(this, "ClusterReceiver");
-            t.setDaemon(true);
-            t.start();
-        } catch (Exception x) {
-            log.fatal("Unable to start cluster receiver", x);
-        }
+        super.start();
         registerReceiverMBean();
     }
 
@@ -318,7 +211,7 @@
      * @see #stopListening()
      */
     public void stop() {
-        stopListening();
+        super.stop();
         unregisterRecevierMBean();
      
     }
@@ -347,10 +240,9 @@
                     return;
                 }
                 setObjectName(receiverName);
-                mserver.registerMBean(scluster.getManagedBean(this),
-                        getObjectName());
+                
mserver.registerMBean(scluster.getManagedBean(this),getObjectName());
             } catch (Exception e) {
-                log.warn(e);
+                log.warn("Unable to register JMX bean ClusterReceiverBase",e);
             }
         }
     }
@@ -372,33 +264,8 @@
         }
     }
 
-    /**
-     * stop Listener sockets
-     */
-    protected abstract void stopListening() ;
-
-    /**
-     * Start Listener
-     * @throws Exception
-     */
-    protected abstract void listen ()
-       throws Exception ;
-
     
-    /**
-     * Start thread and listen
-     */
-    public void run()
-    {
-        try
-        {
-            listen();
-        }
-        catch ( Exception x )
-        {
-            log.error("Unable to start cluster listener.",x);
-        }
-    }
+    
 
     // --------------------------------------------------------- receiver 
messages
 
@@ -416,6 +283,10 @@
         }
         try {
             ClusterMessage message = deserialize(data);
+            // calc stats really received bytes
+            totalReceivedBytes += data.getMessage().length;
+            //totalReceivedBytes += data.length;
+            nrOfMsgsReceived++;
             cluster.receive(message);
         } catch (Exception x) {
             log
@@ -429,27 +300,7 @@
         }
     }
 
-    /**
-     * deserialize the receieve cluster message
-     * @param data uncompress data
-     * @return The message
-     * @throws IOException
-     * @throws ClassNotFoundException
-     */
-    //protected ClusterMessage deserialize(byte[] data)
-    protected ClusterMessage deserialize(ClusterData data)
-            throws IOException, ClassNotFoundException {
-        boolean compress = isCompress() || data.getCompress() == 
ClusterMessage.FLAG_ALLOWED;
-        ClusterMessage message = null;
-        if (data != null) {
-            message = XByteBuffer.deserialize(data, compress);
-            // calc stats really received bytes
-            totalReceivedBytes += data.getMessage().length;
-            //totalReceivedBytes += data.length;
-            nrOfMsgsReceived++;
-        }
-        return message;
-    }
+    
     
     // --------------------------------------------- Performance Stats
 
@@ -490,11 +341,6 @@
         }
     }
     
-    /* (non-Javadoc)
-     * @see org.apache.catalina.cluster.io.ListenCallback#sendAck()
-     */
-    public void sendAck() throws IOException {
-        // do nothing
-    }
+    
 
 }

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java?rev=379550&r1=379549&r2=379550&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationListener.java
 Tue Feb 21 10:06:35 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999,2004-2005 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.
@@ -16,7 +16,6 @@
 
 package org.apache.catalina.cluster.tcp;
 
-
 import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.nio.channels.SelectableChannel;
@@ -27,32 +26,54 @@
 import java.util.Iterator;
 
 import org.apache.catalina.cluster.io.ObjectReader;
+import org.apache.catalina.cluster.io.ListenCallback;
+import org.apache.catalina.cluster.ClusterReceiver;
+import org.apache.catalina.util.StringManager;
+import java.io.IOException;
+import org.apache.catalina.cluster.ClusterMessage;
+import org.apache.catalina.cluster.io.XByteBuffer;
 
 /**
-* FIXME i18n log messages
-* FIXME jmx support
-* @author Peter Rossbach
-* @author Filip Hanik
-* @version $Revision$ $Date$
-*/
-public class ReplicationListener extends ClusterReceiverBase
-{
+ * @author Filip Hanik
+ * @author Peter Rossbach
+ * @version $Revision$ $Date$
+ */
+public class ReplicationListener
+    implements Runnable, ClusterReceiver, ListenCallback {
+    protected static org.apache.commons.logging.Log log =
+        
org.apache.commons.logging.LogFactory.getLog(ReplicationListener.class);
+
+    /**
+     * The string manager for this package.
+     */
+    protected StringManager sm = StringManager.getManager(Constants.Package);
 
     /**
      * The descriptive information about this implementation.
      */
-    private static final String info = "ReplicationListener/1.2";
-    
+    private static final String info = "ReplicationListener/1.3";
+
     private ThreadPool pool = null;
     private int tcpThreadCount;
-    private long tcpSelectorTimeout;    
+    private long tcpSelectorTimeout;
     private Selector selector = null;
-    
+
+    private java.net.InetAddress bind;
+    private String tcpListenAddress;
+    private int tcpListenPort;
+    private boolean sendAck;
+    protected boolean doListen = false;
+    /**
+     * Compress message data bytes
+     */
+    private boolean compress = true;
+
+
     private Object interestOpsMutex = new Object();
-    
+
     public ReplicationListener() {
     }
-    
+
     /**
      * Return descriptive information about this implementation and the
      * corresponding version number, in the format
@@ -63,38 +84,52 @@
         return (info);
 
     }
- 
+
     public long getTcpSelectorTimeout() {
         return tcpSelectorTimeout;
     }
+
     public void setTcpSelectorTimeout(long tcpSelectorTimeout) {
         this.tcpSelectorTimeout = tcpSelectorTimeout;
     }
+
     public int getTcpThreadCount() {
         return tcpThreadCount;
     }
+
     public void setTcpThreadCount(int tcpThreadCount) {
         this.tcpThreadCount = tcpThreadCount;
     }
+
     public Object getInterestOpsMutex() {
         return interestOpsMutex;
     }
 
+    public void stop() {
+        this.stopListening();
+    }
+
     /**
      * start cluster receiver
      * @throws Exception
      * @see org.apache.catalina.cluster.ClusterReceiver#start()
      */
     public void start() {
-            try {
-                pool = new ThreadPool(tcpThreadCount, 
TcpReplicationThread.class, interestOpsMutex);
-            } catch (Exception e) {
-                log.error("ThreadPool can initilzed. Listener not started",e);
-                return ;
-            }
-            super.start() ;
-     }
-    
+        try {
+            pool = new ThreadPool(tcpThreadCount, TcpReplicationThread.class, 
interestOpsMutex);
+        } catch (Exception e) {
+            log.error("ThreadPool can initilzed. Listener not started", e);
+            return;
+        }
+        try {
+            getBind();
+            Thread t = new Thread(this, "ReplicationListener");
+            t.setDaemon(true);
+            t.start();
+        } catch (Exception x) {
+            log.fatal("Unable to start cluster receiver", x);
+        }
+    }
 
     /**
      * get data from channel and store in byte array
@@ -102,14 +137,12 @@
      * @throws IOException
      * @throws java.nio.channels.ClosedChannelException
      */
-    protected void listen ()
-        throws Exception
-    {
+    protected void listen() throws Exception {
         if (doListen) {
             log.warn("ServerSocketChannel allready started");
             return;
         }
-        doListen=true;
+        doListen = true;
         // allocate an unbound server socket channel
         ServerSocketChannel serverChannel = ServerSocketChannel.open();
         // Get the associated ServerSocket to bind it with
@@ -117,11 +150,11 @@
         // create a new Selector for use below
         selector = Selector.open();
         // set the port the server channel will listen to
-        serverSocket.bind (new InetSocketAddress 
(getBind(),getTcpListenPort()));
+        serverSocket.bind(new InetSocketAddress(getBind(), 
getTcpListenPort()));
         // set non-blocking mode for the listening socket
-        serverChannel.configureBlocking (false);
+        serverChannel.configureBlocking(false);
         // register the ServerSocketChannel with the Selector
-        serverChannel.register (selector, SelectionKey.OP_ACCEPT);
+        serverChannel.register(selector, SelectionKey.OP_ACCEPT);
         while (doListen && selector != null) {
             // this may block for a long time, upon return the
             // selected set contains keys of the ready channels
@@ -129,14 +162,14 @@
 
                 int n = selector.select(tcpSelectorTimeout);
                 if (n == 0) {
-                    //there is a good chance that we got here 
+                    //there is a good chance that we got here
                     //because the TcpReplicationThread called
                     //selector wakeup().
                     //if that happens, we must ensure that that
                     //thread has enough time to call interestOps
                     synchronized (interestOpsMutex) {
                         //if we got the lock, means there are no
-                        //keys trying to register for the 
+                        //keys trying to register for the
                         //interestOps method
                     }
                     continue; // nothing to do
@@ -152,7 +185,7 @@
                             (ServerSocketChannel) key.channel();
                         SocketChannel channel = server.accept();
                         Object attach = new ObjectReader(channel, selector,
-                                    this) ;
+                            this);
                         registerChannel(selector,
                                         channel,
                                         SelectionKey.OP_READ,
@@ -179,7 +212,7 @@
 
         }
         serverChannel.close();
-        if(selector != null)
+        if (selector != null)
             selector.close();
     }
 
@@ -191,36 +224,63 @@
     protected void stopListening() {
         // Bugzilla 37529: 
http://issues.apache.org/bugzilla/show_bug.cgi?id=37529
         doListen = false;
-        if ( selector != null ) {
+        if (selector != null) {
             try {
-                for(int i = 0; i < getTcpThreadCount(); i++) {
+                for (int i = 0; i < getTcpThreadCount(); i++) {
                     selector.wakeup();
                 }
                 selector.close();
-            } catch ( Exception x ) {
-                log.error("Unable to close cluster receiver selector.",x);
+            } catch (Exception x) {
+                log.error("Unable to close cluster receiver selector.", x);
             } finally {
-                selector = null;                
+                selector = null;
             }
         }
-   }
-        
+    }
+
+    /**
+     * deserialize the receieve cluster message
+     * @param data uncompress data
+     * @return The message
+     * @throws IOException
+     * @throws ClassNotFoundException
+     */
+    //protected ClusterMessage deserialize(byte[] data)
+    protected ClusterMessage deserialize(ClusterData data) throws IOException, 
ClassNotFoundException {
+        boolean compress = isCompress() || data.getCompress() == 
ClusterMessage.FLAG_ALLOWED;
+        ClusterMessage message = null;
+        if (data != null) {
+            message = XByteBuffer.deserialize(data, compress);
+        }
+        return message;
+    }
+
     // ----------------------------------------------------------
 
     /**
      * Register the given channel with the given selector for
      * the given operations of interest
      */
-    protected void registerChannel (Selector selector,
-                                    SelectableChannel channel,
-                                    int ops,
-                                    Object attach)
-    throws Exception {
-        if (channel == null) return; // could happen
+    protected void registerChannel(Selector selector,
+                                   SelectableChannel channel,
+                                   int ops,
+                                   Object attach) throws Exception {
+        if (channel == null)return; // could happen
         // set the new channel non-blocking
-        channel.configureBlocking (false);
+        channel.configureBlocking(false);
         // register it with the selector
-        channel.register (selector, ops, attach);
+        channel.register(selector, ops, attach);
+    }
+
+    /**
+     * Start thread and listen
+     */
+    public void run() {
+        try {
+            listen();
+        } catch (Exception x) {
+            log.error("Unable to start replication listener.", x);
+        }
     }
 
     // ----------------------------------------------------------
@@ -233,16 +293,14 @@
      *  automatically invalidates the associated key.  The selector
      *  will then de-register the channel on the next select call.
      */
-    protected void readDataFromSocket (SelectionKey key)
-        throws Exception
-    {
-        TcpReplicationThread worker = (TcpReplicationThread)pool.getWorker();
+    protected void readDataFromSocket(SelectionKey key) throws Exception {
+        TcpReplicationThread worker = (TcpReplicationThread) pool.getWorker();
         if (worker == null) {
             // No threads available, do nothing, the selection
             // loop will keep calling this method until a
             // thread becomes available.
             // FIXME: This design could be improved.
-            if(log.isDebugEnabled())
+            if (log.isDebugEnabled())
                 log.debug("No TcpReplicationThread available");
         } else {
             // invoking this wakes up the worker thread then returns
@@ -250,5 +308,100 @@
         }
     }
 
-    
+    public void messageDataReceived(ClusterData data) {
+        //nothing to do yet
+    }
+
+    /**
+     * @return Returns the bind.
+     */
+    public java.net.InetAddress getBind() {
+        if (bind == null) {
+            try {
+                if ("auto".equals(tcpListenAddress)) {
+                    tcpListenAddress = java.net.InetAddress.getLocalHost()
+                                       .getHostAddress();
+                }
+                if (log.isDebugEnabled())
+                    log.debug("Starting replication listener on address:"
+                              + tcpListenAddress);
+                bind = java.net.InetAddress.getByName(tcpListenAddress);
+            } catch (IOException ioe) {
+                log.error("Failed bind replication listener on address:"
+                          + tcpListenAddress, ioe);
+            }
+        }
+        return bind;
+    }
+
+    /**
+     * @param bind The bind to set.
+     */
+    public void setBind(java.net.InetAddress bind) {
+        this.bind = bind;
+    }
+
+    /**
+     * @return Returns the compress.
+     */
+    public boolean isCompress() {
+        return compress;
+    }
+
+    /**
+     * @param compressMessageData The compress to set.
+     */
+    public void setCompress(boolean compressMessageData) {
+        this.compress = compressMessageData;
+    }
+
+    /**
+     * Send ACK to sender
+     *
+     * @return True if sending ACK
+     */
+    public boolean isSendAck() {
+        return sendAck;
+    }
+
+    /**
+     * set ack mode or not!
+     *
+     * @param sendAck
+     */
+    public void setSendAck(boolean sendAck) {
+        this.sendAck = sendAck;
+    }
+
+    public String getTcpListenAddress() {
+        return tcpListenAddress;
+    }
+
+    public void setTcpListenAddress(String tcpListenAddress) {
+        this.tcpListenAddress = tcpListenAddress;
+    }
+
+    public int getTcpListenPort() {
+        return tcpListenPort;
+    }
+
+    public void setTcpListenPort(int tcpListenPort) {
+        this.tcpListenPort = tcpListenPort;
+    }
+
+    public String getHost() {
+        return getTcpListenAddress();
+    }
+
+    public int getPort() {
+        return getTcpListenPort();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.catalina.cluster.io.ListenCallback#sendAck()
+     */
+    public void sendAck() throws IOException {
+        // do nothing
+    }
+
 }

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java?rev=379550&r1=379549&r2=379550&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SimpleTcpCluster.java
 Tue Feb 21 10:06:35 2006
@@ -175,7 +175,7 @@
     /**
      * Receiver to register call back with
      */
-    private org.apache.catalina.cluster.ClusterReceiver clusterReceiver;
+    private ClusterReceiverBase clusterReceiver;
 
     private List valves = new ArrayList();
 
@@ -319,11 +319,11 @@
         this.clusterSender = clusterSender;
     }
 
-    public ClusterReceiver getClusterReceiver() {
+    public ClusterReceiverBase getClusterReceiver() {
         return clusterReceiver;
     }
 
-    public void setClusterReceiver(ClusterReceiver clusterReceiver) {
+    public void setClusterReceiver(ClusterReceiverBase clusterReceiver) {
         this.clusterReceiver = clusterReceiver;
     }
 
@@ -1339,8 +1339,7 @@
     public ModelMBean getManagedBean(Object object) throws Exception {
         ModelMBean mbean = null;
         if (registry != null) {
-            ManagedBean managedBean = registry.findManagedBean(object
-                    .getClass().getName());
+            ManagedBean managedBean = 
registry.findManagedBean(object.getClass().getName());
             mbean = managedBean.createMBean(object);
         }
         return mbean;

Modified: 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml?rev=379550&r1=379549&r2=379550&view=diff
==============================================================================
--- 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml
 (original)
+++ 
tomcat/container/tc5.5.x/modules/cluster/src/share/org/apache/catalina/cluster/tcp/mbeans-descriptors.xml
 Tue Feb 21 10:06:35 2006
@@ -86,11 +86,11 @@
                  
   </mbean>
 
-  <mbean         name="ReplicationListener"
+  <mbean         name="ClusterReceiverBase"
            description="Tcp Cluster ReplicationListener implementation"
                domain="Catalina"
                 group="Cluster"
-                 type="org.apache.catalina.cluster.tcp.ReplicationListener">
+                 type="org.apache.catalina.cluster.tcp.ClusterReceiverBase">
     <attribute   name="info"
           description="Class version info"
                  type="java.lang.String"



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to