Search in sources :

Example 6 with GroupChannel

use of org.apache.catalina.tribes.group.GroupChannel in project tomcat70 by apache.

the class TestTcpFailureDetector method setUp.

@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel2 = new GroupChannel();
    channel1.getMembershipService().setPayload("Channel-1".getBytes("ASCII"));
    channel2.getMembershipService().setPayload("Channel-2".getBytes("ASCII"));
    mbrlist1 = new TestMbrListener("Channel-1");
    mbrlist2 = new TestMbrListener("Channel-2");
    tcpFailureDetector1 = new TcpFailureDetector();
    tcpFailureDetector2 = new TcpFailureDetector();
    channel1.addInterceptor(tcpFailureDetector1);
    channel2.addInterceptor(tcpFailureDetector2);
    channel1.addMembershipListener(mbrlist1);
    channel2.addMembershipListener(mbrlist2);
    TesterUtil.addRandomDomain(new ManagedChannel[] { channel1, channel2 });
}
Also used : GroupChannel(org.apache.catalina.tribes.group.GroupChannel) Before(org.junit.Before)

Example 7 with GroupChannel

use of org.apache.catalina.tribes.group.GroupChannel in project tomcat70 by apache.

the class TestMulticastPackages method setUp.

@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    // channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase) channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase) channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] { channel1, channel2 });
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
Also used : ReceiverBase(org.apache.catalina.tribes.transport.ReceiverBase) ChannelListener(org.apache.catalina.tribes.ChannelListener) GroupChannel(org.apache.catalina.tribes.group.GroupChannel) MessageDispatch15Interceptor(org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor) ThroughputInterceptor(org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor) Before(org.junit.Before)

Example 8 with GroupChannel

use of org.apache.catalina.tribes.group.GroupChannel in project tomcat70 by apache.

the class TestRemoteProcessException method setUp.

@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel2 = new GroupChannel();
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] { channel1, channel2 });
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
Also used : ChannelListener(org.apache.catalina.tribes.ChannelListener) GroupChannel(org.apache.catalina.tribes.group.GroupChannel) Before(org.junit.Before)

Example 9 with GroupChannel

use of org.apache.catalina.tribes.group.GroupChannel in project tomcat70 by apache.

the class TestUdpPackages method setUp.

@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    // channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase) channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase) channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] { channel1, channel2 });
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
Also used : ReceiverBase(org.apache.catalina.tribes.transport.ReceiverBase) ChannelListener(org.apache.catalina.tribes.ChannelListener) GroupChannel(org.apache.catalina.tribes.group.GroupChannel) MessageDispatch15Interceptor(org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor) ThroughputInterceptor(org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor) Before(org.junit.Before)

Example 10 with GroupChannel

use of org.apache.catalina.tribes.group.GroupChannel in project cas by apereo.

the class CasTomcatServletWebServerFactory method configureSessionClustering.

