Package org.jgroups

Examples of org.jgroups.Address


        boolean first=true;
        if(senders.isEmpty()) return "[]";

        TreeMap<Address,Entry> copy=new TreeMap<Address,Entry>(senders);
        for(Map.Entry<Address,Entry> entry: copy.entrySet()) {
            Address key=entry.getKey();
            Entry val=entry.getValue();
            if(!first)
                sb.append(", ");
            else
                first=false;
View Full Code Here


        StringBuilder sb=new StringBuilder("[");
        boolean first=true;

        TreeMap<Address,Entry> copy=new TreeMap<Address,Entry>(senders);
        for(Map.Entry<Address,Entry> entry: copy.entrySet()) {
            Address key=entry.getKey();
            Entry val=entry.getValue();
            if(!first)
                sb.append(", ");
            else
                first=false;
View Full Code Here

    public String printHighestReceivedSeqnos() {
        StringBuilder sb=new StringBuilder();
        boolean first=true;

        for(Map.Entry<Address,Entry> entry: senders.entrySet()) {
            Address key=entry.getKey();
            Entry val=entry.getValue();
            if(!first)
                sb.append(", ");
            else {
                sb.append('[');
View Full Code Here


    public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException {
        short size=in.readShort();
        Map<Address,Entry> tmp=new HashMap<Address, Entry>(size);
        Address key;
        for(int i=0; i < size; i++) {
            key=Util.readAddress(in);
            tmp.put(key, new Entry(in.readLong(), in.readLong(), in.readLong()));
        }
        senders.clear();
View Full Code Here


    public long serializedSize() {
        long retval=Global.SHORT_SIZE; // number of elements in 'senders'
        if(!senders.isEmpty()) {
            Address addr=senders.keySet().iterator().next();
            int len=Util.size(addr);
            len+=Entry.SIZE; // 3 longs in one Entry
            retval+=len * senders.size();
        }
        return retval;
View Full Code Here

    }


    public static void testContains() {
        LazyRemovalSet<Address> cache=new LazyRemovalSet<Address>(5, 0);
        Address a=Util.createRandomAddress("A"),
          b=Util.createRandomAddress("B"),
          c=Util.createRandomAddress("C"),
          d=Util.createRandomAddress("D");
        cache.add(a,b,c,d);
        System.out.println("cache = " + cache);
View Full Code Here

      // This cache instance does not go through UnitTestCacheFactory so we need to modify
      // it's config explicitelly.
      new UnitTestCacheFactory<String, String>().mangleConfiguration(c);
      CacheJmxWrapperMBean<String, String> wrapper = registerWrapper(c);
      wrapper.start();
      Address addr = wrapper.getLocalAddress();
      assertNotNull("Got an Address", addr);
      List members = wrapper.getMembers();
      assertNotNull("Got members", addr);
      assertEquals("Got correct number of members", 1, members.size());
      assertTrue("Got an IpAddress", wrapper.getLocalAddress() instanceof IpAddress);
View Full Code Here

        int index=members.indexOf(local_addr);
        if(index < 0)
            return null;
        for(int i=index +1; i <= index + buddies; i++) {
            int real_index=i % members.size();
            Address buddy=members.get(real_index);
            retval.add(buddy);
        }
        return retval;
    }
View Full Code Here

            if(log.isWarnEnabled())
                log.warn("no destination found for " + channel_name);
            return;
        }
        for(Map.Entry<Address,SHARED_LOOPBACK> entry: dests.entrySet()) {
            Address dest=entry.getKey();
            SHARED_LOOPBACK target=entry.getValue();
            try {
                target.receive(local_addr, data, offset, length);
            }
            catch(Throwable t) {
View Full Code Here

        c1.connect("UNICAST_OOB_Test");
        c2.connect("UNICAST_OOB_Test");
        assert c2.getView().size() == 2 : "ch2.view is " + c2.getView();

        Address dest=c2.getAddress();
        for(int i=1; i <=5; i++) {
            Message msg=new Message(dest, null, new Long(i));
            if(i == 4 && oob)
                msg.setFlag(Message.OOB);
            System.out.println("-- sending message #" + i);
View Full Code Here

TOP

Related Classes of org.jgroups.Address

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.