Skip to content

Commit

Permalink
gh-2890 cache service single static instance bug removal. K.I.S.S Tes…
Browse files Browse the repository at this point in the history
…t fix
  • Loading branch information
GCHQDev404 committed Feb 18, 2023
1 parent 2a2d2b0 commit 517580c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ public static void initialise(final Properties properties) {
}
return;
}

if (isEnabled()) {
LOGGER.debug("Will not initialise as Cache service was already enabled.");
return;
}

try {
service = Class.forName(cacheClass).asSubclass(ICacheService.class).newInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void overwriteCacheProperty(final OP operation, final Store store) {
* cache to another cache, or re-initialises the cache.
*/
final StoreProperties storeProperties = operation.getStoreProperties();
if (storeProperties.containsKey(CACHE_SERVICE_CLASS)) {
if (nonNull(storeProperties) && storeProperties.containsKey(CACHE_SERVICE_CLASS)) {
LOGGER.info(String.format("%s is removing %s from properties of the operation and substituting the FederatedStore's cache", this.getClass().getSimpleName(), CACHE_SERVICE_CLASS));
storeProperties.setCacheServiceClass(store.getProperties().getCacheServiceClass());
operation.setStoreProperties(storeProperties);
Expand Down

0 comments on commit 517580c

Please sign in to comment.