Package org.jgroups

Examples of org.jgroups.ViewId


public class ViewIdTest {
    private ViewId v1, v2, v3;

    @BeforeClass
    public void setUp() throws UnknownHostException {
        v1=new ViewId(Util.createRandomAddress(), 22);
        v2=new ViewId(Util.createRandomAddress(), 21);
        v3=(ViewId)v1.clone();
    }
View Full Code Here


        assert v1.equals(v3) : "v1 and v3 should be the same view";
    }


    public void test2() {
        ViewId v4=(ViewId)v1.clone();
        assert v1.equals(v4);
    }
View Full Code Here

        e=Util.createRandomAddress("E");
        f=Util.createRandomAddress("F");
        g=Util.createRandomAddress("G");
        h=Util.createRandomAddress("H");
        i=Util.createRandomAddress("I");
        ViewId id=new ViewId(a, 34);
        members=Arrays.asList(a, b, d, e, f, g, h);
        view=new View(id, members);

    }
View Full Code Here

    public void testEquals() {
        assert view.equals(view);
    }

    public void testEquals2() {
        View v1=new View(new ViewId(a, 12345), new Vector<Address>(members));
        View v2=new View(a, 12345, new Vector<Address>(members));
        assert v1.equals(v2);
        View v3=new View(a, 12543, new Vector<Address>(members));
        assert !v1.equals(v3);
    }
View Full Code Here

                            "cannot become coordinator (disable_initial_coord=" + gms.disable_initial_coord +
                            "), will retry fetching the initial membership");
                    continue;
                }
                joined=true;
                gms.view_id=new ViewId(mbr);       // create singleton view with mbr as only member
                gms.mbrs.add(mbr);
                view_evt=new Event(Event.VIEW_CHANGE,
                                   GMS.makeView(gms.mbrs.getMembers(), gms.view_id));
                gms.passDown(view_evt);
                gms.passUp(view_evt);
View Full Code Here


    public void setUp() throws Exception {
        super.setUp();
        try {
            v1=new ViewId(new org.jgroups.stack.IpAddress(InetAddress.getByName("localhost"), 1000), 22);
            v2=new ViewId(new org.jgroups.stack.IpAddress(InetAddress.getByName("localhost"), 1000), 21);
            v3=(ViewId)v1.clone();
        }
        catch(Exception e) {
            System.err.println("ViewIdTest.setUp(): " + e);
        }
View Full Code Here

      if (local_addr == null)
        return false;
      View view = ch.getView();
      if (view == null)
        return false;
      ViewId vid = view.getVid();
      if (vid == null)
        return false;
      Object coord = vid.getCoordAddress();
      if (coord == null)
        return false;
      return local_addr.equals(coord);
    }
View Full Code Here

        e=new IpAddress("127.0.0.1", 5555);
        f=new IpAddress("www.ibm.com", 80);
        g=new IpAddress("www.ibm.com", 8080);
        h=new IpAddress("224.0.0.1", 5555);
        i=new IpAddress("224.0.0.2", 5555);
        ViewId id=new ViewId(a, 34);
        members=new java.util.Vector();
        members.addElement(a);
        members.addElement(b);
        members.addElement(d);
        members.addElement(e);
View Full Code Here

    public void testEquals() {
        assertEquals(view, view);
    }

    public void testEquals2() {
        View v1=new View(new ViewId(a, 12345), (Vector)members.clone());
        View v2=new View(a, 12345, (Vector)members.clone());
        assertEquals(v1, v2);
        View v3=new View(a, 12543, (Vector)members.clone());
        assertFalse(v1.equals(v3));
    }
View Full Code Here

                return null;
            }
        }

        //Compute new View
        ViewId vid=new ViewId(gms.local_addr, Math.max(other_vid.getId() + 1, gms.ltime + 1));
        HashSet members=new HashSet(gms.mbrs.getMembers());
        members.addAll(other_mbrs);
        Vector new_mbrs=new Vector(members);
        Collections.sort(new_mbrs);
        View new_view=new View(vid, new_mbrs);
View Full Code Here

TOP

Related Classes of org.jgroups.ViewId

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.