dev@grizzly.java.net

Re: A question about outbound connection cache

From: Minoru Nitta <minoru.nitta_at_jp.fujitsu.com>
Date: Mon, 23 Feb 2009 09:49:38 +0900

Hi Alexy,


 Thank you for deep consideration. I did not kow what you pointed out, so
I modified my test program, as attached. To be sure, I checked my program
by myself again, and synchronized execute method of my filter (TestFilter).

 The result is the attached result.txt. Coud I ask you please to
double-check the program again?


Minoru


> Hi Monoru,
>
> you were right, there was really issue with returning
> CacheableConnectorHandler back to pool. Because at the same time
> connection may be used by OutboundConnectionCache.
> But there is also problem in your test - you can not start send UDP
> packets in loop, before making sure, that Controller has started.
> For example like this:
>
> final CountDownLatch latch = new CountDownLatch(1);
> controller.addStateListener(new
> ControllerStateListenerAdapter() {
> @Override
> public void onReady() {
> latch.countDown();
> }
>
> @Override
> public void onException(Throwable e) {
> if (latch.getCount() > 0) {
> Controller.logger().log(Level.SEVERE, "Exception
> during " +
> "starting the controller", e);
> latch.countDown();
> } else {
> Controller.logger().log(Level.SEVERE, "Exception
> during " +
> "controller processing", e);
> }
> }
> });
>
> new Thread(controller).start();
>
> try {
> latch.await();
> } catch (InterruptedException ex) {
> }
>
> WBR,
> Alexey.
>