public void removeFromCache(String processId, long processInstanceId) { String businessId = businessIdCache.get(processInstanceId); if (StringUtils.isNotBlank(businessId)) { processInstanceIdCache.remove(processId + "_" + businessId); businessIdCache.remove(processInstanceId); ProcessInstanceBOInfo info = processInstanceBOService.getProcessInstanceBOInfo(processInstanceId); if (info != null) { processInstanceBOService.removeProcessInstanceBOInfo(info); } } }
public String getBusinessId(Long processInstanceId) { String businessId = businessIdCache.get(processInstanceId); if (businessId == null) { synchronized (ProcessInstanceBOCache.class) { if (businessId == null) { logger.info("fetch from database"); ProcessInstanceBOInfo info = processInstanceBOService.getProcessInstanceBOInfo(processInstanceId); businessId = info != null ? info.getBusinessId() : null; if (businessId != null) { put(info.getProcessId(), businessId, processInstanceId); } } } } return businessId; }
public Long getProcessInstanceId(String processId, String businessId) { Long value = processInstanceIdCache.get(processId + "_" + businessId); if (value == null) { synchronized (ProcessInstanceBOCache.class) { if (value == null) { logger.info("fetch from database"); ProcessInstanceBOInfo info = processInstanceBOService.getProcessInstanceBOInfo(processId, businessId); value = info != null ? info.getProcessInstanceId() : null; if (value != null) { put(processId, businessId, value); } } } } return value; }