Skip to content

Commit 333b776

Browse files
committed
Rename config option
1 parent ff98d9a commit 333b776

File tree

7 files changed

+22
-20
lines changed

7 files changed

+22
-20
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ Snapshots of the development version is available in
3333
In addition Caffeine offers extensions for [tracing][3], [simulation][4], [JSR-107 JCache][5],
3434
and [Guava][6] adapters.
3535

36-
[1]: https://github.com/ben-manes/caffeine/wiki
37-
[2]: https://github.com/ben-manes/caffeine/wiki/Benchmarks
36+
[1]: https://github.com/ben-manes/caffeine/wiki/Benchmarks
37+
[2]: https://github.com/ben-manes/caffeine/wiki
3838
[3]: https://github.com/ben-manes/caffeine/wiki/Tracing
3939
[4]: https://github.com/ben-manes/caffeine/wiki/Simulator
4040
[5]: https://github.com/ben-manes/caffeine/wiki/JCache

build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ subprojects { proj ->
3030
if (proj.name == 'tracing') {
3131
return
3232
}
33-
3433
apply plugin: 'com.github.ethankhall.semantic-versioning'
3534
apply plugin: 'org.dm.bundle'
3635
apply plugin: 'errorprone'

caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,17 @@ protected boolean hasRemovalListener() {
219219
/** Asynchronously sends a removal notification to the listener. */
220220
void notifyRemoval(@Nullable K key, @Nullable V value, RemovalCause cause) {
221221
requireState(hasRemovalListener(), "Notification should be guarded with a check");
222-
executor().execute(() -> {
223-
try {
224-
removalListener().onRemoval(new RemovalNotification<K, V>(key, value, cause));
225-
} catch (Throwable t) {
226-
logger.log(Level.WARNING, "Exception thrown by removal listener", t);
227-
}
228-
});
222+
try {
223+
executor().execute(() -> {
224+
try {
225+
removalListener().onRemoval(new RemovalNotification<K, V>(key, value, cause));
226+
} catch (Throwable t) {
227+
logger.log(Level.WARNING, "Exception thrown by removal listener", t);
228+
}
229+
});
230+
} catch (Throwable t) {
231+
logger.log(Level.SEVERE, "Exception thrown when submitting removal listener", t);
232+
}
229233
}
230234

231235
/* ---------------- Reference Support -------------- */

caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ Supplier<? extends StatsCounter> getStatsCounterSupplier() {
683683
* @throws NullPointerException if the specified supplier is null
684684
*/
685685
@Nonnull
686-
public Caffeine<K, V> named(@Nonnull Supplier<String> nameSupplier) {
686+
public Caffeine<K, V> name(@Nonnull Supplier<String> nameSupplier) {
687687
requireState(this.nameSupplier == null);
688688
this.nameSupplier = requireNonNull(nameSupplier);
689689
return this;

caffeine/src/test/java/com/github/benmanes/caffeine/cache/BoundedLocalCacheTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import java.util.Map.Entry;
3030
import java.util.concurrent.Executor;
3131
import java.util.concurrent.Executors;
32-
import java.util.concurrent.RejectedExecutionException;
3332
import java.util.concurrent.atomic.AtomicBoolean;
3433

3534
import org.testng.annotations.Listeners;
@@ -88,7 +87,7 @@ public void putWeighted_noOverflow() {
8887
assertThat(map.adjustedWeightedSize(), is(BoundedLocalCache.MAXIMUM_CAPACITY));
8988
}
9089

91-
@Test(dataProvider = "caches", expectedExceptions = RejectedExecutionException.class)
90+
@Test(dataProvider = "caches")
9291
@CacheSpec(compute = Compute.SYNC, implementation = Implementation.Caffeine,
9392
population = Population.FULL, maximumSize = MaximumSize.FULL,
9493
executor = CacheExecutor.REJECTING, removalListener = Listener.CONSUMING)

caffeine/src/test/java/com/github/benmanes/caffeine/cache/CaffeineTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -411,19 +411,19 @@ public void removalListener() {
411411
/* ---------------- named -------------- */
412412

413413
@Test(expectedExceptions = NullPointerException.class)
414-
public void named_null() {
415-
Caffeine.newBuilder().named(null);
414+
public void name_null() {
415+
Caffeine.newBuilder().name(null);
416416
}
417417

418418
@Test(expectedExceptions = IllegalStateException.class)
419-
public void named_twice() {
420-
Caffeine.newBuilder().named(() -> "a").named(() -> "b");
419+
public void name_twice() {
420+
Caffeine.newBuilder().name(() -> "a").name(() -> "b");
421421
}
422422

423423
@Test
424-
public void named() {
424+
public void name() {
425425
Supplier<String> nameSupplier = () -> "a";
426-
Caffeine<?, ?> builder = Caffeine.newBuilder().named(nameSupplier);
426+
Caffeine<?, ?> builder = Caffeine.newBuilder().name(nameSupplier);
427427
assertThat(builder.nameSupplier, is(nameSupplier));
428428
builder.build();
429429
}

jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ private final class Builder<K, V> {
117117
this.statistics = new JCacheStatisticsMXBean();
118118
this.expiry = config.getExpiryPolicyFactory().create();
119119

120-
caffeine.named(cacheName::toString);
120+
caffeine.name(cacheName::toString);
121121
if (config.getCacheLoaderFactory() != null) {
122122
cacheLoader = config.getCacheLoaderFactory().create();
123123
}

0 commit comments

Comments
 (0)