Package com.firefly.net

Examples of com.firefly.net.ReceiveBufferSizePredictor.previousReceiveBufferSize()


  private static Log log = LogFactory.getInstance().getLog("firefly-system");

  @Test
  public void testAdaptive() {
    ReceiveBufferSizePredictor receiveBufferSizePredictor = new AdaptiveReceiveBufferSizePredictor();
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), is(1024));
View Full Code Here


  @Test
  public void testAdaptive() {
    ReceiveBufferSizePredictor receiveBufferSizePredictor = new AdaptiveReceiveBufferSizePredictor();
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), is(1024));

    receiveBufferSizePredictor.previousReceiveBufferSize(1025);
View Full Code Here

  @Test
  public void testAdaptive() {
    ReceiveBufferSizePredictor receiveBufferSizePredictor = new AdaptiveReceiveBufferSizePredictor();
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), is(1024));

    receiveBufferSizePredictor.previousReceiveBufferSize(1025);
    receiveBufferSizePredictor.previousReceiveBufferSize(1300);
View Full Code Here

    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), is(1024));

    receiveBufferSizePredictor.previousReceiveBufferSize(1025);
    receiveBufferSizePredictor.previousReceiveBufferSize(1300);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), greaterThan(1024));

    receiveBufferSizePredictor.previousReceiveBufferSize(4000);
View Full Code Here

    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), is(1024));

    receiveBufferSizePredictor.previousReceiveBufferSize(1025);
    receiveBufferSizePredictor.previousReceiveBufferSize(1300);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), greaterThan(1024));

    receiveBufferSizePredictor.previousReceiveBufferSize(4000);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
View Full Code Here

    receiveBufferSizePredictor.previousReceiveBufferSize(1025);
    receiveBufferSizePredictor.previousReceiveBufferSize(1300);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), greaterThan(1024));

    receiveBufferSizePredictor.previousReceiveBufferSize(4000);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), greaterThan(2000));
  }

  @Test
View Full Code Here

  }

  @Test
  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));
  }

 
View Full Code Here

  @Test
  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));
  }

}
 
View Full Code Here

    if (readBytes > 0) {
      bb.flip();
      receiveBufferPool.release(bb);

      // Update the predictor.
      predictor.previousReceiveBufferSize(readBytes);
      session.setReadBytes(readBytes);
      session.setLastReadTime(TIME_PROVIDER.currentTimeMillis());
      // Decode
     
      try {
View Full Code Here

  private static Log log = LogFactory.getInstance().getLog("firefly-system");

  @Test
  public void testAdaptive() {
    ReceiveBufferSizePredictor receiveBufferSizePredictor = new AdaptiveReceiveBufferSizePredictor();
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    receiveBufferSizePredictor.previousReceiveBufferSize(960);
    log.debug("current buf size: " + receiveBufferSizePredictor.nextReceiveBufferSize());
    Assert.assertThat(receiveBufferSizePredictor.nextReceiveBufferSize(), is(1024));
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.