private ActiveJob getActiveJob(Long activeJobId) { String activeJobKey = cacheKeyForActiveJob(activeJobId); ActiveJob activeJob = (ActiveJob) goCache.get(activeJobKey); if (activeJob == null) { synchronized (activeJobKey) { activeJob = (ActiveJob) goCache.get(activeJobKey); if (activeJob == null) { activeJob = _getActiveJob(activeJobId); if (activeJob != null) { // could have changed to not active and consquently no match found cacheActiveJob(activeJob); } } } } return activeJob; // TODO: clone it, caller may mutate }