use of org.apache.catalina.tribes.group.GroupChannel in project tomcat by apache.
the class TestDomainFilterInterceptor method setUp.
@Before
public void setUp() throws Exception {
for (int i = 0; i < channels.length; i++) {
channels[i] = new GroupChannel();
channels[i].getMembershipService().setPayload(("Channel-" + (i + 1)).getBytes("ASCII"));
listeners[i] = new TestMbrListener(("Listener-" + (i + 1)));
channels[i].addMembershipListener(listeners[i]);
DomainFilterInterceptor filter = new DomainFilterInterceptor();
filter.setDomain(UUIDGenerator.randomUUID(false));
channels[i].addInterceptor(filter);
}
}
use of org.apache.catalina.tribes.group.GroupChannel in project tomcat by apache.
the class TestTcpFailureDetector method setUp.
@Before
public void setUp() throws Exception {
channel1 = new GroupChannel();
channel2 = new GroupChannel();
((ReceiverBase) channel1.getChannelReceiver()).setHost("localhost");
((ReceiverBase) channel2.getChannelReceiver()).setHost("localhost");
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 });
}
use of org.apache.catalina.tribes.group.GroupChannel in project tomcat70 by apache.
the class NioReceiver method start.
/**
* start cluster receiver
* @throws IOException
* @see org.apache.catalina.tribes.ChannelReceiver#start()
*/
@Override
public void start() throws IOException {
super.start();
try {
setPool(new RxTaskPool(getMaxThreads(), getMinThreads(), this));
} catch (Exception x) {
log.fatal("ThreadPool can initilzed. Listener not started", x);
if (x instanceof IOException)
throw (IOException) x;
else
throw new IOException(x.getMessage());
}
try {
getBind();
bind();
String channelName = "";
if (getChannel() instanceof GroupChannel && ((GroupChannel) getChannel()).getName() != null) {
channelName = "[" + ((GroupChannel) getChannel()).getName() + "]";
}
Thread t = new Thread(this, "NioReceiver" + channelName);
t.setDaemon(true);
t.start();
} catch (Exception x) {
log.fatal("Unable to start cluster receiver", x);
if (x instanceof IOException)
throw (IOException) x;
else
throw new IOException(x.getMessage());
}
}
use of org.apache.catalina.tribes.group.GroupChannel in project tomcat70 by apache.
the class TcpPingInterceptor method start.
@Override
public synchronized void start(int svc) throws ChannelException {
super.start(svc);
running = true;
if (thread == null && useThread) {
thread = new PingThread();
thread.setDaemon(true);
String channelName = "";
if (getChannel() instanceof GroupChannel && ((GroupChannel) getChannel()).getName() != null) {
channelName = "[" + ((GroupChannel) getChannel()).getName() + "]";
}
thread.setName("TcpPingInterceptor.PingThread" + channelName + "-" + cnt.addAndGet(1));
thread.start();
}
// acquire the interceptors to invoke on send ping events
ChannelInterceptor next = getNext();
while (next != null) {
if (next instanceof TcpFailureDetector)
failureDetector = new WeakReference<TcpFailureDetector>((TcpFailureDetector) next);
if (next instanceof StaticMembershipInterceptor)
staticMembers = new WeakReference<StaticMembershipInterceptor>((StaticMembershipInterceptor) next);
next = next.getNext();
}
}
use of org.apache.catalina.tribes.group.GroupChannel in project tomcat70 by apache.
the class BioReceiver method start.
@Override
public void start() throws IOException {
super.start();
try {
setPool(new RxTaskPool(getMaxThreads(), getMinThreads(), this));
} catch (Exception x) {
log.fatal("ThreadPool can initilzed. Listener not started", x);
if (x instanceof IOException)
throw (IOException) x;
else
throw new IOException(x.getMessage());
}
try {
getBind();
bind();
String channelName = "";
if (getChannel() instanceof GroupChannel && ((GroupChannel) getChannel()).getName() != null) {
channelName = "[" + ((GroupChannel) getChannel()).getName() + "]";
}
Thread t = new Thread(this, "BioReceiver" + channelName);
t.setDaemon(true);
t.start();
} catch (Exception x) {
log.fatal("Unable to start cluster receiver", x);
if (x instanceof IOException)
throw (IOException) x;
else
throw new IOException(x.getMessage());
}
}
Aggregations