This is an automated email from the ASF dual-hosted git repository. edcoleman pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 6157003ff5 rename method getWithoutCaching to getIfCached (#3029) 6157003ff5 is described below commit 6157003ff565d19bcf13663de6d959e9531da48d Author: EdColeman <d...@etcoleman.com> AuthorDate: Tue Oct 18 11:02:24 2022 -0400 rename method getWithoutCaching to getIfCached (#3029) --- .../org/apache/accumulo/server/conf/store/PropStore.java | 2 +- .../server/conf/store/impl/PropCacheCaffeineImpl.java | 2 +- .../accumulo/server/conf/store/impl/ZooPropStore.java | 8 ++++---- .../conf/store/impl/PropCacheCaffeineImplTest.java | 8 ++++---- .../server/conf/store/impl/ZooPropLoaderTest.java | 16 ++++++++-------- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/store/PropStore.java b/server/base/src/main/java/org/apache/accumulo/server/conf/store/PropStore.java index 59f0fb436b..71af5eacce 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/store/PropStore.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/store/PropStore.java @@ -136,7 +136,7 @@ public interface PropStore { PropCache getCache(); @Nullable - VersionedProperties getWithoutCaching(PropStoreKey<?> propStoreKey); + VersionedProperties getIfCached(PropStoreKey<?> propStoreKey); /** * Compare the stored data version with the expected version. Notifies subscribers of the change diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/PropCacheCaffeineImpl.java b/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/PropCacheCaffeineImpl.java index 0cf901511d..fc57396179 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/PropCacheCaffeineImpl.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/PropCacheCaffeineImpl.java @@ -109,7 +109,7 @@ public class PropCacheCaffeineImpl implements PropCache { * the property id * @return the version properties if cached, otherwise return null. */ - public @Nullable VersionedProperties getWithoutCaching(PropStoreKey<?> propStoreKey) { + public @Nullable VersionedProperties getIfCached(PropStoreKey<?> propStoreKey) { return cache.getIfPresent(propStoreKey); } diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java b/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java index fde68443c7..d9a8e2d516 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/store/impl/ZooPropStore.java @@ -291,7 +291,7 @@ public class ZooPropStore implements PropStore, PropChangeListener { try { - VersionedProperties vProps = cache.getWithoutCaching(propStoreKey); + VersionedProperties vProps = cache.getIfCached(propStoreKey); if (vProps == null) { vProps = readPropsFromZk(propStoreKey); } @@ -330,7 +330,7 @@ public class ZooPropStore implements PropStore, PropChangeListener { try { // Grab the current properties - VersionedProperties vProps = cache.getWithoutCaching(propStoreKey); + VersionedProperties vProps = cache.getIfCached(propStoreKey); if (vProps == null) { vProps = readPropsFromZk(propStoreKey); } @@ -451,8 +451,8 @@ public class ZooPropStore implements PropStore, PropChangeListener { } @Override - public @Nullable VersionedProperties getWithoutCaching(PropStoreKey<?> propStoreKey) { - return cache.getWithoutCaching(propStoreKey); + public @Nullable VersionedProperties getIfCached(PropStoreKey<?> propStoreKey) { + return cache.getIfCached(propStoreKey); } @Override diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/PropCacheCaffeineImplTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/PropCacheCaffeineImplTest.java index 409b10719c..1121b2b726 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/PropCacheCaffeineImplTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/PropCacheCaffeineImplTest.java @@ -115,11 +115,11 @@ public class PropCacheCaffeineImplTest { expect(zooPropLoader.load(eq(table2PropKey))).andReturn(vProps).once(); replay(context, propStoreWatcher, zooPropLoader); - var props = cache.getWithoutCaching(tablePropKey); + var props = cache.getIfCached(tablePropKey); assertNull(props); assertNotNull(cache.get(table2PropKey)); // load into cache - assertNotNull(cache.getWithoutCaching(table2PropKey)); // read from cache - no load call. + assertNotNull(cache.getIfCached(table2PropKey)); // read from cache - no load call. } @Test @@ -149,8 +149,8 @@ public class PropCacheCaffeineImplTest { cache.removeAll(); // check that values are not in cache - will not call load - assertNull(cache.getWithoutCaching(tablePropKey)); - assertNull(cache.getWithoutCaching(table2PropKey)); + assertNull(cache.getIfCached(tablePropKey)); + assertNull(cache.getIfCached(table2PropKey)); } @Test diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/ZooPropLoaderTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/ZooPropLoaderTest.java index 9dd18d7a3c..76de2b7780 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/ZooPropLoaderTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/store/impl/ZooPropLoaderTest.java @@ -267,14 +267,14 @@ public class ZooPropLoaderTest { } @Test - public void getWithoutCachingTest() { + public void getIfCachedTest() { replay(context, zrw, propStoreWatcher, cacheMetrics); PropCacheCaffeineImpl cache = new PropCacheCaffeineImpl.Builder(loader, cacheMetrics).forTests(ticker).build(); - assertNull(cache.getWithoutCaching(propStoreKey)); + assertNull(cache.getIfCached(propStoreKey)); } @@ -305,8 +305,8 @@ public class ZooPropLoaderTest { cache.remove(tablePropKey); // verify retrieved from cache without loading. - assertNotNull(cache.getWithoutCaching(sysPropKey)); - assertNull(cache.getWithoutCaching(tablePropKey)); + assertNotNull(cache.getIfCached(sysPropKey)); + assertNull(cache.getIfCached(tablePropKey)); } @Test @@ -336,19 +336,19 @@ public class ZooPropLoaderTest { cache.removeAll(); // verify retrieved from cache without loading. - assertNull(cache.getWithoutCaching(sysPropKey)); - assertNull(cache.getWithoutCaching(tablePropKey)); + assertNull(cache.getIfCached(sysPropKey)); + assertNull(cache.getIfCached(tablePropKey)); } @Test - public void getWithoutCachingNotPresentTest() { + public void getIfCachedNotPresentTest() { replay(context, zrw, propStoreWatcher, cacheMetrics); PropCacheCaffeineImpl cache = new PropCacheCaffeineImpl.Builder(loader, cacheMetrics).forTests(ticker).build(); // load into cache - assertNull(cache.getWithoutCaching(propStoreKey)); + assertNull(cache.getIfCached(propStoreKey)); } @Test