commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [lang] LANG-1144: Multiple calls of org.apache.commons.lang3.concurrent.LazyInitializer.initialize() are possible
Date Mon, 24 Oct 2016 22:40:58 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master 383bc8eef -> eafeca432


LANG-1144: Multiple calls of org.apache.commons.lang3.concurrent.LazyInitializer.initialize()
are possible

use all uppercase name for constant


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/eafeca43
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/eafeca43
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/eafeca43

Branch: refs/heads/master
Commit: eafeca43268f16aa9d4a179e44b9e7747699c1eb
Parents: 383bc8e
Author: pascalschumacher <pascalschumacher@gmx.net>
Authored: Tue Oct 25 00:40:48 2016 +0200
Committer: pascalschumacher <pascalschumacher@gmx.net>
Committed: Tue Oct 25 00:40:48 2016 +0200

----------------------------------------------------------------------
 .../org/apache/commons/lang3/concurrent/LazyInitializer.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/eafeca43/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java
index ed84049..2b2f72d 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java
@@ -79,11 +79,11 @@ package org.apache.commons.lang3.concurrent;
  */
 public abstract class LazyInitializer<T> implements ConcurrentInitializer<T>
{
 
-    private static final Object noInit = new Object();
+    private static final Object NO_INIT = new Object();
 
     @SuppressWarnings("unchecked")
     /** Stores the managed object. */
-    private volatile T object = (T) noInit;
+    private volatile T object = (T) NO_INIT;
 
     /**
      * Returns the object wrapped by this instance. On first access the object
@@ -99,10 +99,10 @@ public abstract class LazyInitializer<T> implements ConcurrentInitializer<T>
{
         // volatile field
         T result = object;
 
-        if (result == noInit) {
+        if (result == NO_INIT) {
             synchronized (this) {
                 result = object;
-                if (result == noInit) {
+                if (result == NO_INIT) {
                     object = result = initialize();
                 }
             }


Mime
View raw message