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 2008/08/29 17:45:22 UTC

svn commit: r690307 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java

Author: olegk
Date: Fri Aug 29 08:45:22 2008
New Revision: 690307

URL: http://svn.apache.org/viewvc?rev=690307&view=rev
Log:
HTTPCORE-172: Added #close() method to SharedInputBuffer and SharedOutputBuffer. The purpose of the new method is to close the buffer in case of normal / orderly termination of the underlying HTTP connection. The #shutdown() method should be used to force-close the buffer in case of abnormal / exceptional termination of the underlying connection.


Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
    httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=690307&r1=690306&r2=690307&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Fri Aug 29 08:45:22 2008
@@ -1,6 +1,13 @@
 Changes since 4.0 Beta 2
 -------------------
 
+* [HTTPCORE-172] Added #close() method to SharedInputBuffer and 
+  SharedOutputBuffer. The purpose of the new method is to close the buffer 
+  in case of normal / orderly termination of the underlying HTTP connection. 
+  Use #shutdown() method to force-close the buffer in case of abnormal / 
+  exceptional termination of the underlying connection.
+  Contributed by Oleg Kalnichevski <olegk at apache.org> 
+
 * [HTTPCORE-170] Fixed race condition in SharedOutputBuffer.
   Contributed by Jason Walton <Jason.Walton at alcatel-lucent.com>
 

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java?rev=690307&r1=690306&r2=690307&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedInputBuffer.java Fri Aug 29 08:45:22 2008
@@ -110,6 +110,16 @@
         }
     }
 
+    public void close() throws IOException {
+        if (this.shutdown) {
+            return;
+        }
+        this.endOfStream = true;
+        synchronized (this.mutex) {
+            this.mutex.notifyAll();
+        }
+    }
+
     public void shutdown() {
         if (this.shutdown) {
             return;

Modified: httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java?rev=690307&r1=690306&r2=690307&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java (original)
+++ httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/util/SharedOutputBuffer.java Fri Aug 29 08:45:22 2008
@@ -93,6 +93,13 @@
         }
     }
     
+    public void close() throws IOException {
+        if (this.shutdown) {
+            return;
+        }
+        writeCompleted();
+    }
+
     public void shutdown() {
         if (this.shutdown) {
             return;