use of org.jgroups.stack.GossipRouter in project JGroups by belaban.
the class GossipRouterTest method testLateStart.
/**
* Tests the following scenario (http://jira.jboss.com/jira/browse/JGRP-682):
* - First node is started with tunnel.xml, cannot connect
* - Second node is started *with* GossipRouter
* - Now first node should be able to connect and first and second node should be able to merge into a group
* - SUCCESS: a view of 2
*/
public void testLateStart() throws Exception {
final Lock lock = new ReentrantLock();
final Condition cond = lock.newCondition();
AtomicBoolean done = new AtomicBoolean(false);
System.out.println("-- starting first channel");
a = createTunnelChannel("A");
a.setReceiver(new MyReceiver("c1", done, lock, cond));
a.connect("demo");
System.out.println("-- starting second channel");
b = createTunnelChannel("B");
b.setReceiver(new MyReceiver("c2", done, lock, cond));
b.connect("demo");
System.out.println("-- starting GossipRouter");
router = new GossipRouter(bind_addr_str, gossip_router_port);
router.start();
System.out.println("-- waiting for merge to happen --");
long target_time = System.currentTimeMillis() + 40000;
lock.lock();
try {
while (System.currentTimeMillis() < target_time && !done.get()) {
cond.await(1000, TimeUnit.MILLISECONDS);
}
} finally {
lock.unlock();
}
Util.sleep(500);
View view = a.getView();
System.out.println("view=" + view);
assert view.size() == 2 : "view=" + view;
Util.close(b, a);
}
use of org.jgroups.stack.GossipRouter in project wildfly by wildfly.
the class SingletonTunnelTestCase method startGossipRouter.
private static void startGossipRouter() {
log.trace("Starting gossip router.");
try {
String address = System.getProperty("node0");
if (address == null || address.trim().isEmpty()) {
address = "127.0.0.1";
}
if (gossipRouter == null) {
log.trace("Assigning address " + address + " to gossip router.");
gossipRouter = new GossipRouter(address, 12001);
}
gossipRouter.start();
} catch (Exception e) {
log.error("Caught exception: ", e);
Assert.fail("Couldn't start GossipRouter: " + e.getMessage());
}
}
use of org.jgroups.stack.GossipRouter in project JGroups by belaban.
the class TCPGOSSIP_Test method startRouter.
@BeforeClass
void startRouter() throws Exception {
bind_addr = Util.getLoopback();
gossip_router_port = ResourceManager.getNextTcpPort(bind_addr);
gossipRouter = new GossipRouter(bind_addr, gossip_router_port);
gossipRouter.start();
}
use of org.jgroups.stack.GossipRouter in project JGroups by belaban.
the class TUNNEL_Test method startRouter.
@BeforeClass
void startRouter() throws Exception {
gossip_router_bind_addr = Util.getLoopback();
gossip_router_port = ResourceManager.getNextTcpPort(gossip_router_bind_addr);
gossip_router_hosts = gossip_router_bind_addr.getHostAddress() + "[" + gossip_router_port + "]";
gossipRouter = new GossipRouter(gossip_router_bind_addr, gossip_router_port);
gossipRouter.start();
}
use of org.jgroups.stack.GossipRouter in project JGroups by belaban.
the class TUNNELDeadLockTest method setUp.
@BeforeMethod
void setUp() throws Exception {
StackType type = Util.getIpStackType();
if (type == StackType.IPv6)
bind_addr = "::1";
else
bind_addr = "127.0.0.1";
promise = new Promise<>();
gossip_router_port = ResourceManager.getNextTcpPort(InetAddress.getByName(bind_addr));
gossip_router_hosts = bind_addr + "[" + gossip_router_port + "]";
gossipRouter = new GossipRouter(bind_addr, gossip_router_port).useNio(false);
gossipRouter.start();
}
Aggregations