RE: [PATCH] Clustering members using UDP sockets instead of multicast ones

2004-01-27 Thread David Cassidy

Filip,

This is a very useful thing for those of us who have to contend with firewalls and 
multiple datacentres.
If it can't go into the main CVS area can we have a 'standard extentions' type area 
where things like
this can be kept with instructions on how to install ?

Thanks

David




   

  Filip Hanik

  [EMAIL PROTECTED]To:   Tomcat Developers List 
[EMAIL PROTECTED]  
  om  cc: 

   Subject:  RE: [PATCH] Clustering 
members using UDP sockets instead of multicast ones
  26/01/2004 23:30 

  Please respond to

  Tomcat  

  Developers List 

   

   





thanks for the patch, I am not submitting this to CVS as I don't see that
much added value. But if others find it useful, this is configurable anyway,
so there is nothing hard coded in the current code about the membership.
hope that is ok.
Filip

-Original Message-
From: Raul Benito [mailto:[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 11:25 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PATCH] Clustering members using UDP sockets instead of
multicast ones


Hi,
I'm testing the tomcat5 cluster in an environment where multicast
connections are filtered. So in order to test our implementation in a
cluster tomcat, i created this little UdpService that is heavily based
in McastService, but the cluster nodes are specified in an attribute as
comma delimited instead of been discover. It is not intended to be a
fast, it is only for testing. Perhaps somebody wants for something, and
keep doing this great work.

Regards,

Index: McastServiceImpl.java
===
RCS file:
/home/cvspublic/jakarta-tomcat-catalina/modules/cluster/src/share/or
g/apache/catalina/cluster/mcast/McastServiceImpl.java,v
retrieving revision 1.6
diff -u -r1.6 McastServiceImpl.java
--- McastServiceImpl.java   13 Jan 2004 00:07:18 -  1.6
+++ McastServiceImpl.java   26 Jan 2004 19:14:41 -
@@ -143,6 +143,11 @@
 protected long serviceStartTime = System.currentTimeMillis();

 /**
+ * void to do inheritance
+ **/
+protected McastServiceImpl() {}
+
+/**
  * Create a new mcast service impl
  * @param member - the local member
  * @param sendFrequency - the time (ms) in between pings sent out



--
New file
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalin
a/cluster/mcast/UdpServiceImpl.java

package org.apache.catalina.cluster.mcast;

import java.net.DatagramSocket;
import java.io.IOException;
import java.net.InetAddress ;
import java.net.DatagramPacket;
import org.apache.catalina.cluster.MembershipListener;
public class UdpServiceImpl extends McastServiceImpl
{
private static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog( UdpService.class );



/**
 * Socket that we intend to listen to
 */
protected DatagramSocket socket;



/**
 * The multicast address
 */
protected InetAddress[] address;
/**
 * The multicast port
 */
protected int[] port;



/**
 * Create a new mcast service impl
 * @param member - the local member
 * @param sendFrequency - the time (ms) in between pings sent out
 * @param expireTime - the time (ms) for a member to expire
 * @param port - the mcast port
 * @param bind - the bind address (not sure this is used yet

Re: [PATCH] Clustering members using UDP sockets instead of multicast ones

2004-01-27 Thread Filip Hanik
I agree with you. But instead of extending multicast service, I would create
a completely separate membership service. I am about to change how the
configuration file looks and at that point I would be more than happy to
have more than one supported configuration...so give me a couple of weeks.
In the meantime, why don't you just post it to the tomcat-user and who ever
wants it can use it.

Filip


- Original Message -
From: David Cassidy [EMAIL PROTECTED]
To: Tomcat Developers List [EMAIL PROTECTED]
Sent: Tuesday, January 27, 2004 12:22 AM
Subject: RE: [PATCH] Clustering members using UDP sockets instead of
multicast ones



 Filip,

 This is a very useful thing for those of us who have to contend with
firewalls and multiple datacentres.
 If it can't go into the main CVS area can we have a 'standard extentions'
type area where things like
 this can be kept with instructions on how to install ?

 Thanks

 David





   Filip Hanik
   [EMAIL PROTECTED]To:   Tomcat
Developers List [EMAIL PROTECTED]
   om  cc:
Subject:  RE: [PATCH]
Clustering members using UDP sockets instead of multicast ones
   26/01/2004 23:30
   Please respond to
   Tomcat
   Developers List






 thanks for the patch, I am not submitting this to CVS as I don't see that
 much added value. But if others find it useful, this is configurable
anyway,
 so there is nothing hard coded in the current code about the membership.
 hope that is ok.
 Filip

 -Original Message-
 From: Raul Benito [mailto:[EMAIL PROTECTED]
 Sent: Monday, January 26, 2004 11:25 AM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: [PATCH] Clustering members using UDP sockets instead of
 multicast ones


 Hi,
 I'm testing the tomcat5 cluster in an environment where multicast
 connections are filtered. So in order to test our implementation in a
 cluster tomcat, i created this little UdpService that is heavily based
 in McastService, but the cluster nodes are specified in an attribute as
 comma delimited instead of been discover. It is not intended to be a
 fast, it is only for testing. Perhaps somebody wants for something, and
 keep doing this great work.

 Regards,

 Index: McastServiceImpl.java
 ===
 RCS file:
 /home/cvspublic/jakarta-tomcat-catalina/modules/cluster/src/share/or
 g/apache/catalina/cluster/mcast/McastServiceImpl.java,v
 retrieving revision 1.6
 diff -u -r1.6 McastServiceImpl.java
 --- McastServiceImpl.java   13 Jan 2004 00:07:18 -  1.6
 +++ McastServiceImpl.java   26 Jan 2004 19:14:41 -
 @@ -143,6 +143,11 @@
  protected long serviceStartTime = System.currentTimeMillis();

  /**
 + * void to do inheritance
 + **/
 +protected McastServiceImpl() {}
 +
 +/**
   * Create a new mcast service impl
   * @param member - the local member
   * @param sendFrequency - the time (ms) in between pings sent out



 --
 New file
 jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalin
 a/cluster/mcast/UdpServiceImpl.java

 package org.apache.catalina.cluster.mcast;

 import java.net.DatagramSocket;
 import java.io.IOException;
 import java.net.InetAddress ;
 import java.net.DatagramPacket;
 import org.apache.catalina.cluster.MembershipListener;
 public class UdpServiceImpl extends McastServiceImpl
 {
 private static org.apache.commons.logging.Log log =
 org.apache.commons.logging.LogFactory.getLog( UdpService.class );



 /**
  * Socket that we intend to listen to
  */
 protected DatagramSocket socket;



 /**
  * The multicast address
  */
 protected InetAddress[] address;
 /**
  * The multicast port
  */
 protected int[] port;



 /**
  * Create a new mcast service impl
  * @param member - the local member
  * @param sendFrequency - the time (ms) in between pings sent out
  * @param expireTime - the time (ms) for a member to expire
  * @param port - the mcast port
  * @param bind - the bind address (not sure this is used yet)
  * @param mcastAddress - the mcast address
  * @param service - the callback service
  * @throws IOException
  */
 public UdpServiceImpl(
 long sendFrequency,
 long expireTime,
 int port,
 int[] ports,
 InetAddress bind,
 InetAddress[] mcastAddress,
 MembershipListener service)
 throws IOException {
 System.out.println(HOLA0);



 if ( bind != null) socket = new DatagramSocket(new
 java.net.InetSocketAddress(bind,port));
 else socket = new DatagramSocket(port);
 this.member = member;
 address = mcastAddress;
 this.port

RE: [PATCH] Clustering members using UDP sockets instead of multicast ones

2004-01-26 Thread Filip Hanik
thanks for the patch, I am not submitting this to CVS as I don't see that
much added value. But if others find it useful, this is configurable anyway,
so there is nothing hard coded in the current code about the membership.
hope that is ok.
Filip

-Original Message-
From: Raul Benito [mailto:[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 11:25 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PATCH] Clustering members using UDP sockets instead of
multicast ones


Hi,
I'm testing the tomcat5 cluster in an environment where multicast
connections are filtered. So in order to test our implementation in a
cluster tomcat, i created this little UdpService that is heavily based
in McastService, but the cluster nodes are specified in an attribute as
comma delimited instead of been discover. It is not intended to be a
fast, it is only for testing. Perhaps somebody wants for something, and
keep doing this great work.

Regards,

Index: McastServiceImpl.java
===
RCS file:
/home/cvspublic/jakarta-tomcat-catalina/modules/cluster/src/share/or
g/apache/catalina/cluster/mcast/McastServiceImpl.java,v
retrieving revision 1.6
diff -u -r1.6 McastServiceImpl.java
--- McastServiceImpl.java   13 Jan 2004 00:07:18 -  1.6
+++ McastServiceImpl.java   26 Jan 2004 19:14:41 -
@@ -143,6 +143,11 @@
 protected long serviceStartTime = System.currentTimeMillis();

 /**
+ * void to do inheritance
+ **/
+protected McastServiceImpl() {}
+
+/**
  * Create a new mcast service impl
  * @param member - the local member
  * @param sendFrequency - the time (ms) in between pings sent out



--
New file
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalin
a/cluster/mcast/UdpServiceImpl.java

package org.apache.catalina.cluster.mcast;

import java.net.DatagramSocket;
import java.io.IOException;
import java.net.InetAddress ;
import java.net.DatagramPacket;
import org.apache.catalina.cluster.MembershipListener;
public class UdpServiceImpl extends McastServiceImpl
{
private static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog( UdpService.class );



/**
 * Socket that we intend to listen to
 */
protected DatagramSocket socket;



/**
 * The multicast address
 */
protected InetAddress[] address;
/**
 * The multicast port
 */
protected int[] port;



/**
 * Create a new mcast service impl
 * @param member - the local member
 * @param sendFrequency - the time (ms) in between pings sent out
 * @param expireTime - the time (ms) for a member to expire
 * @param port - the mcast port
 * @param bind - the bind address (not sure this is used yet)
 * @param mcastAddress - the mcast address
 * @param service - the callback service
 * @throws IOException
 */
public UdpServiceImpl(
McastMember member,
long sendFrequency,
long expireTime,
int port,
int[] ports,
InetAddress bind,
InetAddress[] mcastAddress,
MembershipListener service)
throws IOException {
System.out.println(HOLA0);



if ( bind != null) socket = new DatagramSocket(new
java.net.InetSocketAddress(bind,port));
else socket = new DatagramSocket(port);
this.member = member;
address = mcastAddress;
this.port = ports;
receivePacket = new DatagramPacket(new byte[1000],1000);
//receivePacket.setAddress(address);
receivePacket.setPort(port);
membership = new McastMembership(member.getName());
timeToExpiration = expireTime;
this.service = service;
this.sendFrequency = sendFrequency;
}







/**
 * Send a ping
 * @throws Exception
 */
public void send() throws Exception{
member.inc();
byte[] data = member.getData(this.serviceStartTime);
for (int i=0;iaddress.length;i++) {
DatagramPacket p = new DatagramPacket(data,data.length);
p.setAddress(address[i]);
p.setPort(port[i]);
socket.send(p);
}
}



}
--
New file
jakarta-tomcat-catalina/modules/cluster/src/share/org/apache/catalin
a/cluster/mcast/UdpService.java

package org.apache.catalina.cluster.mcast;

import org.apache.catalina.cluster.MembershipService;
import java.util.Properties;
import org.apache.catalina.cluster.Member;
import org.apache.catalina.cluster.MembershipListener;
import java.util.Properties;

public class UdpService extends McastService {



private static org.apache.commons.logging.Log log =
org.apache.commons.logging.LogFactory.getLog( UdpService.class );






/**
 * Start broadcasting and listening to membership pings
 * @throws