Examples of alloc()


Examples of etch.util.core.nio.ByteBufferPool.alloc()

  /** @throws Exception */
  @Test
  public void alloc3() throws Exception
  {
    ByteBufferPool p = new ByteBufferPool( 4096, 0, 10, 0, 0 );
    ByteBuffer[] b = p.alloc( null, 2 );
    assertNotNull( b );
    assertEquals( 2, b.length );
    assertNotNull( b[0] );
    assertEquals( 4096, b[0].limit() );
    assertNotNull( b[1] );
View Full Code Here

Examples of etch.util.core.nio.ByteBufferPool.alloc()

  @Test( expected = IOException.class )
  public void alloc4() throws Exception
  {
    // out of buffers
    ByteBufferPool p = new ByteBufferPool( 1024, 0, 1, 0, 0 );
    p.alloc( null );
    p.alloc( null );
  }
 
  /** @throws Exception */
  @Test
 
View Full Code Here

Examples of etch.util.core.nio.ByteBufferPool.alloc()

  public void alloc4() throws Exception
  {
    // out of buffers
    ByteBufferPool p = new ByteBufferPool( 1024, 0, 1, 0, 0 );
    p.alloc( null );
    p.alloc( null );
  }
 
  /** @throws Exception */
  @Test
  public void alloc5() throws Exception
View Full Code Here

Examples of etch.util.core.nio.ByteBufferPool.alloc()

  public void alloc5() throws Exception
  {
    // slower because of no pooling.
    ByteBufferPool p = new ByteBufferPool( 1024, 0, 1, 0, 0 );
    for (int i = 0; i < 100000; i++)
      p.release( p.alloc( null ) );
    assertEquals( 0, p.used() );
  }
 
  /** @throws Exception */
  @Test
 
View Full Code Here

Examples of etch.util.core.nio.ByteBufferPool.alloc()

  public void alloc6() throws Exception
  {
    // faster because of pooling.
    ByteBufferPool p = new ByteBufferPool( 1024, 1, 1, 0, 0 );
    for (int i = 0; i < 100000; i++)
      p.release( p.alloc( null ) );
    assertEquals( 0, p.used() );
  }
 
  /** @throws Exception */
  @Test
 
View Full Code Here

Examples of etch.util.core.nio.ByteBufferPool.alloc()

  {
    ByteBufferPool p = new ByteBufferPool( 1024, 1, 1, 0, 0 );
    MyNotify n1 = new MyNotify();
    MyNotify n2 = new MyNotify();
   
    ByteBuffer b1 = p.alloc( n1 );
    assertNotNull( b1 );
    assertEquals( 1, p.used() );
    Thread.sleep( 15 );
    assertFalse( n1.available );
    assertFalse( n2.available );
View Full Code Here

Examples of etch.util.core.nio.ByteBufferPool.alloc()

    assertEquals( 1, p.used() );
    Thread.sleep( 15 );
    assertFalse( n1.available );
    assertFalse( n2.available );
   
    ByteBuffer b2 = p.alloc( n2 );
    assertNull( b2 );
    assertEquals( 1, p.used() );
    Thread.sleep( 15 );
    assertFalse( n1.available );
    assertFalse( n2.available );
View Full Code Here

Examples of etch.util.core.nio.ByteBufferPool.alloc()

    Thread.sleep( 15 );
    assertFalse( n1.available );
    assertTrue( n2.available );
   
    n2.available = false;
    b2 = p.alloc( n2 );
    assertNotNull( b2 );
    assertEquals( 1, p.used() );
    Thread.sleep( 15 );
    assertFalse( n1.available );
    assertFalse( n2.available );
View Full Code Here

Examples of etch.util.core.nio.History.alloc()

  @Test
  public void alloc1() throws Exception
  {
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    h.alloc( 1 );
    checkUsedAlloc( h, 0, 1 );
    h.alloc( -1 );
    checkUsedAlloc( h, 0, 0 );
  }
 
View Full Code Here

Examples of etch.util.core.nio.History.alloc()

  {
    History h = new History( 0, 10, 5 );
    checkUsedAlloc( h, 0, 0 );
    h.alloc( 1 );
    checkUsedAlloc( h, 0, 1 );
    h.alloc( -1 );
    checkUsedAlloc( h, 0, 0 );
  }
 
  /** @throws Exception */
  @Test
 
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.