final SingleThreadedPool pool1 = new SingleThreadedPool( B.class, 5, 10 );
final long pool1Start = System.currentTimeMillis();
for( int i = 0; i < TEST_SIZE; i++ )
{
final Poolable a1 = pool1.get();
pool1.put( a1 );
}
final long pool1End = System.currentTimeMillis();
final long pool1Duration = pool1End - pool1Start;
System.gc();
System.gc();
Thread.sleep( 2 );
if( logger.isDebugEnabled() ) logger.debug( "FreeMem post 1: " + Runtime.getRuntime().freeMemory() );
final SingleThreadedPool pool2 = new SingleThreadedPool( B.class, 5, 10 );
final long pool2Start = System.currentTimeMillis();
final int pool2Factor = 10;
final int pool2Loops = TEST_SIZE / pool2Factor;
for( int i = 0; i < pool2Loops; i++ )
{
final Poolable a1 = pool2.get();
final Poolable a2 = pool2.get();
final Poolable a3 = pool2.get();
final Poolable a4 = pool2.get();
final Poolable a5 = pool2.get();
final Poolable a6 = pool2.get();
final Poolable a7 = pool2.get();
final Poolable a8 = pool2.get();
final Poolable a9 = pool2.get();
final Poolable a10 = pool2.get();
pool2.put( a1 );
pool2.put( a2 );
pool2.put( a3 );
pool2.put( a4 );
pool2.put( a5 );
pool2.put( a6 );
pool2.put( a7 );
pool2.put( a8 );
pool2.put( a9 );
pool2.put( a10 );
}
final long pool2End = System.currentTimeMillis();
final long pool2Duration = pool2End - pool2Start;
System.gc();
System.gc();
Thread.sleep( 2 );
if( logger.isDebugEnabled() ) logger.debug( "FreeMem post 2: " + Runtime.getRuntime().freeMemory() );
final SingleThreadedPool pool3 = new SingleThreadedPool( B.class, 5, 10 );
final long pool3Start = System.currentTimeMillis();
final int pool3Factor = 15;
final int pool3Loops = TEST_SIZE / pool3Factor;
for( int i = 0; i < pool3Loops; i++ )
{
final Poolable a1 = pool3.get();
final Poolable a2 = pool3.get();
final Poolable a3 = pool3.get();
final Poolable a4 = pool3.get();
final Poolable a5 = pool3.get();
final Poolable a6 = pool3.get();
final Poolable a7 = pool3.get();
final Poolable a8 = pool3.get();
final Poolable a9 = pool3.get();
final Poolable a10 = pool3.get();
final Poolable a11 = pool3.get();
final Poolable a12 = pool3.get();
final Poolable a13 = pool3.get();
final Poolable a14 = pool3.get();
final Poolable a15 = pool3.get();
pool3.put( a1 );
pool3.put( a2 );
pool3.put( a3 );
pool3.put( a4 );
pool3.put( a5 );
pool3.put( a6 );
pool3.put( a7 );
pool3.put( a8 );
pool3.put( a9 );
pool3.put( a10 );
pool3.put( a11 );
pool3.put( a12 );
pool3.put( a13 );
pool3.put( a14 );
pool3.put( a15 );
}
final long pool3End = System.currentTimeMillis();
final long pool3Duration = pool3End - pool3Start;
System.gc();
System.gc();
Thread.sleep( 2 );
if( logger.isDebugEnabled() ) logger.debug( "FreeMem post 3: " + Runtime.getRuntime().freeMemory() );
final SingleThreadedPool pool4 = new SingleThreadedPool( B.class, 5, 10 );
final long pool4Start = System.currentTimeMillis();
final int pool4Factor = 20;
final int pool4Loops = TEST_SIZE / pool4Factor;
for( int i = 0; i < pool4Loops; i++ )
{
final Poolable a1 = pool4.get();
final Poolable a2 = pool4.get();
final Poolable a3 = pool4.get();
final Poolable a4 = pool4.get();
final Poolable a5 = pool4.get();
final Poolable a6 = pool4.get();
final Poolable a7 = pool4.get();
final Poolable a8 = pool4.get();
final Poolable a9 = pool4.get();
final Poolable a10 = pool4.get();
final Poolable a11 = pool4.get();
final Poolable a12 = pool4.get();
final Poolable a13 = pool4.get();
final Poolable a14 = pool4.get();
final Poolable a15 = pool4.get();
final Poolable a16 = pool4.get();
final Poolable a17 = pool4.get();
final Poolable a18 = pool4.get();
final Poolable a19 = pool4.get();
final Poolable a20 = pool4.get();
pool4.put( a1 );
pool4.put( a2 );
pool4.put( a3 );
pool4.put( a4 );
pool4.put( a5 );