[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpcomponents-commits
Subject:    svn commit: r517167 - in
From:       olegk () apache ! org
Date:       2007-03-12 10:50:36
Message-ID: 20070312105037.1BC4D1A9838 () eris ! apache ! org
[Download RAW message or body]

Author: olegk
Date: Mon Mar 12 03:50:32 2007
New Revision: 517167

URL: http://svn.apache.org/viewvc?view=rev&rev=517167
Log:
HTTPCORE-57: SessionRequest object left in an inconsistent state if the session \
request succeeds

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


Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java
                
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src \
/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java?view=diff&rev=517167&r1=517166&r2=517167
 ==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java \
                (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractIOReactor.java \
Mon Mar 12 03:50:32 2007 @@ -208,6 +208,11 @@
             this.sessions.add(session);
             keyCreated(key, session);
             this.eventDispatch.connected(session);
+            
+            SessionRequestImpl sessionRequest = entry.getSessionRequest();
+            if (sessionRequest != null) {
+                sessionRequest.completed(session);
+            }
         }
     }
 

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java
                
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src \
/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java?view=diff&rev=517167&r1=517166&r2=517167
 ==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java \
                (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/ChannelEntry.java \
Mon Mar 12 03:50:32 2007 @@ -36,23 +36,31 @@
 public class ChannelEntry {
 
     private final SocketChannel channel;
-    private final Object attachment;
+    private final SessionRequestImpl sessionRequest;
     
-    public ChannelEntry(final SocketChannel channel, final Object attachment) {
+    public ChannelEntry(final SocketChannel channel, final SessionRequestImpl \
sessionRequest) {  super();
         if (channel == null) {
             throw new IllegalArgumentException("Socket channel may not be null");
         }
         this.channel = channel;
-        this.attachment = attachment;
+        this.sessionRequest = sessionRequest;
     }
 
     public ChannelEntry(final SocketChannel channel) {
         this(channel, null);
     }
 
+    public SessionRequestImpl getSessionRequest() {
+        return this.sessionRequest;
+    }
+
     public Object getAttachment() {
-        return this.attachment;
+        if (this.sessionRequest != null) {
+            return this.sessionRequest.getAttachment();
+        } else {
+            return null;
+        }
     }
 
     public SocketChannel getChannel() {

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java
                
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src \
/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java?view=diff&rev=517167&r1=517166&r2=517167
 ==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java \
                (original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/DefaultConnectingIOReactor.java \
Mon Mar 12 03:50:32 2007 @@ -158,8 +158,7 @@
                 if (channel.isConnected()) {
                     try {
                         prepareSocket(channel.socket());
-                        Object attachment = sessionRequest.getAttachment();
-                        ChannelEntry entry = new ChannelEntry(channel, attachment); 
+                        ChannelEntry entry = new ChannelEntry(channel, \
sessionRequest);   addChannel(entry);
                     } catch (IOException ex) {
                         sessionRequest.failed(ex);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic