use of org.jgroups.stack.RouterStub in project JGroups by belaban.
the class RouterStubGet method start.
protected void start(String host, int port, String cluster_name, boolean nio) {
try {
stub = new RouterStub(null, 0, InetAddress.getByName(host), port, nio, null);
stub.connect();
stub.getMembers(cluster_name, this);
promise.getResult(5000);
} catch (Exception ex) {
ex.printStackTrace();
stub.destroy();
}
}
use of org.jgroups.stack.RouterStub in project JGroups by belaban.
the class TCPGOSSIP method handleConnect.
public void handleConnect() {
if (cluster_name == null || local_addr == null)
log.error(Util.getMessage("GroupaddrOrLocaladdrIsNullCannotRegisterWithGossipRouterS"));
else {
InetAddress bind_addr = getTransport().getBindAddress();
log.trace("registering " + local_addr + " under " + cluster_name + " with GossipRouter");
stubManager.destroyStubs();
PhysicalAddress physical_addr = (PhysicalAddress) down_prot.down(new Event(Event.GET_PHYSICAL_ADDRESS, local_addr));
stubManager = new RouterStubManager(this, cluster_name, local_addr, NameCache.get(local_addr), physical_addr, reconnect_interval).useNio(this.use_nio);
for (InetSocketAddress host : initial_hosts) {
RouterStub stub = stubManager.createAndRegisterStub(new IpAddress(bind_addr, 0), new IpAddress(host.getAddress(), host.getPort()));
stub.socketConnectionTimeout(sock_conn_timeout);
}
stubManager.connectStubs();
}
}
Aggregations