protected void initializeEntityCache() { final JobExecutorContext jobExecutorContext = Context.getJobExecutorContext(); final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); if (processEngineConfiguration != null && processEngineConfiguration.isDbEntityCacheReuseEnabled() && jobExecutorContext != null) { dbEntityCache = jobExecutorContext.getEntityCache(); if (dbEntityCache == null) { dbEntityCache = new DbEntityCache(processEngineConfiguration.getDbEntityCacheKeyMapping()); jobExecutorContext.setEntityCache(dbEntityCache); } } else { if (processEngineConfiguration != null) { dbEntityCache = new DbEntityCache(processEngineConfiguration.getDbEntityCacheKeyMapping()); } else { dbEntityCache = new DbEntityCache(); } } }