Package org.jgroups.stack

Examples of org.jgroups.stack.RouterStub


    public void start() throws Exception {
        // loopback turned on is mandatory
        loopback = true;
        intentionallyTornDown = false;

        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();
View Full Code Here


                // if there are any stubs, destroy them
                stub.destroy();
            stubs.clear();

            for (InetSocketAddress host : initial_hosts) {
                RouterStub stub = new RouterStub(host.getHostName(), host.getPort(), null,this);               
                stubs.add(stub);
            }
            connect(group_addr, local_addr);
            startConnectionChecker();
        }
View Full Code Here

*/
@Test(groups={Global.FUNCTIONAL,Global.EAP_EXCLUDED},sequential=false)
public class RouterStubTest {

    public void testEquality() {
        RouterStub stub1=new RouterStub("192.168.1.5", 5000, null, null);
        RouterStub stub2=new RouterStub("192.168.1.5", 5000, null, null);
        assert stub1.equals(stub2);
        assert stub1.hashCode() == stub2.hashCode();
    }
View Full Code Here

        assert stub1.equals(stub2);
        assert stub1.hashCode() == stub2.hashCode();
    }

    public void testInequality() {
        RouterStub stub1=new RouterStub("192.168.1.5", 5000, null, null);
        RouterStub stub2=new RouterStub("192.168.1.5", 5001, null, null);
        assert !stub1.equals(stub2);
        assert stub1.hashCode() != stub2.hashCode();
    }
View Full Code Here

        assert !stub1.equals(stub2);
        assert stub1.hashCode() != stub2.hashCode();
    }

    public void testCompareTo() {
        RouterStub stub1=new RouterStub("192.168.1.5", 5000, null, null);
        RouterStub stub2=new RouterStub("192.168.1.5", 5001, null, null);
        assert stub1.compareTo(stub2) == -1;
    }
View Full Code Here

        RouterStub stub2=new RouterStub("192.168.1.5", 5001, null, null);
        assert stub1.compareTo(stub2) == -1;
    }

    public void testHashCode() {
        RouterStub stub1=new RouterStub("192.168.1.5", 5000, null, null);
        RouterStub stub2=new RouterStub("192.168.1.5", 5001, null, null);
        RouterStub stub3=new RouterStub("192.168.1.4", 5000, null, null);
        RouterStub stub4=new RouterStub("192.168.1.5", 5000, null, null);
        Map<RouterStub,Integer> stubs=new HashMap<RouterStub,Integer>();

        stubs.put(stub1, 1);
        stubs.put(stub2, 2);
        stubs.put(stub3, 3);
View Full Code Here

    }


    public void testList() {
        Set<RouterStub> stubs=new CopyOnWriteArraySet<RouterStub>();
        RouterStub stub1=new RouterStub("192.168.1.5", 5000, null, null);
        RouterStub stub2=new RouterStub("192.168.1.5", 5001, null, null);
        RouterStub stub3=new RouterStub("192.168.1.4", 5000, null, null);
        RouterStub stub4=new RouterStub("192.168.1.5", 5000, null, null);

        for(RouterStub stub: Arrays.asList(stub1, stub2, stub3, stub4))
            stubs.add(stub);
        System.out.println("stubs = " + stubs);
        assert stubs.size() == 3;
View Full Code Here

        removeInitialHost(hostname, port);
       
        //now re-add it
        InetSocketAddress isa = new InetSocketAddress(hostname, port);
        initial_hosts.add(isa);
        RouterStub s = new RouterStub(isa.getHostName(), isa.getPort(),null,stubManager);       
        connect(s,cluster_name, local_addr);
        stubManager.registerStub(s);
    }
View Full Code Here

    }

    @ManagedOperation
    public boolean removeInitialHost(String hostname, int port) {
        InetSocketAddress isa = new InetSocketAddress(hostname, port);
        RouterStub stub=new RouterStub(isa);
        RouterStub unregisterStub = stubManager.unregisterStub(stub);
        if(unregisterStub != null) {
            stubManager.stopReconnecting(unregisterStub);
            unregisterStub.destroy();
        }
        return initial_hosts.remove(isa);       
    }
View Full Code Here

            }
            help();
            return;
        }

        RouterStub stub=new RouterStub(host, port, null,null);
        stub.doConnect();
        Responses rsps=new Responses(false);
        stub.getMembers(cluster_name, rsps);
        for(PingData data: rsps)
            System.out.println(data);
        stub.destroy();
    }
View Full Code Here

TOP

Related Classes of org.jgroups.stack.RouterStub

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.