Package org.jgroups.blocks

Examples of org.jgroups.blocks.DistributedHashtable




    public void start(ChannelFactory factory, String props, boolean persist)
            throws ChannelException {
        h=new DistributedHashtable(groupname, factory, props, persist, 10000);
        h.addNotifier(this);

        setLayout(null);
        setSize(400, 300);
        setFont(default_font);
View Full Code Here


    Thread t=null;


    public void start(String props, long timeout) throws Exception {
        this.timeout=timeout;
        ht=new DistributedHashtable("HashtableTest", new JChannelFactory(), props, timeout);
    }
View Full Code Here

        debugger=new Debugger((JChannel)((ReplicatedHashtable)ht).getChannel(), cummulative);
    }
    ((ReplicatedHashtable)ht).addNotifier(new Notifier(NUM_ITEMS));
      }
      else {
    ht=new DistributedHashtable("HashtableTest", new JChannelFactory(), props, 1000);
    if(debug) {
        debugger=new Debugger((JChannel)((DistributedHashtable)ht).getChannel(), cummulative);
    }
    // ((DistributedHashtable)ht).addNotifier(new MyNotifier());
      }
View Full Code Here

                "FRAG(frag_size=16000;down_thread=false;up_thread=false):" +
                "pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;shun=false;print_local_addr=true):" +
                "pbcast.STATE_TRANSFER";


        DistributedHashtable distHash=new DistributedHashtable("ADMINT", null, props, 20000);
        boolean odd=false;
        int numberofelements=1000;

        Util.sleep(5000);
        System.out.println("size: " + distHash.size());
        if(distHash.size() > 0)//The first instance counts up when numbers are even
        {                                        //The  second when numbers are odd
            odd=true;
        }
        boolean fillup=false;
        if(!odd) System.out.println("Loading hashtable with " + numberofelements + " elements. Don't start the other instance");
        for(int i=0; !odd && i < numberofelements; i++)//if the table isn't full we fill it
        {
            if(i % 50 == 0) System.out.print(i + " ");
            distHash.put("number" + i, new Integer(0));
            fillup=true;
        }
        if(fillup) System.out.println("\n\nHashtable filled, you can now start the other instance\n");
        System.out.println("initilising with odd: " + odd + " and size " + distHash.size());
        while(true) {
            try {
                System.out.println("#######################################################");
                Thread.sleep(10000);
                int count=0;
                for(int i=0; i < numberofelements; i++) {
                    int value=((Integer)distHash.get("number" + i)).intValue();
                    System.out.print(value + " ");
                    if(i % 50 == 0) System.out.print("\n");
                    if(odd && (value % 2 != 0))//If the number is odd, and the instance is supposed to count odd numbers up
                    {
                        count++;
                        value++;
                        distHash.put("number" + i, new Integer(value));
                        continue;
                    }
                    if(!odd && (value % 2 == 0))//If the number is even, and the instance is supposed to count even numbers up
                    {
                        count++;
                        value++;
                        distHash.put("number" + i, new Integer(value));
                        continue;
                    }
                }
                System.out.println("\n" + odd + " through all session, changed: " + count);
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        System.out.println("#### Setup Test " + testCount);

        Channel c1=createChannel("A");
        this.map1=new DistributedHashtable(c1, false, 5000);
        c1.connect("demo");
        this.map1.start(5000);

        Channel c2=createChannel("A");
        this.map2=new DistributedHashtable(c2, false, 5000);
        c2.connect("demo");
        this.map2.start(5000);
    }
View Full Code Here

    volatile Thread thread=null;


    public void start(String props, long timeout) throws Exception {
        this.timeout=timeout;
        ht=new DistributedHashtable("HashtableTest", new JChannelFactory(), props, timeout);
    }
View Full Code Here

      if(use_replicated_hashtable) {
    ht=new ReplicatedHashtable("HashtableTest", new JChannelFactory(), props, 1000);
    ((ReplicatedHashtable)ht).addNotifier(new Notifier(NUM_ITEMS));
      }
      else {
    ht=new DistributedHashtable("HashtableTest", new JChannelFactory(), props, 1000);
    // ((DistributedHashtable)ht).addNotifier(new MyNotifier());
      }

      System.out.println("Hashtable already has " + ht.size() + " items");
View Full Code Here



    public void start(ChannelFactory factory, String props, boolean persist)
            throws ChannelException {
        h=new DistributedHashtable(groupname, factory, props, persist, 10000);
        h.addNotifier(this);

        setLayout(null);
        setSize(400, 300);
        setFont(default_font);
View Full Code Here

TOP

Related Classes of org.jgroups.blocks.DistributedHashtable

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.