org.apache.catalina.tribes.transport.ReceiverBase Java Examples
The following examples show how to use
org.apache.catalina.tribes.transport.ReceiverBase.
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 |
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 |
@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 |
@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: CoordinationDemo.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
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 #5
Source File: TestMulticastPackages.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@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 #6
Source File: TestUdpPackages.java From Tomcat7.0.67 with Apache License 2.0 | 6 votes |
@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 #7
Source File: CoordinationDemo.java From tomcatsrc with Apache License 2.0 | 6 votes |
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 #8
Source File: TestMulticastPackages.java From tomcatsrc with Apache License 2.0 | 6 votes |
@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: TestUdpPackages.java From tomcatsrc with Apache License 2.0 | 6 votes |
@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 #10
Source File: TestGroupChannelStartStop.java From Tomcat8-Source-Read with MIT License | 5 votes |
@Test public void testUdpReceiverStart() throws Exception { ReceiverBase rb = (ReceiverBase)channel.getChannelReceiver(); rb.setUdpPort(udpPort); channel.start(Channel.DEFAULT); Thread.sleep(1000); channel.stop(Channel.DEFAULT); }
Example #11
Source File: TestGroupChannelStartStop.java From Tomcat7.0.67 with Apache License 2.0 | 5 votes |
@Test public void testUdpReceiverStart() throws Exception { ReceiverBase rb = (ReceiverBase)channel.getChannelReceiver(); rb.setUdpPort(udpPort); channel.start(Channel.DEFAULT); Thread.sleep(1000); channel.stop(Channel.DEFAULT); }
Example #12
Source File: TestGroupChannelStartStop.java From tomcatsrc with Apache License 2.0 | 5 votes |
@Test public void testUdpReceiverStart() throws Exception { ReceiverBase rb = (ReceiverBase)channel.getChannelReceiver(); rb.setUdpPort(udpPort); channel.start(Channel.DEFAULT); Thread.sleep(1000); channel.stop(Channel.DEFAULT); }
Example #13
Source File: TestGroupChannelStartStop.java From Tomcat8-Source-Read with MIT License | 4 votes |
@Test public void testScrap() throws Exception { System.out.println(channel.getChannelReceiver().getClass()); ((ReceiverBase)channel.getChannelReceiver()).setMaxThreads(1); }
Example #14
Source File: TestGroupChannelStartStop.java From Tomcat7.0.67 with Apache License 2.0 | 4 votes |
@Test public void testScrap() throws Exception { System.out.println(channel.getChannelReceiver().getClass()); ((ReceiverBase)channel.getChannelReceiver()).setMaxThreads(1); }
Example #15
Source File: ChannelCoordinator.java From tomcatsrc with Apache License 2.0 | 4 votes |
/** * Starts up the channel. This can be called multiple times for individual services to start * The svc parameter can be the logical or value of any constants * @param svc int value of <BR> * DEFAULT - will start all services <BR> * MBR_RX_SEQ - starts the membership receiver <BR> * MBR_TX_SEQ - starts the membership broadcaster <BR> * SND_TX_SEQ - starts the replication transmitter<BR> * SND_RX_SEQ - starts the replication receiver<BR> * @throws ChannelException if a startup error occurs or the service is already started. */ protected synchronized void internalStart(int svc) throws ChannelException { try { boolean valid = false; //make sure we don't pass down any flags that are unrelated to the bottom layer svc = svc & Channel.DEFAULT; if (startLevel == Channel.DEFAULT) return; //we have already started up all components if (svc == 0 ) return;//nothing to start if (svc == (svc & startLevel)) throw new ChannelException("Channel already started for level:"+svc); //must start the receiver first so that we can coordinate the port it //listens to with the local membership settings if ( Channel.SND_RX_SEQ==(svc & Channel.SND_RX_SEQ) ) { clusterReceiver.setMessageListener(this); if (clusterReceiver instanceof ReceiverBase) { ((ReceiverBase)clusterReceiver).setChannel(getChannel()); } clusterReceiver.start(); //synchronize, big time FIXME Member localMember = getChannel().getLocalMember(false); if (localMember instanceof StaticMember) { // static member StaticMember staticMember = (StaticMember)localMember; staticMember.setHost(getClusterReceiver().getHost()); staticMember.setPort(getClusterReceiver().getPort()); staticMember.setSecurePort(getClusterReceiver().getSecurePort()); } else { // multicast member membershipService.setLocalMemberProperties(getClusterReceiver().getHost(), getClusterReceiver().getPort(), getClusterReceiver().getSecurePort(), getClusterReceiver().getUdpPort()); } valid = true; } if ( Channel.SND_TX_SEQ==(svc & Channel.SND_TX_SEQ) ) { if (clusterSender instanceof ReplicationTransmitter) { ((ReplicationTransmitter)clusterSender).setChannel(getChannel()); } valid = true; clusterSender.start(); } if ( Channel.MBR_RX_SEQ==(svc & Channel.MBR_RX_SEQ) ) { membershipService.setMembershipListener(this); if (membershipService instanceof McastService) { ((McastService)membershipService).setMessageListener(this); ((McastService)membershipService).setChannel(getChannel()); } membershipService.start(MembershipService.MBR_RX); valid = true; } if ( Channel.MBR_TX_SEQ==(svc & Channel.MBR_TX_SEQ) ) { if (membershipService instanceof McastService) { ((McastService)membershipService).setChannel(getChannel()); } membershipService.start(MembershipService.MBR_TX); valid = true; } if ( !valid) { throw new IllegalArgumentException("Invalid start level, valid levels are:SND_RX_SEQ,SND_TX_SEQ,MBR_TX_SEQ,MBR_RX_SEQ"); } startLevel = (startLevel | svc); }catch ( ChannelException cx ) { throw cx; }catch ( Exception x ) { throw new ChannelException(x); } }
Example #16
Source File: TestGroupChannelStartStop.java From tomcatsrc with Apache License 2.0 | 4 votes |
@Test public void testScrap() throws Exception { System.out.println(channel.getChannelReceiver().getClass()); ((ReceiverBase)channel.getChannelReceiver()).setMaxThreads(1); }