Package com.bubble.serializer

Examples of com.bubble.serializer.SerializationContext



 
  public void testBubbleSpeedSingle()  {
    Pojo pojo = new Pojo(TEST_VALUE);
    SerializationContext context = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    long startTime = System.currentTimeMillis();
    context.serialize(pojo, buffer);
    long endTime = System.currentTimeMillis();
    long delay = endTime-startTime;
    System.out.println("Bubble time: "+delay+"ms");
  }
View Full Code Here



 
  public void testBubbleSpeedSingle()  {
    Pojo pojo = new Pojo(TEST_VALUE);
    SerializationContext context = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocate(1024);
    long startTime = System.currentTimeMillis();
    context.serialize(pojo, buffer);
    long endTime = System.currentTimeMillis();
    long delay = endTime-startTime;
    System.out.println("Bubble time: "+delay+"ms");
  }
View Full Code Here

  }


  public void testBubbleSpeedMany() {
    Pojo[] pojos;
    SerializationContext context = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocate(32768);
    long startTime = System.currentTimeMillis();
    for(int j = 0; j < PASSES ; j++) {
      buffer.clear();
      pojos = initPojos();
      for (int i = 0; i < pojos.length; i++) {
        context.serialize(pojos[i], buffer);
      }
    }
    long endTime = System.currentTimeMillis();
    long delay = endTime-startTime;
    System.out.println("Bubble many time: "+delay+"ms");
View Full Code Here

   
  }
 
  public long testBubbleSerialize() throws Exception {
    FileChannel channel = new FileOutputStream(filePrefix).getChannel();     
    SerializationContext sc = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocateDirect(102400);
    long start = System.currentTimeMillis();
    for (int i = 0; i < loops; i++) {
      testObject = createTestObject();
      sc.serialize(testObject, buffer);
      buffer.flip();
      channel.write(buffer);     
      buffer.clear();
    }
    long total = System.currentTimeMillis()- start;
View Full Code Here

   
  }
 
  public long testBubbleDeserialize() throws Exception {
    FileChannel channel = new FileOutputStream(filePrefix).getChannel();     
    SerializationContext sc = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocateDirect(102400);
    for (int i = 0; i < loops; i++) {
      testObject = createTestObject();
      sc.serialize(testObject, buffer);
      buffer.flip();
      channel.write(buffer);     
      buffer.clear();
    }
    channel.close();
View Full Code Here

    return total;
  }

  public long testLightDeserialize() throws Exception {
    FileChannel channel = new FileOutputStream(filePrefix).getChannel();     
    SerializationContext sc = new SerializationContext();
    ByteBuffer buffer = ByteBuffer.allocateDirect(102400);
    for (int i = 0; i < loops; i++) {
      testObject = createTestObject();
      sc.serialize(testObject, buffer);
      buffer.flip();
      channel.write(buffer);     
      buffer.clear();
    }
    channel.close();
View Full Code Here

TOP

Related Classes of com.bubble.serializer.SerializationContext

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.