use of edu.stanford.bmir.protege.web.client.dispatch.cache.ResultCache in project webprotege by protegeproject.
the class DispatchServiceManager method getResultCache.
private ResultCache getResultCache(ProjectId projectId, EventBus eventBus) {
ResultCache resultCache = resultCacheMap.get(projectId);
if (resultCache == null) {
resultCache = new ResultCache(projectId, eventBus);
resultCacheMap.put(projectId, resultCache);
}
return resultCache;
}
use of edu.stanford.bmir.protege.web.client.dispatch.cache.ResultCache in project webprotege by protegeproject.
the class DispatchServiceManager method execute.
@SuppressWarnings("unchecked")
public <A extends Action<R>, R extends Result> void execute(A action, final DispatchServiceCallback<R> callback) {
callback.handleSubmittedForExecution();
if (action instanceof HasProjectId) {
ProjectId projectId = ((HasProjectId) action).getProjectId();
ResultCache resultCache = getResultCache(projectId, eventBus);
Optional<R> result = resultCache.getCachedResult(action);
if (result.isPresent()) {
callback.onSuccess(result.get());
return;
}
}
requestCount++;
GWT.log("[Dispatch] Executing action " + requestCount + " " + action.getClass().getSimpleName());
async.executeAction(action, new AsyncCallbackProxy(action, callback));
}
Aggregations