}
}
@Test
public void testPool_exhaust() {
CommunicationConnectionFactory factory = new RmiCommunicationConnectionFactory();
CommunicationConnectionFactory poolFactory = new CommunicationConnectionPoolFactory(factory);
((CommunicationConnectionPoolFactory) poolFactory).initial();
CommunicationParam param = new CommunicationParam();
param.setIp("127.0.0.1");
param.setPort(1099);
CommunicationRegistry.regist(PoolEventType.exhaust, new TestPoolService());
ExecutorService executor = Executors.newCachedThreadPool();
long start = System.currentTimeMillis();
final CountDownLatch count = new CountDownLatch(11);
for (int i = 0; i < 11; i++) {
final CommunicationConnection connection = poolFactory.createConnection(param);
final PoolEvent event = new PoolEvent(PoolEventType.exhaust);
event.setSleep(1000);
executor.submit(new Callable() {
public Object call() throws Exception {