Package org.jgroups.util

Examples of org.jgroups.util.ExposedByteArrayOutputStream


        TpHeader hdr=(TpHeader)msg.getHeader(this.id);
        if(hdr == null)
            throw new Exception("message " + msg + " doesn't have a transport header, cannot route it");
        String group=hdr.channel_name;

        ExposedByteArrayOutputStream out_stream=new ExposedByteArrayOutputStream((int)(msg.size() + 50));
        ExposedDataOutputStream dos=new ExposedDataOutputStream(out_stream);

        writeMessage(msg, dos, multicast);
        Buffer buf=new Buffer(out_stream.getRawBuffer(), 0, out_stream.size());

        if(stats) {
            num_msgs_sent++;
            num_bytes_sent+=buf.getLength();
        }
View Full Code Here


        DataOutputStream out=null;

        try {
            if(msg.getSrc() == null)
                msg.setSrc(local_addr);
            ExposedByteArrayOutputStream out_stream=new ExposedByteArrayOutputStream(128);
            out=new DataOutputStream(out_stream);
            msg.writeTo(out);
            out.flush(); // flushes contents to out_stream
            Buffer buf=new Buffer(out_stream.getRawBuffer(), 0, out_stream.size());

            discovery_reception.reset();
            for(int i=bind_port; i < bind_port+port_range; i++) {
                DatagramPacket packet=new DatagramPacket(buf.getBuf(), buf.getOffset(), buf.getLength(), dest_addr, i);
                sock.send(packet);
View Full Code Here

        long               frag_id=curr_id.getAndIncrement(); // used as seqnos
        int                num_frags;

        try {
            // write message into a byte buffer and fragment it
            ExposedByteArrayOutputStream out_stream=new ExposedByteArrayOutputStream((int)(size + 50));
            ExposedDataOutputStream dos=new ExposedDataOutputStream(out_stream);
            msg.writeTo(dos);
            byte[] buffer=out_stream.getRawBuffer();
            byte[][] fragments=Util.fragmentBuffer(buffer, frag_size, dos.size());
            num_frags=fragments.length;
            num_sent_frags+=num_frags;

            if(log.isTraceEnabled()) {
View Full Code Here

        TpHeader hdr=(TpHeader)msg.getHeader(this.id);
        if(hdr == null)
            throw new Exception("message " + msg + " doesn't have a transport header, cannot route it");
        String group=hdr.channel_name;

        ExposedByteArrayOutputStream out_stream=new ExposedByteArrayOutputStream((int)(msg.size() + 50));
        ExposedDataOutputStream dos=new ExposedDataOutputStream(out_stream);

        writeMessage(msg, dos, multicast);
        Buffer buf=new Buffer(out_stream.getRawBuffer(), 0, out_stream.size());

        if(stats) {
            num_msgs_sent++;
            num_bytes_sent+=buf.getLength();
        }
View Full Code Here

            dst_addr=msg.getDest(); // could be null in case of mcast
            try {
                out_stream.reset();
            }
            catch (Exception ex) {
                out_stream=new ExposedByteArrayOutputStream(512);
            }
            // at this point out_stream is always valid and non-null

            DataOutputStream tmp=new DataOutputStream(out_stream);
            msg.writeTo(tmp);
View Full Code Here

        long               id=curr_id.getAndIncrement(); // used as seqnos
        int                num_frags;

        try {
            // write message into a byte buffer and fragment it
            ExposedByteArrayOutputStream out_stream=new ExposedByteArrayOutputStream((int)(size + 50));
            ExposedDataOutputStream dos=new ExposedDataOutputStream(out_stream);
            msg.writeTo(dos);
            byte[] buffer=out_stream.getRawBuffer();
            byte[][] fragments=Util.fragmentBuffer(buffer, frag_size, dos.size());
            num_frags=fragments.length;
            num_sent_frags+=num_frags;

            if(log.isTraceEnabled()) {
View Full Code Here

            dst_addr=msg.getDest(); // could be null in case of mcast
            try {
                out_stream.reset();
            }
            catch (Exception ex) {
                out_stream=new ExposedByteArrayOutputStream(512);
            }
            // at this point out_stream is always valid and non-null

            DataOutputStream tmp=new DataOutputStream(out_stream);
            msg.writeTo(tmp);
View Full Code Here

        long               id=curr_id.getAndIncrement(); // used as seqnos
        int                num_frags;

        try {
            // write message into a byte buffer and fragment it
            ExposedByteArrayOutputStream out_stream=new ExposedByteArrayOutputStream((int)(size + 50));
            ExposedDataOutputStream dos=new ExposedDataOutputStream(out_stream);
            msg.writeTo(dos);
            byte[] buffer=out_stream.getRawBuffer();
            byte[][] fragments=Util.fragmentBuffer(buffer, frag_size, dos.size());
            num_frags=fragments.length;
            num_sent_frags+=num_frags;

            if(log.isTraceEnabled()) {
View Full Code Here

TOP

Related Classes of org.jgroups.util.ExposedByteArrayOutputStream

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.