tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r400213 - in /tomcat/container/tc5.5.x/modules/groupcom: src/share/org/apache/catalina/tribes/group/ src/share/org/apache/catalina/tribes/group/interceptors/ src/share/org/apache/catalina/tribes/io/ src/share/org/apache/catalina/tribes/tran...
Date Fri, 05 May 2006 23:54:46 GMT
Author: fhanik
Date: Fri May  5 16:54:44 2006
New Revision: 400213

URL: http://svn.apache.org/viewcvs?rev=400213&view=rev
Log:
Refactor clusterdata to a more appropriate name, it has nothing to do with cluster, instead
its an object used by the channel and its sub components only

Added:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ChannelData.java
      - copied, changed from r400212, tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java
Removed:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java
Modified:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/XByteBuffer.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/BioReplicationThread.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/MultipointBioSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java
    tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/TestNioSender.java

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java?rev=400213&r1=400212&r2=400213&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java
Fri May  5 16:54:44 2006
@@ -34,7 +34,7 @@
 import org.apache.catalina.tribes.MembershipListener;
 import org.apache.catalina.tribes.MembershipService;
 import org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor;
-import org.apache.catalina.tribes.io.ClusterData;
+import org.apache.catalina.tribes.io.ChannelData;
 import org.apache.catalina.tribes.io.XByteBuffer;
 import org.apache.catalina.tribes.UniqueId;
 
