mbaedke commented on code in PR #3185:
URL: https://github.com/apache/jackrabbit-oak/pull/3185#discussion_r4314484250
##########
oak-core-spi/src/test/java/org/apache/jackrabbit/oak/cache/impl/maintenance/CacheBuilderMaintenanceTest.java:
##########
@@ -366,4 +344,281 @@ public void
replacingAnEntryNotifiesListenerOffCallerThread() throws Interrupted
Assert.assertNotSame("replacement notification must not run on the
calling thread",
Thread.currentThread(), notificationThread.get());
}
+
+
+ /** Reject null rather than silently choosing a mode. */
+ @Test(expected = NullPointerException.class)
+ public void nullMaintenanceModeIsRejected() {
+ CacheBuilder.newBuilder().maintenanceMode(null);
+ }
+
+ /** An explicit ASYNC request wins over the disabled legacy toggle. */
+ @Test
+ public void explicitAsyncModeOverridesLegacyToggle() throws
InterruptedException {
+ boolean incoming =
CacheBuilder.FT_OAK_12290_ASYNC_CACHE_MAINTENANCE_ENABLED.get();
+ try {
+
CacheBuilder.FT_OAK_12290_ASYNC_CACHE_MAINTENANCE_ENABLED.set(false);
+ AtomicReference<Thread> callbackThread = new AtomicReference<>();
+ CountDownLatch removed = new CountDownLatch(1);
+ Cache<String, String> cache = CacheBuilder.<String,
String>newBuilder()
+ .maximumSize(1)
+ .maintenanceMode(CacheBuilder.MaintenanceMode.SYNC)
+ .maintenanceMode(CacheBuilder.MaintenanceMode.ASYNC)
Review Comment:
What's the point of setting it to SYNC first?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]