tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r385675 - in /tomcat/container/tc5.5.x/modules/groupcom: src/share/org/apache/catalina/tribes/tcp/bio/ src/share/org/apache/catalina/tribes/tcp/nio/ src/share/org/apache/catalina/tribes/tipis/ test/org/apache/catalina/tribes/demos/
Date Mon, 13 Mar 2006 22:20:12 GMT
Author: fhanik
Date: Mon Mar 13 14:20:10 2006
New Revision: 385675

URL: http://svn.apache.org/viewcvs?rev=385675&view=rev
Log:
Fixed the map and the demo

Modified:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/MultipointBioSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/ParallelNioSender.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/RpcChannel.java
    tomcat/container/tc5.5.x/modules/groupcom/test/org/apache/catalina/tribes/demos/MapDemo.java

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/MultipointBioSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/MultipointBioSender.java?rev=385675&r1=385674&r2=385675&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/MultipointBioSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/bio/MultipointBioSender.java
Mon Mar 13 14:20:10 2006
@@ -11,7 +11,6 @@
 import org.apache.catalina.tribes.io.XByteBuffer;
 import org.apache.catalina.tribes.tcp.MultiPointSender;
 import org.apache.catalina.tribes.tcp.SenderState;
-import org.apache.catalina.tribes.tcp.nio.NioSender;
 
 /**
  * <p>Title: </p>
@@ -96,7 +95,7 @@
         for (int i=0; i<members.length; i++ ) {
             Member mbr = (Member)members[i];
             try {
-                NioSender sender = (NioSender)bioSenders.get(mbr);
+                BioSender sender = (BioSender)bioSenders.get(mbr);
                 sender.disconnect();
             }catch ( Exception e ) {
                 if ( x == null ) x = new ChannelException(e);
@@ -113,7 +112,7 @@
 
     public void memberRemoved(Member member) {
         //disconnect senders
-        NioSender sender = (NioSender)bioSenders.remove(member);
+        BioSender sender = (BioSender)bioSenders.remove(member);
         if ( sender != null ) sender.disconnect();
     }
 
@@ -176,13 +175,13 @@
     }
 
     public boolean keepalive() {
-        //throw new UnsupportedOperationException("Method ParallelNioSender.checkKeepAlive()
not implemented");
+        //throw new UnsupportedOperationException("Method ParallelBioSender.checkKeepAlive()
not implemented");
         boolean result = false;
         Map.Entry[] entries = (Map.Entry[])bioSenders.entrySet().toArray(new Map.Entry[bioSenders.size()]);
         for ( int i=0; i<entries.length; i++ ) {
-            NioSender sender = (NioSender)entries[i].getValue();
-            if ( sender.checkKeepAlive() ) {
-                bioSenders.remove(sender.getDestination());
+            BioSender sender = (BioSender)entries[i].getValue();
+            if ( sender.keepalive() ) {
+                bioSenders.remove(entries[i].getKey());
             }
         }
         return result;

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java?rev=385675&r1=385674&r2=385675&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioReceiver.java
Mon Mar 13 14:20:10 2006
@@ -197,9 +197,6 @@
                             (ServerSocketChannel) key.channel();
                         SocketChannel channel = server.accept();
 
-//System.out.println("DEFAULT CHANNEL RX="+channel.socket().getReceiveBufferSize() +" our="+rxBufSize);
-//System.out.println("DEFAULT CHANNEL TX="+channel.socket().getSendBufferSize() +" our="+txBufSize);
-
                         channel.socket().setReceiveBufferSize(rxBufSize);
                         channel.socket().setSendBufferSize(txBufSize);
                         Object attach = new ObjectReader(channel, selector,this);

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioSender.java?rev=385675&r1=385674&r2=385675&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/NioSender.java
Mon Mar 13 14:20:10 2006
@@ -268,7 +268,7 @@
      * @return boolean
      * @todo Implement this org.apache.catalina.tribes.tcp.IDataSender method
      */
