Package org.infinispan.commons.marshall

Examples of org.infinispan.commons.marshall.AdaptiveBufferSizePredictor


*/
@Test(groups = "functional", testName = "marshall.AdaptiveBufferSizePredictorTest")
public class AdaptiveBufferSizePredictorTest {

   public void testAdaptivenesOfBufferSizeChanges() throws Exception {
      AdaptiveBufferSizePredictor predictor = new AdaptiveBufferSizePredictor();
      int size = 32;
      int nextSize;
      int prevNextSize = AdaptiveBufferSizePredictor.DEFAULT_INITIAL;
      for (int i = 0; i < 100; i++) {
         predictor.recordSize(size);
         nextSize = predictor.nextSize(null);
         if (i % 2 != 0) {
            if ((nextSize * 0.88) < size)
               break;
            else {
               assert nextSize < prevNextSize;
               prevNextSize = nextSize;
            }
         }
      }

      size = 32768;

      for (int i = 0; i < 100; i++) {
         predictor.recordSize(size);
         nextSize = predictor.nextSize(null);
         if ((nextSize * 0.89) > size) {
            break;
         } else {
            assert nextSize > prevNextSize;
            prevNextSize = nextSize;
View Full Code Here

TOP

Related Classes of org.infinispan.commons.marshall.AdaptiveBufferSizePredictor

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.