Package org.jgroups

Examples of org.jgroups.Message


    private static Message msg(long seqno) {
        return msg(false, seqno);
    }

    private static Message msg(boolean oob, long seqno) {
        Message retval=new Message(null, null, seqno);
        if(oob)
            retval.setFlag(Message.OOB);
        return retval;
    }
View Full Code Here


            retval.setFlag(Message.OOB);
        return retval;
    }

    private static Message msg(boolean oob) {
        Message retval=new Message();
        if(oob)
            retval.setFlag(Message.OOB);
        return retval;
    }
View Full Code Here

                e.printStackTrace();
                return;
            }

            while(count.get() > 0) {
                Message msg=win.remove();
                if(msg != null) {
                    count.decrementAndGet();
                    list.add(msg);
                }
                else {
View Full Code Here

            catch(InterruptedException e) {
                e.printStackTrace();
                return;
            }

            Message msg=new Message(false);

            while(num_msgs.getAndDecrement() > 0) {
                long seqno=current_seqno.getAndIncrement();

                int result=win.add2(seqno, msg);
View Full Code Here

    }

    public Object up(Event evt) {
        switch(evt.getType()) {
            case Event.MSG:
                Message msg=(Message)evt.getArg();
                if(msg.getDest() != null) // https://issues.jboss.org/browse/JGRP-1341: let unicast messages pass
                    return up_prot.up(evt);
                Thread current_thread=Thread.currentThread();
                in_flight_threads.put(current_thread, NULL);
                if(barrier_closed.get()) {
                    lock.lock();
View Full Code Here

        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);
            c1.send(msg);
            Util.sleep(100);
        }
View Full Code Here

        addAndGet(table,  1"1");
        addAndGet(table,  5"5");
        addAndGet(table,  9"9");
        addAndGet(table, 10, "10");

        assert !table.put(5, new Message());
        assert table.get(5).getObject().equals("5");
        assert table.size() == 5;
    }
View Full Code Here


    public static void testMassAddition() {
        RetransmitTable table=new RetransmitTable(3, 10, 0);
        final int NUM_MSGS=10005;
        final Message MSG=new Message(null, null, "hello world");
        for(int i=0; i < NUM_MSGS; i++)
            table.put(i, MSG);
        System.out.println("table = " + table);
        assert table.size() == NUM_MSGS;
        assert table.capacity() == 10010;
View Full Code Here

            addAndGet(table, i, "hello-" + i);
        System.out.println("table: " + table);
       
        // now remove 60 messages
        for(long i=1; i <= 60; i++) {
            Message msg=table.remove(i);
            assert msg.getObject().equals("hello-" + i);
        }
        System.out.println("table after removal of seqno 60: " + table);

        table.purge(50);
        System.out.println("now triggering a resize() by addition of seqno=120");
View Full Code Here

            addAndGet(table, i, "hello-" + i);
        System.out.println("table: " + table);

        // now remove 15 messages
        for(long i=0; i <= 15; i++) {
            Message msg=table.remove(i);
            assert msg.getObject().equals("hello-" + i);
        }
        System.out.println("table after removal of seqno 15: " + table);

        table.purge(15);
        System.out.println("now triggering a resize() by addition of seqno=55");
        addAndGet(table, 55, "hello-55");

        // now we have elements 40-49 in row 1 and 55 in row 2:
        List<String> list=new ArrayList<String>(20);
        for(int i=16; i < 50; i++)
            list.add("hello-" + i);
        list.add("hello-55");

        for(long i=table.getOffset(); i < table.capacity() + table.getOffset(); i++) {
            Message msg=table.get(i);
            if(msg != null) {
                String message=(String)msg.getObject();
                System.out.println(i + ": " + message);
                list.remove(message);
            }
        }
View Full Code Here

TOP

Related Classes of org.jgroups.Message

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.