Skip to content

Commit

Permalink
MONDRIAN: Fixes an issue with the test suite and the SegmentCache pro…
Browse files Browse the repository at this point in the history
…perty. Setting it to null at runtime wouldn't disable the cache if one was previously configured.

[git-p4: depot-paths = "//open/mondrian/": change = 14707]
  • Loading branch information
lucboudreau committed Oct 20, 2011
1 parent d14cac7 commit 8c84c94
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/mondrian/rolap/agg/SegmentCacheWorker.java
Expand Up @@ -38,11 +38,13 @@ public final class SegmentCacheWorker {

// Always call prior to using segmentCache
private synchronized static void initCache() {
boolean segmentCacheFound = false;
// First try to get the segmentcache impl class from
// mondrian properties.
final String cacheName =
MondrianProperties.instance().SegmentCache.get();
if (cacheName != null) {
segmentCacheFound = true;
setCache(cacheName);
}

Expand All @@ -55,9 +57,15 @@ private synchronized static void initCache() {
serviceDiscovery.getImplementor();
if (implementors.size() > 0) {
// The contract is to use the first implementation found.
segmentCacheFound = true;
setCache(implementors.get(0).getName());
}
}

if (!segmentCacheFound) {
// No cache were found. Let's disable it.
setCache(null);
}
}

/**
Expand Down

0 comments on commit 8c84c94

Please sign in to comment.