Java Code Examples for org.apache.catalina.tribes.group.GroupChannel#addInterceptor()

The following examples show how to use org.apache.catalina.tribes.group.GroupChannel#addInterceptor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CoordinationDemo.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
public GroupChannel createChannel() {
    channel = new GroupChannel();
    ((ReceiverBase)channel.getChannelReceiver()).setAutoBind(100);
    interceptor = new NonBlockingCoordinator() {
        @Override
        public void fireInterceptorEvent(InterceptorEvent event) {
            status = event.getEventTypeDesc();
            int type = event.getEventType();
            boolean display = VIEW_EVENTS[type];
            if ( display ) parent.printScreen();
            try { Thread.sleep(SLEEP_TIME); }catch ( Exception x){
                // Ignore
            }
        }
    };
    channel.addInterceptor(interceptor);
    channel.addInterceptor(new TcpFailureDetector());
    channel.addInterceptor(new MessageDispatchInterceptor());
    return channel;
}
 
Example 2
Source File: TestTcpFailureDetector.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@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});
}
 
Example 3
Source File: TestMulticastPackages.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatchInterceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatchInterceptor());
    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);
}
 
Example 4
Source File: TestUdpPackages.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatchInterceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatchInterceptor());
    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);
}
 
Example 5
Source File: CoordinationDemo.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
public GroupChannel createChannel() {
    channel = new GroupChannel();
    ((ReceiverBase)channel.getChannelReceiver()).setAutoBind(100);
    interceptor = new NonBlockingCoordinator() {
        @Override
        public void fireInterceptorEvent(InterceptorEvent event) {
            status = event.getEventTypeDesc();
            int type = event.getEventType();
            boolean display = VIEW_EVENTS[type];
            if ( display ) parent.printScreen();
            try { Thread.sleep(SLEEP_TIME); }catch ( Exception x){
                // Ignore
            }
        }
    };
    channel.addInterceptor(interceptor);
    channel.addInterceptor(new TcpFailureDetector());
    channel.addInterceptor(new MessageDispatch15Interceptor());
    return channel;
}
 
Example 6
Source File: TestTcpFailureDetector.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@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});
}
 
Example 7
Source File: TestMulticastPackages.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 8
Source File: TestUdpPackages.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 9
Source File: CoordinationDemo.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
public GroupChannel createChannel() {
    channel = new GroupChannel();
    ((ReceiverBase)channel.getChannelReceiver()).setAutoBind(100);
    interceptor = new NonBlockingCoordinator() {
        @Override
        public void fireInterceptorEvent(InterceptorEvent event) {
            status = event.getEventTypeDesc();
            int type = event.getEventType();
            boolean display = VIEW_EVENTS[type];
            if ( display ) parent.printScreen();
            try { Thread.sleep(SLEEP_TIME); }catch ( Exception x){
                // Ignore
            }
        }
    };
    channel.addInterceptor(interceptor);
    channel.addInterceptor(new TcpFailureDetector());
    channel.addInterceptor(new MessageDispatch15Interceptor());
    return channel;
}
 
Example 10
Source File: TestTcpFailureDetector.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@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});
}
 
Example 11
Source File: TestMulticastPackages.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 12
Source File: TestUdpPackages.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 13
Source File: TestDataIntegrity.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatchInterceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatchInterceptor());
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example 14
Source File: TestDataIntegrity.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
Example 15
Source File: TestDataIntegrity.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    listener1 = new Listener();
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}