hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1606473 - /httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
Date Sun, 29 Jun 2014 12:04:56 GMT
Author: olegk
Date: Sun Jun 29 12:04:56 2014
New Revision: 1606473

URL: http://svn.apache.org/r1606473
Log:
HTTPASYNC-78: replaced volatile int with AtomicLong in AbstractMultiworkerIOReactor#DefaultThreadFactory

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

Modified: httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java?rev=1606473&r1=1606472&r2=1606473&view=diff
==============================================================================
--- httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
(original)
+++ httpcomponents/httpcore/branches/4.3.x/httpcore-nio/src/main/java/org/apache/http/impl/nio/reactor/AbstractMultiworkerIOReactor.java
Sun Jun 29 12:04:56 2014
@@ -40,6 +40,7 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.nio.params.NIOReactorPNames;
@@ -596,10 +597,10 @@ public abstract class AbstractMultiworke
 
     static class DefaultThreadFactory implements ThreadFactory {
 
-        private static volatile int COUNT = 0;
+        private final static AtomicLong COUNT = new AtomicLong(1);
 
         public Thread newThread(final Runnable r) {
-            return new Thread(r, "I/O dispatcher " + (++COUNT));
+            return new Thread(r, "I/O dispatcher " + COUNT.getAndIncrement());
         }
 
     }



Mime
View raw message