Package org.jgroups.util

Examples of org.jgroups.util.ByteArrayDataOutputStream.position()


            if(msg.getSrc() == null)
                msg.setSrc(local_addr);
            ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(128);
            msg.writeTo(out);
            for(int i=bind_port; i <= bind_port+port_range; i++) {
                DatagramPacket packet=new DatagramPacket(out.buffer(), 0, out.position(), dest_addr, i);
                sock.send(packet);
            }
        }
        catch(Exception ex) {
            log.error("failed sending discovery request", ex);
View Full Code Here


        ByteArrayDataOutputStream dos=new ByteArrayDataOutputStream((int)(msg.size() + 50));
        writeMessage(msg, dos, dest == null);

        if(stats) {
            num_msgs_sent++;
            num_bytes_sent+=dos.position();
        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
View Full Code Here

            num_msgs_sent++;
            num_bytes_sent+=dos.position();
        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
            tunnel_policy.sendToSingleMember(stubs, group, dest, dos.buffer(), 0, dos.position());
    }

View Full Code Here

        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
            tunnel_policy.sendToSingleMember(stubs, group, dest, dos.buffer(), 0, dos.position());
    }


    public void sendMulticast(AsciiString cluster_name, byte[] data, int offset, int length) throws Exception {
        throw new UnsupportedOperationException("sendMulticast() should not get called on TUNNEL");
View Full Code Here

        ByteArrayDataOutputStream dos=new ByteArrayDataOutputStream((int)(msg.size() + 50));
        writeMessage(msg, dos, dest == null);

        if(stats) {
            num_msgs_sent++;
            num_bytes_sent+=dos.position();
        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
View Full Code Here

            num_msgs_sent++;
            num_bytes_sent+=dos.position();
        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
            tunnel_policy.sendToSingleMember(stubs, group, dest, dos.buffer(), 0, dos.position());
    }

View Full Code Here

        }
        List<RouterStub> stubs = stubManager.getStubs();
        if(dest == null)
            tunnel_policy.sendToAllMembers(stubs, group, dos.buffer(), 0, dos.position());
        else
            tunnel_policy.sendToSingleMember(stubs, group, dest, dos.buffer(), 0, dos.position());
    }


    public void sendMulticast(AsciiString cluster_name, byte[] data, int offset, int length) throws Exception {
        throw new UnsupportedOperationException("sendMulticast() should not get called on TUNNEL");
View Full Code Here

    public void testExpanding() throws IOException {
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(1);
        for(int i='A'; i < 'A' + 20; i++)
            out.write(i);
        assert out.position() == 20;

        byte[] buffer=new byte[20];
        for(int i=0; i < 5; i++)
            out.write(buffer);
        assert out.position() == 120;
View Full Code Here

        assert out.position() == 20;

        byte[] buffer=new byte[20];
        for(int i=0; i < 5; i++)
            out.write(buffer);
        assert out.position() == 120;
    }

    public void testExpanding2() {
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(1);
        out.write(new byte[]{'b', 'e', 'l', 'a'});
View Full Code Here

    public void testWriteBytes() {
        String name="Bela";
        ByteArrayDataOutputStream out=new ByteArrayDataOutputStream(2);
        out.writeBytes(name);
        assert out.position() == name.length();
        ByteArrayDataInputStream in=new ByteArrayDataInputStream(out.buffer());
        byte[] tmp=new byte[name.length()];
        int read=in.read(tmp, 0, tmp.length);
        assert read == name.length();
        assert name.equals(new String(tmp));
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.