* InUse is calculated as: inUse = maxSize - available
*/
@Test
public void testInUse() throws Exception
{
final NoopLocal bean = lookup("NoopBean/local", NoopLocal.class);
ExecutorService service = Executors.newSingleThreadExecutor();
// exercise the thread
/*
Future<Void> future = service.submit(new Callable<Void> () {
public Void call() throws Exception
{
bean.noop();
return null;
}
});
future.get(5, SECONDS);
assertEquals(1, container.getPool().getCreateCount());
assertEquals("the pool should have grown", 1, container.getPool().getMaxSize());
assertEquals("the instance should be available", 1, container.getPool().getAvailableCount());
*/
final CyclicBarrier entree = new CyclicBarrier(2);
final CyclicBarrier exit = new CyclicBarrier(2);
Future<Void> future = service.submit(new Callable<Void> () {
public Void call() throws Exception
{
bean.shoo(entree, exit);
return null;
}
});
entree.await(5, SECONDS);