@@ -105,7 +105,7 @@
         if ( msg == null ) throw new ChannelException("Cant send a NULL message");
         try {
             if ( destination == null || destination.length == 0) throw new ChannelException("No
destination given");
-            ClusterData data = new ClusterData(true);//generates a unique Id
+            ChannelData data = new ChannelData(true);//generates a unique Id
             data.setAddress(getLocalMember(false));
             data.setTimestamp(System.currentTimeMillis());
             byte[] b = null;

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java?rev=400213&r1=400212&r2=400213&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/TcpFailureDetector.java
Fri May  5 16:54:44 2006
@@ -25,7 +25,7 @@
 import org.apache.catalina.tribes.Channel;
 import java.util.Arrays;
 import java.net.SocketTimeoutException;
-import org.apache.catalina.tribes.io.ClusterData;
+import org.apache.catalina.tribes.io.ChannelData;
 import org.apache.catalina.tribes.io.XByteBuffer;
 import java.util.HashMap;
 import org.apache.catalina.tribes.membership.Membership;
@@ -183,7 +183,7 @@
             socket.setSoTimeout((int)readTestTimeout);
             socket.connect(addr, (int) connectTimeout);
             if ( performSendTest ) {
-                ClusterData data = new ClusterData(true);
+                ChannelData data = new ChannelData(true);
                 data.setAddress(mbr);
                 data.setMessage(new XByteBuffer(testMessage,false));
                 data.setTimestamp(System.currentTimeMillis());

Copied: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ChannelData.java
(from r400212, tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java)
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ChannelData.java?p2=tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ChannelData.java&p1=tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java&r1=400212&r2=400213&rev=400213&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ChannelData.java
Fri May  5 16:54:44 2006
@@ -25,15 +25,16 @@
 import java.sql.Timestamp;
 
 /**
- * The cluster data class is used to transport around the byte array from
- * a ClusterMessage object. This is just a utility class to avoid having to 
- * serialize and deserialize the ClusterMessage more than once. 
+ * The object is used to transfer a message through the 
+ * channel interceptor stack and eventually out on a transport to be sent 
+ * to another node.
+ * The 
  * @author Peter Rossbach
  * @author Filip Hanik
  * @version $Revision: 377484 $ $Date: 2006-02-13 15:00:05 -0600 (Mon, 13 Feb 2006) $
- * @since 5.5.10
+ * 
  */
-public class ClusterData implements ChannelMessage {
+public class ChannelData implements ChannelMessage {
     public static boolean USE_SECURE_RANDOM_FOR_UUID = false;
     
     private int options = 0 ;
@@ -42,11 +43,11 @@
     private byte[] uniqueId ;
     private Member address;
 
-    public ClusterData() {
+    public ChannelData() {
         this(true);
     }
     
-    public ClusterData(boolean generateUUID) {
+    public ChannelData(boolean generateUUID) {
         if ( generateUUID ) generateUUID();
     }
     
@@ -58,7 +59,7 @@
      * @param message message data
      * @param timestamp message creation date
      */
-    public ClusterData(byte[] uniqueId, XByteBuffer message, long timestamp) {
+    public ChannelData(byte[] uniqueId, XByteBuffer message, long timestamp) {
         this.uniqueId = uniqueId;
         this.message = message;
         this.timestamp = timestamp;
@@ -176,8 +177,8 @@
         return data;
     }
     
-    public static ClusterData getDataFromPackage(byte[] b)  {
-        ClusterData data = new ClusterData(false);
+    public static ChannelData getDataFromPackage(byte[] b)  {
+        ChannelData data = new ChannelData(false);
         int offset = 0;
         data.setOptions(XByteBuffer.toInt(b,offset));
         offset += 4; //options
@@ -204,8 +205,8 @@
     }
     
     public boolean equals(Object o) {
-        if ( o instanceof ClusterData ) {
-            return Arrays.equals(getUniqueId(),((ClusterData)o).getUniqueId());
+        if ( o instanceof ChannelData ) {
+            return Arrays.equals(getUniqueId(),((ChannelData)o).getUniqueId());
         } else return false;
     }
     
@@ -216,7 +217,7 @@
     public Object clone() {
 //        byte[] d = this.getDataPackage();
 //        return ClusterData.getDataFromPackage(d);
-        ClusterData clone = new ClusterData(false);
+        ChannelData clone = new ChannelData(false);
         clone.options = this.options;
         clone.message = new XByteBuffer(this.message.getBytesDirect(),false);
         clone.timestamp = this.timestamp;
@@ -231,7 +232,7 @@
      */
     public Object deepclone() {
         byte[] d = this.getDataPackage();
-        return ClusterData.getDataFromPackage(d);
+        return ChannelData.getDataFromPackage(d);
     }
     
     public static boolean sendAckSync(int options) {

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/XByteBuffer.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/XByteBuffer.java?rev=400213&r1=400212&r2=400213&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/XByteBuffer.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/XByteBuffer.java
Fri May  5 16:54:44 2006
@@ -309,9 +309,9 @@
 
     }
     
-    public ClusterData extractPackage(boolean clearFromBuffer) throws java.io.IOException
{
+    public ChannelData extractPackage(boolean clearFromBuffer) throws java.io.IOException
{
         byte[] data = extractDataPackage(clearFromBuffer);
-        ClusterData cdata = ClusterData.getDataFromPackage(data);
+        ChannelData cdata = ChannelData.getDataFromPackage(data);
         return cdata;
     }
     
@@ -322,7 +322,7 @@
      * @return - a full package (header,compress,size,data,footer)
      * 
      */
-    public static byte[] createDataPackage(ClusterData cdata) {
+    public static byte[] createDataPackage(ChannelData cdata) {
         return createDataPackage(cdata.getDataPackage());
     }
     

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/BioReplicationThread.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/BioReplicationThread.java?rev=400213&r1=400212&r2=400213&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/BioReplicationThread.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/BioReplicationThread.java
Fri May  5 16:54:44 2006
@@ -26,7 +26,7 @@
 import java.io.OutputStream;
 import org.apache.catalina.tribes.io.ListenCallback;
 import org.apache.catalina.tribes.ChannelMessage;
-import org.apache.catalina.tribes.io.ClusterData;
+import org.apache.catalina.tribes.io.ChannelData;
 
 /**
  * A worker thread class which can drain channels and echo-back the input. Each
@@ -102,7 +102,7 @@
                  * server before completing the request
                  * This is considered an asynchronized request
                  */
-                if (ClusterData.sendAckAsync(msgs[i].getOptions())) sendAck(Constants.ACK_COMMAND);
+                if (ChannelData.sendAckAsync(msgs[i].getOptions())) sendAck(Constants.ACK_COMMAND);
                 try {
                     //process the message
                     getCallback().messageDataReceived(msgs[i]);
@@ -111,9 +111,9 @@
                      * server before sending the ack to the remote server
                      * This is considered a synchronized request
                      */
-                    if (ClusterData.sendAckSync(msgs[i].getOptions())) sendAck(Constants.ACK_COMMAND);
+                    if (ChannelData.sendAckSync(msgs[i].getOptions())) sendAck(Constants.ACK_COMMAND);
                 }catch  ( Exception x ) {
-                    if (ClusterData.sendAckSync(msgs[i].getOptions())) sendAck(Constants.FAIL_ACK_COMMAND);
+                    if (ChannelData.sendAckSync(msgs[i].getOptions())) sendAck(Constants.FAIL_ACK_COMMAND);
                     log.error("Error thrown from messageDataReceived.",x);
                 }
             }                        

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/MultipointBioSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/MultipointBioSender.java?rev=400213&r1=400212&r2=400213&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/MultipointBioSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/bio/MultipointBioSender.java
Fri May  5 16:54:44 2006
@@ -7,7 +7,7 @@
 import org.apache.catalina.tribes.ChannelException;
 import org.apache.catalina.tribes.ChannelMessage;
 import org.apache.catalina.tribes.Member;
-import org.apache.catalina.tribes.io.ClusterData;
+import org.apache.catalina.tribes.io.ChannelData;
 import org.apache.catalina.tribes.io.XByteBuffer;
 import org.apache.catalina.tribes.transport.MultiPointSender;
 import org.apache.catalina.tribes.transport.AbstractSender;
@@ -34,7 +34,7 @@
     private boolean autoConnect;
 
     public synchronized void sendMessage(Member[] destination, ChannelMessage msg) throws
ChannelException {
-        byte[] data = XByteBuffer.createDataPackage((ClusterData)msg);
+        byte[] data = XByteBuffer.createDataPackage((ChannelData)msg);
         BioSender[] senders = setupForSend(destination);
         ChannelException cx = null;
         for ( int i=0; i<senders.length; i++ ) {

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java?rev=400213&r1=400212&r2=400213&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java
Fri May  5 16:54:44 2006
@@ -25,7 +25,7 @@
 import org.apache.catalina.tribes.transport.WorkerThread;
 import org.apache.catalina.tribes.ChannelMessage;
 import org.apache.catalina.tribes.io.ListenCallback;
-import org.apache.catalina.tribes.io.ClusterData;
+import org.apache.catalina.tribes.io.ChannelData;
 
 /**
  * A worker thread class which can drain channels and echo-back the input. Each
@@ -152,7 +152,7 @@
                  * server before completing the request
                  * This is considered an asynchronized request
                  */
-                if (ClusterData.sendAckAsync(msgs[i].getOptions())) sendAck(key,channel,Constants.ACK_COMMAND);
+                if (ChannelData.sendAckAsync(msgs[i].getOptions())) sendAck(key,channel,Constants.ACK_COMMAND);
                 try {
                     //process the message
                     getCallback().messageDataReceived(msgs[i]);
@@ -161,10 +161,10 @@
                      * server before sending the ack to the remote server
                      * This is considered a synchronized request
                      */
-                    if (ClusterData.sendAckSync(msgs[i].getOptions())) sendAck(key,channel,Constants.ACK_COMMAND);
+                    if (ChannelData.sendAckSync(msgs[i].getOptions())) sendAck(key,channel,Constants.ACK_COMMAND);
                 }catch ( Exception e ) {
                     log.error("Processing of cluster message failed.",e);
-                    if (ClusterData.sendAckSync(msgs[i].getOptions())) sendAck(key,channel,Constants.FAIL_ACK_COMMAND);
+                    if (ChannelData.sendAckSync(msgs[i].getOptions())) sendAck(key,channel,Constants.FAIL_ACK_COMMAND);
                 } 
             }                        
         }

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java?rev=400213&r1=400212&r2=400213&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/ParallelNioSender.java
Fri May  5 16:54:44 2006
@@ -26,7 +26,7 @@
 import org.apache.catalina.tribes.ChannelException;
 import org.apache.catalina.tribes.ChannelMessage;
 import org.apache.catalina.tribes.Member;
-import org.apache.catalina.tribes.io.ClusterData;
+import org.apache.catalina.tribes.io.ChannelData;
 import org.apache.catalina.tribes.io.XByteBuffer;
 import org.apache.catalina.tribes.transport.MultiPointSender;
 import org.apache.catalina.tribes.transport.SenderState;
@@ -63,7 +63,7 @@
     
     public synchronized void sendMessage(Member[] destination, ChannelMessage msg) throws
ChannelException {
         long start = System.currentTimeMillis();
-        byte[] data = XByteBuffer.createDataPackage((ClusterData)msg);
+        byte[] data = XByteBuffer.createDataPackage((ChannelData)msg);
         NioSender[] senders = setupForSend(destination);
         connect(senders);
         setData(senders,data);

Modified: tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/TestNioSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/TestNioSender.java?rev=400213&r1=400212&r2=400213&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/TestNioSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/test/java/org/apache/catalina/tribes/test/TestNioSender.java
Fri May  5 16:54:44 2006
@@ -6,7 +6,7 @@
 import java.nio.channels.Selector;
 import org.apache.catalina.tribes.transport.nio.NioSender;
 import org.apache.catalina.tribes.membership.MemberImpl;
-import org.apache.catalina.tribes.io.ClusterData;
+import org.apache.catalina.tribes.io.ChannelData;
 import org.apache.catalina.tribes.io.XByteBuffer;
 import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.Channel;
@@ -36,9 +36,9 @@
         return ++counter;
     }
     
-    public synchronized ClusterData getMessage(Member mbr) {
+    public synchronized ChannelData getMessage(Member mbr) {
         String msg = new String("Thread-"+Thread.currentThread().getName()+" Message:"+inc());
-        ClusterData data = new ClusterData(true);
+        ChannelData data = new ChannelData(true);
         data.setMessage(new XByteBuffer(msg.getBytes(),false));
         data.setAddress(mbr);
         



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


Mime
View raw message