use of org.jgroups.JChannel in project JGroups by belaban.
the class RpcDispatcherAsyncInvocationTest method createChannel.
protected static JChannel createChannel(String name) throws Exception {
SHARED_LOOPBACK sl = new SHARED_LOOPBACK();
sl.getThreadPool().setMinThreads(10).setMaxThreads(20);
return new JChannel(sl, new SHARED_LOOPBACK_PING(), new NAKACK2(), new UNICAST3(), new GMS()).name(name);
}
use of org.jgroups.JChannel in project JGroups by belaban.
the class TCPGOSSIP_Test method testConnectThreeChannelsWithGRDown.
public void testConnectThreeChannelsWithGRDown() throws Exception {
JChannel third = null;
try {
coordinator = createTcpgossipChannel("A");
channel = createTcpgossipChannel("B");
coordinator.connect("testConnectThreeChannelsWithGRDown");
channel.connect("testConnectThreeChannelsWithGRDown");
// kill router
gossipRouter.stop();
// cannot discover others since GR is down
third = createTcpgossipChannel("C");
third.connect("testConnectThreeChannelsWithGRDown");
// restart and....
gossipRouter.start();
Util.waitUntilAllChannelsHaveSameView(60000, 1000, coordinator, channel, third);
// confirm they found each other
View view = channel.getView();
assert channel.getView().size() == 3;
assert third.getView().size() == 3;
assert view.containsMember(channel.getAddress());
assert view.containsMember(coordinator.getAddress());
} finally {
Util.close(third);
}
}
use of org.jgroups.JChannel in project JGroups by belaban.
the class ReplicatedHashMapTest method setUp.
@BeforeClass
protected void setUp() throws Exception {
JChannel c1 = createChannel();
this.map1 = new ReplicatedHashMap<>(c1);
map1.setBlockingUpdates(true);
JChannel c2 = createChannel();
this.map2 = new ReplicatedHashMap<>(wrap, c2);
map2.setBlockingUpdates(true);
makeUnique(c1, c2);
c1.connect("ReplicatedHashMapTest");
this.map1.start(5000);
c2.connect("ReplicatedHashMapTest");
this.map2.start(5000);
}
use of org.jgroups.JChannel in project JGroups by belaban.
the class TCPGOSSIP_Test method testConnectThree.
public void testConnectThree() throws Exception {
JChannel third = null;
try {
coordinator = createTcpgossipChannel("A");
channel = createTcpgossipChannel("B");
coordinator.connect(GROUP);
channel.connect(GROUP);
third = createTcpgossipChannel("C");
third.connect(GROUP);
Util.waitUntilAllChannelsHaveSameView(10000, 500, coordinator, channel, third);
View view = channel.getView();
assert channel.getView().size() == 3 : String.format("expected view size of 3 but got %d: %s", channel.getView().size(), channel.getView());
assert third.getView().size() == 3;
assert view.containsMember(channel.getAddress());
assert view.containsMember(coordinator.getAddress());
} finally {
Util.close(third);
}
}
use of org.jgroups.JChannel in project JGroups by belaban.
the class FalseSuspicionTest method testFalseSuspicion.
public void testFalseSuspicion() throws Exception {
JChannel e = channels[channels.length - 1];
FD_SOCK fd_sock = e.getProtocolStack().findProtocol(FD_SOCK.class);
System.out.println("*** suspecting " + channels[1].getAddress());
suspect_method.invoke(fd_sock, channels[1].getAddress());
for (int i = 0; i < 10; i++) {
if (getTotalSuspectedMembers() == 0)
break;
Util.sleep(1000);
}
assert getTotalSuspectedMembers() == 0;
}
Aggregations