@SuppressWarnings("unchecked") private void updateJobInScheduleCache(Job job) { Long scheduleId = job.getKey().getParent().getId(); Object entityCacheKey = getEntityCacheKey(Schedule.class, scheduleId); Schedule schedule = (Schedule) cache.get(entityCacheKey); if (schedule == null) { return; // Nothing to update } schedule.updateJob(job); cache.put(entityCacheKey, schedule); }
@SuppressWarnings("unchecked") @Override public void update(Job job, boolean commitAfter) { super.update(job, commitAfter); Object entityCacheKey = getEntityCacheKey(Job.class, getJobWideUniqueData(job.getKey())); Job cachedJob = (Job) cache.get(entityCacheKey); if (cachedJob != null) { if (!cachedJob.getCronString().equals(job.getCronString())) { abandonJobsByCronStringCache(cachedJob.getCronString()); abandonJobsByCronStringCache(job.getCronString()); } cache.put(entityCacheKey, job); } else { abandonJobsByCronStringCache(); } updateJobInScheduleCache(job); }