hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1545087 - in /httpcomponents/httpcore/trunk: RELEASE_NOTES.txt httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
Date Sun, 24 Nov 2013 22:20:31 GMT
Author: sebb
Date: Sun Nov 24 22:20:30 2013
New Revision: 1545087

URL: http://svn.apache.org/r1545087
Log:
HTTPCORE-364: IOSessionImpl.getLocalAddress() creates unnecessary copy of channel

Modified:
    httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
    httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java

Modified: httpcomponents/httpcore/trunk/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/RELEASE_NOTES.txt?rev=1545087&r1=1545086&r2=1545087&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpcore/trunk/RELEASE_NOTES.txt Sun Nov 24 22:20:30 2013
@@ -1,6 +1,8 @@
 Changes since 4.3
 -------------------
 
+* [HTTPCORE-364] IOSessionImpl.getLocalAddress() (etc.) creates unnecessary copy of channel
+
 * DefaultConnectingIOReactor / DefaultListeningIOReactor do not correctly apply some initial

   socket settings.
   Contributed by Andreas Veithen <veithen at apache.org>

Modified: httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java?rev=1545087&r1=1545086&r2=1545087&view=diff
==============================================================================
--- httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
(original)
+++ httpcomponents/httpcore/trunk/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
Sun Nov 24 22:20:30 2013
@@ -32,7 +32,6 @@ import java.net.InetSocketAddress;
 import java.net.Socket;
 import java.net.SocketAddress;
 import java.nio.channels.ByteChannel;
-import java.nio.channels.Channel;
 import java.nio.channels.SelectionKey;
 import java.nio.channels.SocketChannel;
 import java.util.Collections;
@@ -117,18 +116,16 @@ public class IOSessionImpl implements IO
     }
 
     public SocketAddress getLocalAddress() {
-        final Channel channel = this.channel;
-        if (channel instanceof SocketChannel) {
-            return ((SocketChannel)channel).socket().getLocalSocketAddress();
+        if (this.channel instanceof SocketChannel) {
+            return ((SocketChannel)this.channel).socket().getLocalSocketAddress();
         } else {
             return null;
         }
     }
 
     public SocketAddress getRemoteAddress() {
-        final Channel channel = this.channel;
-        if (channel instanceof SocketChannel) {
-            return ((SocketChannel)channel).socket().getRemoteSocketAddress();
+        if (this.channel instanceof SocketChannel) {
+            return ((SocketChannel)this.channel).socket().getRemoteSocketAddress();
         } else {
             return null;
         }
@@ -355,9 +352,8 @@ public class IOSessionImpl implements IO
     }
 
     public Socket getSocket() {
-        final Channel channel = this.channel;
-        if (channel instanceof SocketChannel) {
-            return ((SocketChannel) channel).socket();
+        if (this.channel instanceof SocketChannel) {
+            return ((SocketChannel) this.channel).socket();
         } else {
             return null;
         }



Mime
View raw message