Relax CF target cache limit so it works better with multipe active targets.

This commit is contained in:
Kris De Volder
2017-06-30 16:37:12 -07:00
parent 8d570e748e
commit 4bf488cb98
3 changed files with 6 additions and 3 deletions

View File

@@ -65,7 +65,7 @@ public class CFTarget {
}
};
this.stacksCache = CacheBuilder.newBuilder()
.expireAfterAccess(CFTargetCache.SERVICES_EXPIRATION.toMillis(), TimeUnit.MILLISECONDS).build(stacksLoader);
.expireAfterAccess(CFTargetCache.TARGET_EXPIRATION.toMillis(), TimeUnit.MILLISECONDS).build(stacksLoader);
CacheLoader<String, List<CFServiceInstance>> servicesLoader = new CacheLoader<String, List<CFServiceInstance>>() {

View File

@@ -43,6 +43,10 @@ public class CFTargetCache {
this.cfClientConfig = cfClientConfig;
this.clientFactory = clientFactory;
this.timeouts = timeouts;
//TODO: I suspect that addClientParamsProviderChangedListener below is not necessary.
// I think it results in unnessary refreshes of the cache, any time the providers are
// changed. The cached results doesn't really depend on the providers, only on the targets. So I think,
// it shouldn't need to refresh when the providers are changed.
cfClientConfig.addClientParamsProviderChangedListener((newProvider, oldProvider) -> initCache());
initCache();
}
@@ -56,7 +60,7 @@ public class CFTargetCache {
}
};
cache = CacheBuilder.newBuilder().maximumSize(1).expireAfterAccess(TARGET_EXPIRATION.toMillis(), TimeUnit.MILLISECONDS)
cache = CacheBuilder.newBuilder()./*maximumSize(1).*/expireAfterAccess(TARGET_EXPIRATION.toMillis(), TimeUnit.MILLISECONDS)
.build(loader);
this.cacheCallableContext = new CFCallableContext(cfClientConfig.getClientParamsProvider().getMessages());
}

View File

@@ -16,7 +16,6 @@ import java.util.concurrent.Callable;
import org.springframework.ide.vscode.commons.languageserver.reconcile.IProblemCollector;
import org.springframework.ide.vscode.commons.util.IntegerRange;
import org.springframework.ide.vscode.commons.util.Log;
import org.springframework.ide.vscode.commons.util.Renderable;
import org.springframework.ide.vscode.commons.util.Renderables;
import org.springframework.ide.vscode.commons.util.ValueParsers;