hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r505493 - in /jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http: impl/nio/reactor/BaseIOReactor.java impl/nio/reactor/IOSessionImpl.java nio/reactor/IOSession.java
Date Fri, 09 Feb 2007 20:53:25 GMT
Author: olegk
Date: Fri Feb  9 12:53:25 2007
New Revision: 505493

URL: http://svn.apache.org/viewvc?view=rev&rev=505493
Log:
Made some slight changes to the way internal session buffers are monitored. Some I/O session
implementations, such as SSL decorator, may need to maintain several internal buffers in order
to transparently encode / decode application data

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

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java?view=diff&rev=505493&r1=505492&r2=505493
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/BaseIOReactor.java
Fri Feb  9 12:53:25 2007
@@ -39,7 +39,6 @@
 import org.apache.http.nio.reactor.EventMask;
 import org.apache.http.nio.reactor.IOReactorException;
 import org.apache.http.nio.reactor.IOSession;
-import org.apache.http.nio.reactor.SessionBufferStatus;
 
 public class BaseIOReactor extends AbstractIOReactor {
 
@@ -67,11 +66,8 @@
         handle.resetLastRead();
 
         this.eventDispatch.inputReady(session);
-        SessionBufferStatus bufStatus = session.getBufferStatus();
-        if (bufStatus != null) {
-            if (bufStatus.hasBufferedInput()) {
-                this.bufferingSessions.add(session);
-            }
+        if (session.hasBufferedInput()) {
+            this.bufferingSessions.add(session);
         }
     }
 
@@ -97,21 +93,16 @@
         if (!this.bufferingSessions.isEmpty()) {
             for (Iterator it = this.bufferingSessions.iterator(); it.hasNext(); ) {
                 IOSession session = (IOSession) it.next();
-                SessionBufferStatus bufStatus = session.getBufferStatus();
-                if (bufStatus != null) {
-                    if (!bufStatus.hasBufferedInput()) {
-                        it.remove();
-                        continue;
-                    }
+                if (!session.hasBufferedInput()) {
+                    it.remove();
+                    continue;
                 }
                 try {
                     int ops = session.getEventMask();
                     if ((ops & EventMask.READ) > 0) {
                         this.eventDispatch.inputReady(session);
-                        if (bufStatus != null) {
-                            if (!bufStatus.hasBufferedInput()) {
-                                it.remove();
-                            }
+                        if (!session.hasBufferedInput()) {
+                            it.remove();
                         }
                     }
                 } catch (CancelledKeyException ex) {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java?view=diff&rev=505493&r1=505492&r2=505493
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
Fri Feb  9 12:53:25 2007
@@ -156,8 +156,12 @@
         return this.closed || !this.key.isValid();
     }
     
-    public SessionBufferStatus getBufferStatus() {
-        return this.bufferStatus;
+    public boolean hasBufferedInput() {
+        return this.bufferStatus != null && this.bufferStatus.hasBufferedInput();
+    }
+    
+    public boolean hasBufferedOutput() {
+        return this.bufferStatus != null && this.bufferStatus.hasBufferedOutput();
     }
 
     public void setBufferStatus(final SessionBufferStatus bufferStatus) {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOSession.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOSession.java?view=diff&rev=505493&r1=505492&r2=505493
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOSession.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/nio/reactor/IOSession.java
Fri Feb  9 12:53:25 2007
@@ -60,9 +60,11 @@
     
     void setSocketTimeout(int timeout);
     
-    SessionBufferStatus getBufferStatus();
-    
     void setBufferStatus(SessionBufferStatus status);
+    
+    boolean hasBufferedInput();
+    
+    boolean hasBufferedOutput();
     
     void setAttribute(String name, Object obj);
     



Mime
View raw message