-    public boolean checkKeepAlive() {
+    public boolean keepalive() {
         return false;
     }
     /**

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/ParallelNioSender.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/ParallelNioSender.java?rev=385675&r1=385674&r2=385675&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/ParallelNioSender.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tcp/nio/ParallelNioSender.java
Mon Mar 13 14:20:10 2006
@@ -279,8 +279,8 @@
         Map.Entry[] entries = (Map.Entry[])nioSenders.entrySet().toArray(new Map.Entry[nioSenders.size()]);
         for ( int i=0; i<entries.length; i++ ) {
             NioSender sender = (NioSender)entries[i].getValue();
-            if ( sender.checkKeepAlive() ) {
-                nioSenders.remove(sender.getDestination());
+            if ( sender.keepalive() ) {
+                nioSenders.remove(entries[i].getKey());
             }
         }
         return result;

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java?rev=385675&r1=385674&r2=385675&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/LazyReplicatedMap.java
Mon Mar 13 14:20:10 2006
@@ -521,14 +521,22 @@
                 msg = (MapMessage) resp[0].getMessage();
                 
                 Member backup = entry.getBackupNode();
+
                 if (entry.isBackup()) {
                     //select a new backup node
                     backup = publishEntryInfo(key, msg.getValue());
+                } else if ( entry.isProxy() ) {
+                    //invalidate the previous primary
+                    msg = new MapMessage(mapContextName,MapMessage.MSG_PROXY,false,(Serializable)key,null,null,backup);
+                    channel.send(new Member[] {backup},msg);
                 }
+
                 entry.setBackupNode(backup);
                 entry.setBackup(false);
                 entry.setProxy(false);
                 entry.setValue(msg.getValue());
+                
+                
             } catch (ChannelException x) {
                 log.error("Unable to replicate out data for a LazyReplicatedMap.get operation",
x);
                 return null;
@@ -560,7 +568,6 @@
         } catch (ChannelException x) {
             log.error("Unable to replicate out data for a LazyReplicatedMap.put operation",
x);
         }
-        System.out.println("adding key="+key+" entry="+entry);
         super.put(key,entry);
         return old;
     }

Modified: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/RpcChannel.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/RpcChannel.java?rev=385675&r1=385674&r2=385675&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/RpcChannel.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/tipis/RpcChannel.java
Mon Mar 13 14:20:10 2006
@@ -97,7 +97,6 @@
     
     public void messageReceived(Serializable msg, Member sender) {
         RpcMessage rmsg = (RpcMessage)msg;
-System.out.println("Received RPC message with message:"+rmsg.message);        
         RpcCollectorKey key = new RpcCollectorKey(rmsg.uuid);
         if ( rmsg.reply ) {
             RpcCollector collector = (RpcCollector)responseMap.get(key);

Modified: tomcat/container/tc5.5.x/modules/groupcom/test/org/apache/catalina/tribes/demos/MapDemo.java
URL: http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/test/org/apache/catalina/tribes/demos/MapDemo.java?rev=385675&r1=385674&r2=385675&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/test/org/apache/catalina/tribes/demos/MapDemo.java
(original)
+++ tomcat/container/tc5.5.x/modules/groupcom/test/org/apache/catalina/tribes/demos/MapDemo.java
Mon Mar 13 14:20:10 2006
@@ -1,40 +1,30 @@
 package org.apache.catalina.tribes.demos;
 
 import java.io.Serializable;
+import java.util.Map;
 
-import org.apache.catalina.tribes.Member;
-import org.apache.catalina.tribes.tipis.RpcCallback;
-import org.apache.catalina.tribes.Channel;
-import org.apache.catalina.tribes.ManagedChannel;
-import org.apache.catalina.tribes.tipis.RpcChannel;
-import org.apache.catalina.tribes.tipis.Response;
-
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
+import java.awt.ComponentOrientation;
 import java.awt.Dimension;
-import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
+import javax.swing.BoxLayout;
 import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
 import javax.swing.JTextField;
-import java.awt.Panel;
-import javax.swing.BoxLayout;
-import java.awt.ComponentOrientation;
-import javax.swing.table.TableModel;
 import javax.swing.table.AbstractTableModel;
-import javax.swing.table.TableColumnModel;
-import javax.swing.table.DefaultTableColumnModel;
-import javax.swing.table.TableColumn;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import org.apache.catalina.tribes.tipis.LazyReplicatedMap;
-import org.apache.catalina.tribes.MessageListener;
+import javax.swing.table.TableModel;
+
+import org.apache.catalina.tribes.Channel;
 import org.apache.catalina.tribes.ChannelListener;
+import org.apache.catalina.tribes.ManagedChannel;
+import org.apache.catalina.tribes.Member;
 import org.apache.catalina.tribes.MembershipListener;
-import java.util.Map;
-import java.awt.BorderLayout;
+import org.apache.catalina.tribes.tipis.LazyReplicatedMap;
 
 /**
  * <p>Title: </p>
@@ -269,6 +259,11 @@
                 if ( buf!=null ) {
                     buf.delete(0,buf.length());
                     buf.append(txtChangeValue.getText());
+                    map.replicate(txtChangeKey.getText(),true);
+                } else {
+                    buf = new StringBuffer();
+                    buf.append(txtChangeValue.getText());
+                    map.put(txtChangeKey.getText(),buf);
                 }
             }
             if ( "remove".equals(e.getActionCommand()) ) {



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


Mime
View raw message