hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1638960 - /httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
Date Wed, 12 Nov 2014 19:16:11 GMT
Author: olegk
Date: Wed Nov 12 19:16:11 2014
New Revision: 1638960

URL: http://svn.apache.org/r1638960
Log:
IOSessionImpl: use volatiles for time access functions instead of synchronized access
Contributed by Dmitry Potapov <dpotapov at yandex-team.ru>

Modified:
    httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java

Modified: httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java?rev=1638960&r1=1638959&r2=1638960&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
(original)
+++ httpcomponents/httpcore/branches/4.4.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
Wed Nov 12 19:16:11 2014
@@ -65,9 +65,9 @@ public class IOSessionImpl implements IO
 
     private final long startedTime;
 
-    private long lastReadTime;
-    private long lastWriteTime;
-    private long lastAccessTime;
+    private volatile long lastReadTime;
+    private volatile long lastWriteTime;
+    private volatile long lastAccessTime;
 
     /**
      * Creates new instance of IOSessionImpl.
@@ -207,7 +207,7 @@ public class IOSessionImpl implements IO
     }
 
     @Override
-    public synchronized void setSocketTimeout(final int timeout) {
+    public void setSocketTimeout(final int timeout) {
         this.socketTimeout = timeout;
         this.lastAccessTime = System.currentTimeMillis();
     }
@@ -282,29 +282,29 @@ public class IOSessionImpl implements IO
         this.attributes.put(name, obj);
     }
 
-    public synchronized long getStartedTime() {
+    public long getStartedTime() {
         return this.startedTime;
     }
 
-    public synchronized long getLastReadTime() {
+    public long getLastReadTime() {
         return this.lastReadTime;
     }
 
-    public synchronized long getLastWriteTime() {
+    public long getLastWriteTime() {
         return this.lastWriteTime;
     }
 
-    public synchronized long getLastAccessTime() {
+    public long getLastAccessTime() {
         return this.lastAccessTime;
     }
 
-    synchronized void resetLastRead() {
+    void resetLastRead() {
         final long now = System.currentTimeMillis();
         this.lastReadTime = now;
         this.lastAccessTime = now;
     }
 
-    synchronized void resetLastWrite() {
+    void resetLastWrite() {
         final long now = System.currentTimeMillis();
         this.lastWriteTime = now;
         this.lastAccessTime = now;



Mime
View raw message