tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: Does Tomcat replicate in-memory replication of data other than Sessions ?
Date Fri, 28 Sep 2007 13:14:02 GMT
very doable, you can piggy back on Tribes if you have clustering enabled

import org.apache.catalina.ServerFactory;
import org.apache.catalina.Cluster;
import org.apache.catalina.ha.tcp.SimpleTcpCluster;
import org.apache.catalina.tribes.Channel;
import org.apache.catalina.tribes.Member;

   public static void sendMessage(byte[] somedata) throws Exception {
       Cluster cl = 
ServerFactory.getServer().findService("nameofservice").getContainer().findChild("nameofengine").getCluster();


       if (cl!=null && cl instanceof SimpleTcpCluster) {
           SimpleTcpCluster cluster = (SimpleTcpCluster)cl;
           Channel channel = cluster.getChannel();
           Member[] nodes = channel.getMembers();
           if (nodes!=null && nodes.length>0) 
channel.send(nodes,somedata,0);
       }
   }

please note, that you must correct "nameofservice" and "nameofengine" 
with the names of these containers that you have defined in server.xml

Filip


Mamta, Jain wrote:
> Hello there,
>  
> I would like to know if Tomcat 6 offers in-memory replication of data
> other than Sessions data alone. 
>  
> Actually we have a requirement of replicating the data an application in
> Multicast cluster caches. The data has to be replicated to other nodes
> in the cluster. Would like to know :
> 1. If this is this possible - replicate data to other nodes in cluster
> where the data is not session data alone
> 2. If yes, can it be achieved with configuration of Tomcat multicast
> cluster or by extending classes of Catalina/Tribes ?
>  
> Your reply will be greatly appreciated ! Thank You .
>  
> Best Regards,
> Mamta
> Technical Lead | Enterprise Solutions, GF, ISCI | Haddows Road, Asia,
> III flr
>  
> This email is confidential. If you are not the addressee tell the sender immediately
and destroy this email
> without using, sending or storing it. Emails are not secure and may suffer errors, viruses,
delay,
> interception and amendment. Standard Chartered PLC and subsidiaries ("SCGroup") do not
accept liability for
> damage caused by this email and may monitor email traffic.
>
>
>   
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.488 / Virus Database: 269.13.33/1034 - Release Date: 9/27/2007 5:00 PM
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message