Examples of nextReceiveBufferSize()


Examples of com.firefly.net.buffer.FixedReceiveBufferSizePredictor.nextReceiveBufferSize()

  public void testFix() {
    ReceiveBufferSizePredictor receiveBufferSizePredictor = new FixedReceiveBufferSizePredictor(1024 * 8);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), is(1024 * 8));
    receiveBufferSizePredictor.previousReceiveBufferSize(40000);
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), is(1024 * 8));
  }
 
  public static void main(String[] args) {
    ReceiveBufferSizePredictor receiveBufferSizePredictor = new AdaptiveReceiveBufferSizePredictor();
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
View Full Code Here

Examples of io.netty.channel.ReceiveBufferSizePredictor.nextReceiveBufferSize()

        final SocketChannel ch = (SocketChannel) k.channel();
        final NioSocketChannel channel = (NioSocketChannel) k.attachment();

        final ReceiveBufferSizePredictor predictor =
            channel.getConfig().getReceiveBufferSizePredictor();
        final int predictedRecvBufSize = predictor.nextReceiveBufferSize();

        int ret = 0;
        int readBytes = 0;
        boolean failure = true;
View Full Code Here

Examples of io.netty.channel.ReceiveBufferSizePredictor.nextReceiveBufferSize()

        // Allocating a non-direct buffer with a max udp packge size.
        // Would using a direct buffer be more efficient or would this negatively
        // effect performance, as direct buffer allocation has a higher upfront cost
        // where as a ByteBuffer is heap allocated.
        final ByteBuffer byteBuffer = ByteBuffer.allocate(
                predictor.nextReceiveBufferSize()).order(bufferFactory.getDefaultOrder());

        boolean failure = true;
        SocketAddress remoteAddress = null;
        try {
            // Receive from the channel in a non blocking mode. We have already been notified that
View Full Code Here

Examples of io.netty.channel.ReceiveBufferSizePredictor.nextReceiveBufferSize()

    boolean process() throws IOException {

        ReceiveBufferSizePredictor predictor =
            channel.getConfig().getReceiveBufferSizePredictor();

        byte[] buf = new byte[predictor.nextReceiveBufferSize()];
        DatagramPacket packet = new DatagramPacket(buf, buf.length);
        try {
            channel.socket.receive(packet);
        } catch (InterruptedIOException e) {
            // Can happen on interruption.
View Full Code Here

Examples of org.jboss.netty.channel.ReceiveBufferSizePredictor.nextReceiveBufferSize()

            channel.getConfig().getReceiveBufferSizePredictor();
        ChannelBufferFactory bufferFactory =
            channel.getConfig().getBufferFactory();

        ChannelBuffer buffer =
            bufferFactory.getBuffer(predictor.nextReceiveBufferSize());

        int ret = 0;
        int readBytes = 0;
        boolean failure = true;
        try {
View Full Code Here

Examples of org.jboss.netty.channel.ReceiveBufferSizePredictor.nextReceiveBufferSize()

            }

            ReceiveBufferSizePredictor predictor =
                channel.getConfig().getReceiveBufferSizePredictor();

            byte[] buf = new byte[predictor.nextReceiveBufferSize()];
            DatagramPacket packet = new DatagramPacket(buf, buf.length);
            try {
                socket.receive(packet);
            } catch (Throwable t) {
                if (!channel.socket.isClosed()) {
View Full Code Here

Examples of org.jboss.netty.channel.ReceiveBufferSizePredictor.nextReceiveBufferSize()

        boolean closed = false;

        ReceiveBufferSizePredictor predictor = c.getConfig().getReceiveBufferSizePredictor();
        ChannelBufferFactory bufferFactory = c.getConfig().getBufferFactory();
        ChannelBuffer buf = bufferFactory.getBuffer(predictor.nextReceiveBufferSize());

        SocketAddress remoteAddress = null;
        Throwable exception = null;
        if (channel instanceof ScatteringByteChannel) {
            try {
View Full Code Here

Examples of org.jboss.netty.channel.ReceiveBufferSizePredictor.nextReceiveBufferSize()

            }

            ReceiveBufferSizePredictor predictor =
                channel.getConfig().getReceiveBufferSizePredictor();

            byte[] buf = new byte[predictor.nextReceiveBufferSize()];
            DatagramPacket packet = new DatagramPacket(buf, buf.length);
            try {
                socket.receive(packet);
            } catch (InterruptedIOException e) {
                // Can happen on interruption.
View Full Code Here

Examples of org.jboss.netty.channel.ReceiveBufferSizePredictor.nextReceiveBufferSize()

        final SocketChannel ch = (SocketChannel) k.channel();
        final NioSocketChannel channel = (NioSocketChannel) k.attachment();

        final ReceiveBufferSizePredictor predictor =
            channel.getConfig().getReceiveBufferSizePredictor();
        final int predictedRecvBufSize = predictor.nextReceiveBufferSize();

        int ret = 0;
        int readBytes = 0;
        boolean failure = true;
View Full Code Here

Examples of org.jboss.netty.channel.ReceiveBufferSizePredictor.nextReceiveBufferSize()

        // Allocating a non-direct buffer with a max udp packge size.
        // Would using a direct buffer be more efficient or would this negatively
        // effect performance, as direct buffer allocation has a higher upfront cost
        // where as a ByteBuffer is heap allocated.
        final ByteBuffer byteBuffer = ByteBuffer.allocate(
                predictor.nextReceiveBufferSize()).order(bufferFactory.getDefaultOrder());

        boolean failure = true;
        SocketAddress remoteAddress = null;
        try {
            // Receive from the channel in a non blocking mode. We have already been notified that
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.