dev@grizzly.java.net

DefaultSelectionKeyHandler doesn't work well

From: Bongjae Chang <carryel_at_korea.com>
Date: Mon, 15 Jun 2009 12:48:27 +0900

Hi,

When I tested DefaultSelectionKeyHandler simply, Keep alive timeout was not active.

I attached the proposed patch and a unit test case at Grizzly issue #669 (https://grizzly.dev.java.net/issues/show_bug.cgi?id=669).

I think that you can reproduce it easily with attached unit test case.

And the proposed patch is simple.

Index: main/java/com/sun/grizzly/DefaultSelectionKeyHandler.java
===================================================================
--- main/java/com/sun/grizzly/DefaultSelectionKeyHandler.java (revision 3298)
+++ main/java/com/sun/grizzly/DefaultSelectionKeyHandler.java (working copy)
@@ -208,7 +208,7 @@
             }
 
 
- long expire = getExpirationStamp(key);
+ long expire = getExpirationStamp(key.attachment());
             if (expire != SelectionKeyAttachment.UNLIMITED_TIMEOUT){
                 if (currentTime - expire >= timeout) {
                     cancel(key);

Would you please review it?

Thanks.

--
Bongjae Chang