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(); } }
public RouterStub createAndRegisterStub(IpAddress local, IpAddress router_addr) { RouterStub stub=new RouterStub(local, router_addr, use_nio, this); RouterStub old_stub=unregisterStub(router_addr); if(old_stub != null) old_stub.destroy(); add(stub); return stub; }
protected boolean reconnect(Target target) { RouterStub stub=new RouterStub(target.bind_addr, target.router_addr, this.use_nio, this).receiver(target.receiver); if(!add(stub)) return false; try { stub.connect(this.cluster_name, this.local_addr, this.logical_name, this.phys_addr); log.debug("re-established connection to %s successfully for group=%s and address=%s", stub.remote(), this.cluster_name, this.local_addr); return true; } catch(Throwable t) { remove(stub); return false; } }
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(); } }
public RouterStub createAndRegisterStub(IpAddress local, IpAddress router_addr) { RouterStub stub=new RouterStub(local, router_addr, use_nio, this); RouterStub old_stub=unregisterStub(router_addr); if(old_stub != null) old_stub.destroy(); add(stub); return stub; }
public void start() throws Exception { //loopback turned on is mandatory loopback = true; stub = new RouterStub(router_host,router_port,bind_addr); stub.setConnectionListener(new StubConnectionListener()); local_addr=stub.getLocalAddress(); if(additional_data != null && local_addr instanceof IpAddress) ((IpAddress)local_addr).setAdditionalData(additional_data); super.start(); }
protected boolean reconnect(Target target) { RouterStub stub=new RouterStub(target.bind_addr, target.router_addr, this.use_nio, this).receiver(target.receiver); if(!add(stub)) return false; try { stub.connect(this.cluster_name, this.local_addr, this.logical_name, this.phys_addr); log.debug("re-established connection to %s successfully for group=%s and address=%s", stub.remote(), this.cluster_name, this.local_addr); return true; } catch(Throwable t) { remove(stub); return false; } }