use of org.jgroups.stack.RouterStubManager 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();
}
}
use of org.jgroups.stack.RouterStubManager in project JGroups by belaban.
the class TUNNEL method handleDownEvent.
public Object handleDownEvent(Event evt) {
Object retEvent = super.handleDownEvent(evt);
switch(evt.getType()) {
case Event.CONNECT:
case Event.CONNECT_WITH_STATE_TRANSFER:
case Event.CONNECT_USE_FLUSH:
case Event.CONNECT_WITH_STATE_TRANSFER_USE_FLUSH:
String group = evt.getArg();
Address local = local_addr;
if (stubManager != null)
stubManager.destroyStubs();
PhysicalAddress physical_addr = getPhysicalAddressFromCache(local);
String logical_name = org.jgroups.util.NameCache.get(local);
stubManager = new RouterStubManager(this, group, local, logical_name, physical_addr, getReconnectInterval()).useNio(this.use_nio);
for (InetSocketAddress gr : gossip_router_hosts) {
stubManager.createAndRegisterStub(new IpAddress(bind_addr, bind_port), new IpAddress(gr.getAddress(), gr.getPort())).receiver(this).set("tcp_nodelay", tcp_nodelay);
}
stubManager.connectStubs();
break;
case Event.DISCONNECT:
disconnectStub();
break;
}
return retEvent;
}
Aggregations