Package org.jgroups

Examples of org.jgroups.Message.readFrom()


                ByteArrayInputStream inp_stream=new ByteArrayInputStream(buf);
                DataInputStream inp=new DataInputStream(inp_stream);
                   
                Message msg=new Message();
                msg.readFrom(inp);
                   
                Event evt=new Event(Event.MSG, msg);

                 // +++ remove
                    if(log.isDebugEnabled()) log.debug("Message is " + msg +
View Full Code Here


                mcast_sock.receive(packet);
                data=packet.getData();
                inp_stream=new ByteArrayInputStream(data, 0, data.length);
                inp=new DataInputStream(inp_stream);
                msg=new Message();
                msg.readFrom(inp);
                up(new Event(Event.MSG, msg));
            }
            catch(SocketException socketEx) {
                break;
            }
View Full Code Here

        if(m != null) {
            try {
                bis=new ByteArrayInputStream(m);
                in=new DataInputStream(bis);
                assembled_msg=new Message(false);
                assembled_msg.readFrom(in);
                if(log.isTraceEnabled()) log.trace("assembled_msg is " + assembled_msg);
                assembled_msg.setSrc(sender); // needed ? YES, because fragments have a null src !!
                num_received_msgs++;
                up_prot.up(new Event(Event.MSG, assembled_msg));
            }
View Full Code Here

                mcast_sock.receive(packet);
                data=packet.getData();
                inp_stream=new ByteArrayInputStream(data, 0, data.length);
                inp=new DataInputStream(inp_stream);
                msg=new Message();
                msg.readFrom(inp);
                up(new Event(Event.MSG, msg));
            }
            catch(SocketException socketEx) {
                break;
            }
View Full Code Here

        int b=dis.readInt();
        Message tmp;
        for(int i=0; i < b; i++) {
            tmp=new Message(false);
            tmp.readFrom(dis);
            l2.add(tmp);
        }

        stop=System.currentTimeMillis();
        total=stop-start;
View Full Code Here

            ByteArrayInputStream msg_in_data=new ByteArrayInputStream(jgbuf.getBuf(), jgbuf.getOffset(), jgbuf.getLength());
            Message m2=(Message)Message.class.newInstance();

                DataInputStream dis=new DataInputStream(msg_in_data);
                m2.readFrom(dis);
                dis.close();
            }

        long stop=System.currentTimeMillis();
        System.out.println("Serializing and deserializing a message " + num + " times took " + (stop - start) + "ms.");
View Full Code Here

                mcast_sock.receive(packet);
                data=packet.getData();
                inp_stream=new ByteArrayInputStream(data, 0, data.length);
                inp=new DataInputStream(inp_stream);
                msg=new Message();
                msg.readFrom(inp);
                up(new Event(Event.MSG, msg));
            }
            catch(SocketException socketEx) {
                break;
            }
View Full Code Here

        Address dest=Util.readAddress(in);
        Address src=Util.readAddress(in);

        while(in.readBoolean()) {
            Message msg=new Message(false);
            msg.readFrom(in);
            msg.setDest(dest);
            if(msg.getSrc() == null)
                msg.setSrc(src);
            list.add(msg);
        }
View Full Code Here

        return list;
    }

    protected static Message readMessage(DataInputStream instream) throws Exception {
        Message msg=new Message(false); // don't create headers, readFrom() will do this
        msg.readFrom(instream);
        return msg;
    }


    public static void main(String[] args) throws FileNotFoundException {
View Full Code Here

            DataInputStream in=null;
            try {
                ByteArrayInputStream bis=new ExposedByteArrayInputStream(buf);
                in=new DataInputStream(bis);
                Message assembled_msg=new Message(false);
                assembled_msg.readFrom(in);
                assembled_msg.setSrc(sender); // needed ? YES, because fragments have a null src !!
                if(log.isTraceEnabled()) log.trace("assembled_msg is " + assembled_msg);
                num_received_msgs++;
                up_prot.up(new Event(Event.MSG, assembled_msg));
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.