org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor Java Examples

The following examples show how to use org.apache.catalina.tribes.group.interceptors.MessageDispatchInterceptor. 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: 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 #3
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 #4
Source File: GroupChannel.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Sets up the default implementation interceptor stack
 * if no interceptors have been added
 * @throws ChannelException Cluster error
 */
protected synchronized void setupDefaultStack() throws ChannelException {
    if (getFirstInterceptor() != null &&
            ((getFirstInterceptor().getNext() instanceof ChannelCoordinator))) {
        addInterceptor(new MessageDispatchInterceptor());
    }
    Iterator<ChannelInterceptor> interceptors = getInterceptors();
    while (interceptors.hasNext()) {
        ChannelInterceptor channelInterceptor = interceptors.next();
        channelInterceptor.setChannel(this);
    }
    coordinator.setChannel(this);
}
 
Example #5
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);
}