Skip to content

Commit

Permalink
Switch from j.u.l to the platform API (fixes #456)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-manes committed Feb 8, 2021
1 parent 29bdac7 commit 7454499
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.lang.ref.WeakReference;
Expand Down Expand Up @@ -65,8 +67,6 @@
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
Expand Down Expand Up @@ -181,7 +181,7 @@ abstract class BoundedLocalCache<K, V> extends BLCHeader.DrainStatusRef<K, V>
* http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf
*/

static final Logger logger = Logger.getLogger(BoundedLocalCache.class.getName());
static final Logger logger = System.getLogger(BoundedLocalCache.class.getName());

/** The number of CPUs */
static final int NCPU = Runtime.getRuntime().availableProcessors();
Expand Down Expand Up @@ -338,7 +338,7 @@ public void notifyRemoval(@Nullable K key, @Nullable V value, RemovalCause cause
try {
executor.execute(task);
} catch (Throwable t) {
logger.log(Level.SEVERE, "Exception thrown when submitting removal listener", t);
logger.log(Level.ERROR, "Exception thrown when submitting removal listener", t);
task.run();
}
}
Expand Down Expand Up @@ -1234,7 +1234,7 @@ void refreshIfNeeded(Node<K, V> node, long now) {
});
} catch (Throwable t) {
node.casWriteTime(refreshWriteTime, oldWriteTime);
logger.log(Level.SEVERE, "Exception thrown when submitting refresh task", t);
logger.log(Level.ERROR, "Exception thrown when submitting refresh task", t);
}
}
}
Expand Down Expand Up @@ -1364,7 +1364,7 @@ void afterWrite(Runnable task) {
try {
performCleanUp(task);
} catch (RuntimeException e) {
logger.log(Level.SEVERE, "Exception thrown when performing the maintenance task", e);
logger.log(Level.ERROR, "Exception thrown when performing the maintenance task", e);
}
} else {
scheduleAfterWrite();
Expand Down Expand Up @@ -1430,7 +1430,7 @@ public void cleanUp() {
try {
performCleanUp(/* ignored */ null);
} catch (RuntimeException e) {
logger.log(Level.SEVERE, "Exception thrown when performing the maintenance task", e);
logger.log(Level.ERROR, "Exception thrown when performing the maintenance task", e);
}
}

Expand Down Expand Up @@ -3279,7 +3279,7 @@ public boolean exec() {
try {
run();
} catch (Throwable t) {
logger.log(Level.SEVERE, "Exception thrown when performing the maintenance task", t);
logger.log(Level.ERROR, "Exception thrown when performing the maintenance task", t);
}

// Indicates that the task has not completed to allow subsequent submissions to execute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import static java.util.Locale.US;
import static java.util.Objects.requireNonNull;

import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.lang.ref.SoftReference;
import java.lang.ref.WeakReference;
import java.time.Duration;
Expand All @@ -32,8 +34,6 @@
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.nullness.qual.NonNull;
Expand Down Expand Up @@ -136,7 +136,7 @@
* #removalListener}
*/
public final class Caffeine<K, V> {
static final Logger logger = Logger.getLogger(Caffeine.class.getName());
static final Logger logger = System.getLogger(Caffeine.class.getName());
static final Supplier<StatsCounter> ENABLED_STATS_COUNTER_SUPPLIER = ConcurrentStatsCounter::new;

enum Strength { WEAK, SOFT }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public interface LoadingCache<K, V> extends Cache<K, V> {
* previous value (if any) will continue to be returned by {@code get(key)} unless it is evicted.
* If the new value is loaded successfully it will replace the previous value in the cache; if an
* exception is thrown while refreshing the previous value will remain, <i>and the exception will
* be logged (using {@link java.util.logging.Logger}) and swallowed</i>.
* be logged (using {@link System.Logger}) and swallowed</i>.
* <p>
* Caches loaded by a {@link CacheLoader} will call {@link CacheLoader#reload} if the cache
* currently contains a value for the {@code key}, and {@link CacheLoader#load} otherwise. Loading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import static java.util.Objects.requireNonNull;

import java.io.Serializable;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.util.AbstractCollection;
import java.util.AbstractMap;
import java.util.AbstractSet;
Expand All @@ -39,8 +41,6 @@
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
Expand All @@ -55,7 +55,7 @@
* @author [email protected] (Ben Manes)
*/
interface LocalAsyncCache<K, V> extends AsyncCache<K, V> {
Logger logger = Logger.getLogger(LocalAsyncCache.class.getName());
Logger logger = System.getLogger(LocalAsyncCache.class.getName());

/** Returns the backing {@link LocalCache} data store. */
LocalCache<K, CompletableFuture<V>> cache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

import static java.util.Objects.requireNonNull;

import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.lang.reflect.Method;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.checkerframework.checker.nullness.qual.Nullable;

Expand All @@ -36,7 +36,7 @@
*/
abstract class LocalAsyncLoadingCache<K, V>
implements LocalAsyncCache<K, V>, AsyncLoadingCache<K, V> {
static final Logger logger = Logger.getLogger(LocalAsyncLoadingCache.class.getName());
static final Logger logger = System.getLogger(LocalAsyncLoadingCache.class.getName());

final boolean canBulkLoad;
final AsyncCacheLoader<K, V> loader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import static java.util.Objects.requireNonNull;

import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.LinkedHashMap;
Expand All @@ -26,8 +28,6 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.checkerframework.checker.nullness.qual.Nullable;

Expand All @@ -38,7 +38,7 @@
* @author [email protected] (Ben Manes)
*/
interface LocalLoadingCache<K, V> extends LocalManualCache<K, V>, LoadingCache<K, V> {
Logger logger = Logger.getLogger(LocalLoadingCache.class.getName());
Logger logger = System.getLogger(LocalLoadingCache.class.getName());

/** Returns the {@link CacheLoader} used by this cache. */
CacheLoader<? super K, V> cacheLoader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
import static java.util.Objects.requireNonNull;

import java.io.Serializable;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.checkerframework.checker.index.qual.Positive;
import org.checkerframework.checker.nullness.qual.NonNull;
Expand Down Expand Up @@ -104,7 +104,7 @@ public Future<?> schedule(Executor executor, Runnable command, long delay, TimeU
}

final class ExecutorServiceScheduler implements Scheduler, Serializable {
static final Logger logger = Logger.getLogger(ExecutorServiceScheduler.class.getName());
static final Logger logger = System.getLogger(ExecutorServiceScheduler.class.getName());
static final long serialVersionUID = 1;

final ScheduledExecutorService scheduledExecutorService;
Expand Down Expand Up @@ -134,7 +134,7 @@ public Future<?> schedule(Executor executor, Runnable command, long delay, TimeU
}

final class GuardedScheduler implements Scheduler, Serializable {
static final Logger logger = Logger.getLogger(GuardedScheduler.class.getName());
static final Logger logger = System.getLogger(GuardedScheduler.class.getName());
static final long serialVersionUID = 1;

final Scheduler delegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

import static java.util.Objects.requireNonNull;

import java.util.logging.Level;
import java.util.logging.Logger;
import java.lang.System.Logger;
import java.lang.System.Logger.Level;

import com.github.benmanes.caffeine.cache.RemovalCause;

Expand All @@ -30,7 +30,7 @@
*/
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
final class GuardedStatsCounter implements StatsCounter {
static final Logger logger = Logger.getLogger(GuardedStatsCounter.class.getName());
static final Logger logger = System.getLogger(GuardedStatsCounter.class.getName());

final StatsCounter delegate;

Expand Down

0 comments on commit 7454499

Please sign in to comment.