maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tibordig...@apache.org
Subject [1/5] maven-surefire git commit: [SUREFIRE] refactoring
Date Sun, 04 Oct 2015 19:46:29 GMT
Repository: maven-surefire
Updated Branches:
  refs/heads/master 3dba8e7bd -> 9b5752f99


[SUREFIRE] refactoring


Project: http://git-wip-us.apache.org/repos/asf/maven-surefire/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven-surefire/commit/41761c1d
Tree: http://git-wip-us.apache.org/repos/asf/maven-surefire/tree/41761c1d
Diff: http://git-wip-us.apache.org/repos/asf/maven-surefire/diff/41761c1d

Branch: refs/heads/master
Commit: 41761c1d32db1e884a2948b5fe723be1e348a96b
Parents: 3dba8e7
Author: tibordigana <tibor17@lycos.com>
Authored: Sat Oct 3 12:47:51 2015 +0200
Committer: tibordigana <tibor17@lycos.com>
Committed: Sat Oct 3 12:47:51 2015 +0200

----------------------------------------------------------------------
 .../surefire/booterclient/ForkNumberBucket.java | 27 +++++++-------------
 1 file changed, 9 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven-surefire/blob/41761c1d/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java
----------------------------------------------------------------------
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java
index 55d099d..d1a8257 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkNumberBucket.java
@@ -29,19 +29,18 @@ import java.util.concurrent.atomic.AtomicInteger;
  *
  * @author Andreas Gudian
  */
-public class ForkNumberBucket
+public final class ForkNumberBucket
 {
-
     private static final ForkNumberBucket INSTANCE = new ForkNumberBucket();
 
-    private Queue<Integer> qFree = new ConcurrentLinkedQueue<Integer>();
+    private final Queue<Integer> qFree = new ConcurrentLinkedQueue<Integer>();
 
-    private AtomicInteger highWaterMark = new AtomicInteger( 1 );
+    private final AtomicInteger highWaterMark = new AtomicInteger( 1 );
 
     /**
      * Non-public constructor
      */
-    protected ForkNumberBucket()
+    private ForkNumberBucket()
     {
     }
 
@@ -74,24 +73,16 @@ public class ForkNumberBucket
      * @return a fork number that is not currently in use. The value must be returned to
the bucket using
      *         {@link #returnNumber(int)}.
      */
-    protected int drawNumberInternal()
+    private int drawNumberInternal()
     {
         Integer nextFree = qFree.poll();
-
-        if ( null == nextFree )
-        {
-            return highWaterMark.getAndIncrement();
-        }
-        else
-        {
-            return nextFree.intValue();
-        }
+        return nextFree == null ? highWaterMark.getAndIncrement() : nextFree;
     }
 
     /**
      * @return the highest number that has been drawn
      */
-    protected int getHighestDrawnNumber()
+    private int getHighestDrawnNumber()
     {
         return highWaterMark.get() - 1;
     }
@@ -99,8 +90,8 @@ public class ForkNumberBucket
     /**
      * @param number the number to return to the bucket so that it can be reused.
      */
-    protected void returnNumberInternal( int number )
+    private void returnNumberInternal( int number )
     {
-        qFree.add( Integer.valueOf( number ) );
+        qFree.add( number );
     }
 }


Mime
View raw message