You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/03/20 17:26:04 UTC

[commons-lang] branch master updated (3ac7922 -> 033cd48)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git.


    from 3ac7922  Bump biz.aQute.bnd:biz.aQute.bndlib from 6.1.0 to 6.2.0
     new 9658994  In-line only used once local variable.
     new 6dd2bce  Remove extra whitespace.
     new 033cd48  Javadoc typo.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

[commons-lang] 01/03: In-line only used once local variable.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 9658994c9a825ef369e6419173d5e665dcb7938f
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 20 13:15:04 2022 -0400

    In-line only used once local variable.
---
 src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
index 8d009e5..416f19f 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.lang3.concurrent;
 
-import java.util.concurrent.Callable;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -115,8 +114,7 @@ public class Memoizer<I, O> implements Computable<I, O> {
         while (true) {
             Future<O> future = cache.get(arg);
             if (future == null) {
-                final Callable<O> eval = () -> computable.compute(arg);
-                final FutureTask<O> futureTask = new FutureTask<>(eval);
+                final FutureTask<O> futureTask = new FutureTask<>(() -> computable.compute(arg));
                 future = cache.putIfAbsent(arg, futureTask);
                 if (future == null) {
                     future = futureTask;

[commons-lang] 03/03: Javadoc typo.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 033cd48313d7bd2e767d72804e160b2a190643f5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 20 13:25:59 2022 -0400

    Javadoc typo.
---
 src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
index 2dff568..5e3ff9e 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
@@ -98,7 +98,7 @@ public class Memoizer<I, O> implements Computable<I, O> {
      * </p>
      * <p>
      * This cache will also cache exceptions that occur during the computation
-     * if the {@code recalculate} parameter is the constructor was set to
+     * if the {@code recalculate} parameter in the constructor was set to
      * {@code false}, or not set. Otherwise, if an exception happened on the
      * previous calculation, the method will attempt again to generate a value.
      * </p>
@@ -112,7 +112,7 @@ public class Memoizer<I, O> implements Computable<I, O> {
     @Override
     public O compute(final I arg) throws InterruptedException {
         while (true) {
-            Future<O> future = cache.get(arg);
+            Future<O> future = cache.computeIfAbsent(arg, k->{return null;});
             if (future == null) {
                 final FutureTask<O> futureTask = new FutureTask<>(() -> computable.compute(arg));
                 future = cache.putIfAbsent(arg, futureTask);

[commons-lang] 02/03: Remove extra whitespace.

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit 6dd2bce1939ccd499cfcec46bb88e02559b851fc
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Mar 20 13:20:13 2022 -0400

    Remove extra whitespace.
---
 src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
index 416f19f..2dff568 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/Memoizer.java
@@ -129,7 +129,6 @@ public class Memoizer<I, O> implements Computable<I, O> {
                 if (recalculate) {
                     cache.remove(arg, future);
                 }
-
                 throw launderException(e.getCause());
             }
         }