tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp AsyncSocketSender.java IDataSender.java ReplicationTransmitter.java SocketSender.java
Date Wed, 15 Oct 2003 03:21:04 GMT
fhanik      2003/10/14 20:21:04

  Modified:    modules/cluster/src/share/org/apache/catalina/cluster/tcp
                        AsyncSocketSender.java IDataSender.java
                        ReplicationTransmitter.java SocketSender.java
  Log:
  added in the suspect feature to avoid to much error printing
  
  Revision  Changes    Path
  1.2       +15 -3     jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java
  
  Index: AsyncSocketSender.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/AsyncSocketSender.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AsyncSocketSender.java	18 Apr 2003 02:51:24 -0000	1.1
  +++ AsyncSocketSender.java	15 Oct 2003 03:21:04 -0000	1.2
  @@ -73,6 +73,7 @@
       private Socket sc = null;
       private boolean isSocketConnected = false;
       private SmartQueue queue = new SmartQueue();
  +    private boolean suspect;
       
       public AsyncSocketSender(InetAddress host, int port)  {
           this.address = host;
  @@ -137,6 +138,17 @@
           StringBuffer buf = new StringBuffer("SocketSender[");
           buf.append(getAddress()).append(":").append(getPort()).append("]");
           return buf.toString();
  +    }
  +    public boolean isSuspect() {
  +        return suspect;
  +    }
  +    
  +    public boolean getSuspect() {
  +        return suspect;
  +    }
  +    
  +    public void setSuspect(boolean suspect) {
  +        this.suspect = suspect;
       }
       
       private class QueueThread extends Thread {
  
  
  
  1.3       +5 -3      jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/IDataSender.java
  
  Index: IDataSender.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/IDataSender.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- IDataSender.java	18 Apr 2003 02:51:24 -0000	1.2
  +++ IDataSender.java	15 Oct 2003 03:21:04 -0000	1.3
  @@ -80,4 +80,6 @@
       public void disconnect();
       public void sendMessage(String sessionId, byte[] data) throws java.io.IOException;
       public boolean isConnected();
  +    public void setSuspect(boolean suspect);
  +    public boolean getSuspect();
   }
  
  
  
  1.6       +11 -8     jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java
  
  Index: ReplicationTransmitter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/ReplicationTransmitter.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ReplicationTransmitter.java	18 Apr 2003 02:51:24 -0000	1.5
  +++ ReplicationTransmitter.java	15 Oct 2003 03:21:04 -0000	1.6
  @@ -147,18 +147,21 @@
   
       public void sendMessage(String sessionId, byte[] indata) throws java.io.IOException
       {
  -        java.util.Iterator i = map.entrySet().iterator();
  -        java.util.Vector v = new java.util.Vector();
  +         IDataSender[] senders = getSenders();
           byte[] data = XByteBuffer.createDataPackage(indata);
  -        while ( i.hasNext() )
  +        for ( int i=0; i<senders.length; i++ )
           {
  -            IDataSender sender = (IDataSender)((java.util.Map.Entry)i.next()).getValue();
  +
  +            IDataSender sender = senders[i];
               try
               {
                   sendMessageData(sessionId,data,sender);
  +                sender.setSuspect(false);
               }catch ( Exception x)
               {
  -                log.warn("Unable to send replicated message to "+sender+", is server down?",x);
  +
  +                if ( !sender.getSuspect()) log.warn("Unable to send replicated message
to "+sender+", is server down?",x);
  +                sender.setSuspect(true);
               }
           }//while
       }
  
  
  
  1.3       +15 -3     jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketSender.java
  
  Index: SocketSender.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalina/cluster/tcp/SocketSender.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SocketSender.java	18 Apr 2003 02:51:24 -0000	1.2
  +++ SocketSender.java	15 Oct 2003 03:21:04 -0000	1.3
  @@ -81,6 +81,7 @@
       private int port;
       private Socket sc = null;
       private boolean isSocketConnected = false;
  +    private boolean suspect;
   
       public SocketSender(InetAddress host, int port)
       {
  @@ -143,6 +144,17 @@
           StringBuffer buf = new StringBuffer("SocketSender[");
           buf.append(getAddress()).append(":").append(getPort()).append("]");
           return buf.toString();
  +    }
  +    public boolean isSuspect() {
  +        return suspect;
  +    }
  +    
  +    public boolean getSuspect() {
  +        return suspect;
  +    }
  +    
  +    public void setSuspect(boolean suspect) {
  +        this.suspect = suspect;
       }
   
   
  
  
  

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


Mime
View raw message