You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2007/03/15 12:43:30 UTC

svn commit: r518592 - /jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionRequestImpl.java

Author: olegk
Date: Thu Mar 15 04:43:29 2007
New Revision: 518592

URL: http://svn.apache.org/viewvc?view=rev&rev=518592
Log:
HTTPCORE-58: Fixed IllegalStateException after cancelling session request

Modified:
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionRequestImpl.java

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionRequestImpl.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionRequestImpl.java?view=diff&rev=518592&r1=518591&r2=518592
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionRequestImpl.java (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/SessionRequestImpl.java Thu Mar 15 04:43:29 2007
@@ -113,7 +113,7 @@
             throw new IllegalArgumentException("Session may not be null");
         }
         if (this.completed) {
-            throw new IllegalStateException("Session request already completed");
+            return;
         }
         this.completed = true;
         synchronized (this) {
@@ -130,7 +130,7 @@
             return;
         }
         if (this.completed) {
-            throw new IllegalStateException("Session request already completed");
+            return;
         }
         this.completed = true;
         synchronized (this) {
@@ -144,7 +144,7 @@
  
     public void timeout() {
         if (this.completed) {
-            throw new IllegalStateException("Session request already completed");
+            return;
         }
         synchronized (this) {
             if (this.callback != null) {
@@ -171,10 +171,13 @@
     }
 
     public void cancel() {
+        if (this.completed) {
+            return;
+        }
+        this.completed = true;
         if (this.key != null) {
             this.key.cancel();
         }
-        this.completed = true;
         synchronized (this) {
             if (this.callback != null) {
                 this.callback.cancelled(this);