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 -0000      1.6
> +++ McastServiceImpl.java       26 Jan 2004 19:14:41 -0000
> @@ -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 = 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{
>         byte[] data = member.getData(this.serviceStartTime);
>         for (int i=0;i<address.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 java.lang.Exception if a IO error occurs
>      */
>     public void start() throws java.lang.Exception {
>         if ( impl != null ) return;
>         String host = getProperties().getProperty("tcpListenHost");
>         int port =
> Integer.parseInt(getProperties().getProperty("tcpListenPort"));
>         String name = "tcp://"+host+":"+port;
>         localMember = new McastMember(name,host,port,100);
>         java.net.InetAddress bind = null;
>         if ( properties.getProperty("mcastBindAddress")!= null ) {
>             bind =
>
java.net.InetAddress.getByName(properties.getProperty("mcastBindAddress"));
>         }
>
>
>
>         String listAdr=properties.getProperty("mcastAddress");
>         String[] addrs=listAdr.split(",");
>         java.net.InetAddress[] addr= new
java.net.InetAddress[addrs.length];
>         int[] ports=new int[addrs.length];
>         for (int i=0;i<addrs.length;i++) {
>             ports[i]=Integer.parseInt(addrs[i].split(":")[1]);
>
addr[i]=java.net.InetAddress.getByName(addrs[i].split(":")[0]);
>
>
>
>         }
>
>
>
>         impl = new UdpServiceImpl((McastMember)localMember,
>
> Long.parseLong(properties.getProperty("msgFrequency")),
>
> Long.parseLong(properties.getProperty("memberDropTime")),
>                                     port,
>                                     ports,
>                                     bind,
>                                     addr,
>                                     this);
>
>
>
>         impl.start();
>     }
>
>
>
>     /**
>      * Simple test program
>      * @param args
>      * @throws Exception
>      */
>     public static void main(String args[]) throws Exception {
>         System.out.println("Usage McastService hostname tcpport");
>         UdpService service = new UdpService();
>         java.util.Properties p = new java.util.Properties();
>         p.setProperty("mcastPort","5555");
>
> p.setProperty("mcastAddress","127.0.0.1:4000,127.0.0.1:40001,127.0.0
> .1:40002");
>         p.setProperty("bindAddress","localhost");
>         p.setProperty("memberDropTime","3000");
>         p.setProperty("msgFrequency","500");
>         p.setProperty("tcpListenPort",args[1]);
>         p.setProperty("tcpListenHost",args[0]);
>         service.setProperties(p);
>         service.start();
>         Thread.currentThread().sleep(60*1000*60);
>     }
> }
> ------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>
> --
>
> This e-mail may contain confidential and/or privileged information. If you
are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail. Any
unauthorized copying, disclosure or distribution of the material in this
e-mail is strictly forbidden.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


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

Reply via email to