private void configureSessionClustering(final Tomcat tomcat) {
    val clusteringProperties = casProperties.getServer().getTomcat().getClustering();
    if (!clusteringProperties.isEnabled()) {
        LOGGER.trace("Tomcat session clustering/replication is turned off");
        return;
    }
    val cluster = new SimpleTcpCluster();
    val groupChannel = new GroupChannel();
    val receiver = new NioReceiver();
    receiver.setPort(clusteringProperties.getReceiverPort());
    receiver.setTimeout(clusteringProperties.getReceiverTimeout());
    receiver.setMaxThreads(clusteringProperties.getReceiverMaxThreads());
    receiver.setAddress(clusteringProperties.getReceiverAddress());
    receiver.setAutoBind(clusteringProperties.getReceiverAutoBind());
    groupChannel.setChannelReceiver(receiver);
    val sender = new ReplicationTransmitter();
    sender.setTransport(new PooledParallelSender());
    groupChannel.setChannelSender(sender);
    groupChannel.addInterceptor(new TcpPingInterceptor());
    groupChannel.addInterceptor(new TcpFailureDetector());
    groupChannel.addInterceptor(new MessageDispatchInterceptor());
    cluster.setChannelSendOptions(clusteringProperties.getChannelSendOptions());
    val manager = getClusteringManagerInstance();
    cluster.setManagerTemplate(manager);
    cluster.addValve(new ReplicationValve());
    cluster.addValve(new JvmRouteBinderValve());
    cluster.addClusterListener(new ClusterSessionListener());
    if ("CLOUD".equalsIgnoreCase(clusteringProperties.getClusteringType())) {
        val membershipService = new CloudMembershipService();
        membershipService.setMembershipProviderClassName(clusteringProperties.getCloudMembershipProvider());
        groupChannel.setMembershipService(membershipService);
        LOGGER.trace("Tomcat session clustering/replication configured using cloud membership provider [{}]", clusteringProperties.getCloudMembershipProvider());
    } else {
        val membershipService = new McastService();
        membershipService.setPort(clusteringProperties.getMembershipPort());
        membershipService.setAddress(clusteringProperties.getMembershipAddress());
        membershipService.setFrequency(clusteringProperties.getMembershipFrequency());
        membershipService.setDropTime(clusteringProperties.getMembershipDropTime());
        membershipService.setRecoveryEnabled(clusteringProperties.isMembershipRecoveryEnabled());
        membershipService.setRecoveryCounter(clusteringProperties.getMembershipRecoveryCounter());
        membershipService.setLocalLoopbackDisabled(clusteringProperties.isMembershipLocalLoopbackDisabled());
        groupChannel.setMembershipService(membershipService);
        val clusterMembers = clusteringProperties.getClusterMembers();
        if (StringUtils.isNotBlank(clusterMembers)) {
            val membership = new StaticMembershipInterceptor();
            val memberSpecs = clusterMembers.split(",", -1);
            for (val spec : memberSpecs) {
                val memberDesc = new ClusterMemberDesc(spec);
                val member = new StaticMember();
                member.setHost(memberDesc.getAddress());
                member.setPort(memberDesc.getPort());
                member.setDomain("CAS");
                member.setUniqueId(memberDesc.getUniqueId());
                membership.addStaticMember(member);
                groupChannel.addInterceptor(membership);
            }
        }
    }
    cluster.setChannel(groupChannel);
    tomcat.getEngine().setCluster(cluster);
}
Also used : lombok.val(lombok.val) NioReceiver(org.apache.catalina.tribes.transport.nio.NioReceiver) MessageDispatchInterceptor(org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor) JvmRouteBinderValve(org.apache.catalina.ha.session.JvmRouteBinderValve) StaticMembershipInterceptor(org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor) GroupChannel(org.apache.catalina.tribes.group.GroupChannel) TcpFailureDetector(org.apache.catalina.tribes.group.interceptors.TcpFailureDetector) ReplicationTransmitter(org.apache.catalina.tribes.transport.ReplicationTransmitter) ReplicationValve(org.apache.catalina.ha.tcp.ReplicationValve) StaticMember(org.apache.catalina.tribes.membership.StaticMember) SimpleTcpCluster(org.apache.catalina.ha.tcp.SimpleTcpCluster) PooledParallelSender(org.apache.catalina.tribes.transport.nio.PooledParallelSender) TcpPingInterceptor(org.apache.catalina.tribes.group.interceptors.TcpPingInterceptor) ClusterSessionListener(org.apache.catalina.ha.session.ClusterSessionListener) CloudMembershipService(org.apache.catalina.tribes.membership.cloud.CloudMembershipService) McastService(org.apache.catalina.tribes.membership.McastService)

Aggregations

GroupChannel (org.apache.catalina.tribes.group.GroupChannel)28 Before (org.junit.Before)16 ReceiverBase (org.apache.catalina.tribes.transport.ReceiverBase)9 ChannelListener (org.apache.catalina.tribes.ChannelListener)8 MessageDispatchInterceptor (org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor)8 TcpFailureDetector (org.apache.catalina.tribes.group.interceptors.TcpFailureDetector)6 ThroughputInterceptor (org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor)6 MessageDispatch15Interceptor (org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor)5 McastService (org.apache.catalina.tribes.membership.McastService)5 ClusterSessionListener (org.apache.catalina.ha.session.ClusterSessionListener)4 JvmRouteBinderValve (org.apache.catalina.ha.session.JvmRouteBinderValve)4 SimpleTcpCluster (org.apache.catalina.ha.tcp.SimpleTcpCluster)4 Member (org.apache.catalina.tribes.Member)4 StaticMembershipInterceptor (org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor)4 ReplicationTransmitter (org.apache.catalina.tribes.transport.ReplicationTransmitter)4 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Properties (java.util.Properties)2 lombok.val (lombok.val)2 DeltaManager (org.apache.catalina.ha.session.DeltaManager)2