Search in sources :

Example 1 with RouterStub

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();
    }
}
Also used : RouterStub(org.jgroups.stack.RouterStub)

Example 2 with RouterStub

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();
    }
}
Also used : RouterStub(org.jgroups.stack.RouterStub) RouterStubManager(org.jgroups.stack.RouterStubManager) InetSocketAddress(java.net.InetSocketAddress) Event(org.jgroups.Event) PhysicalAddress(org.jgroups.PhysicalAddress) IpAddress(org.jgroups.stack.IpAddress) InetAddress(java.net.InetAddress)

Aggregations

RouterStub (org.jgroups.stack.RouterStub)2 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 Event (org.jgroups.Event)1 PhysicalAddress (org.jgroups.PhysicalAddress)1 IpAddress (org.jgroups.stack.IpAddress)1 RouterStubManager (org.jgroups.stack.RouterStubManager)1