Skip to content

Commit

Permalink
[JBPM-10242] Test do not like that containsKey is not there
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtirado committed Oct 2, 2024
1 parent 22f29fc commit 5fad599
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ public boolean removeJob(JobHandle jobHandle, Timer ejbTimer) {

public TimerJobInstance getTimerByName(String jobName) {
if (useLocalCache) {
TimerJobInstance found = localCache.get(jobName);
if (found != null) {
logger.debug("Timer {} found in cache", jobName);
if (localCache.containsKey(jobName)) {
TimerJobInstance found = localCache.get(jobName);
logger.debug("Found timer job instance with name {} in cache, returning {}", jobName, found);
return found;
}
logger.debug("Timer {} not found in cache", jobName);
logger.debug("Timer Job Instance with name {} not found in cache", jobName);
}
return linearSearch("search", jobName, (timer, job) -> {
if (useLocalCache) {
Expand Down Expand Up @@ -321,7 +321,7 @@ private <T> Optional<T> linearSearch(String suffix, String uuid, BiFunction<Time
if (handle.getUuid().equals(uuid)) {
logger.debug("UIID {} does match timer {} and handle {}", uuid, timer,
job.getTimerJobInstance());
return Optional.of(function.apply(timer, job.getTimerJobInstance()));
return Optional.ofNullable(function.apply(timer, job.getTimerJobInstance()));
}
}
} catch (NoSuchObjectLocalException e) {
Expand All @@ -335,7 +335,7 @@ private <T> Optional<T> linearSearch(String suffix, String uuid, BiFunction<Time

public void evictCache(JobHandle jobHandle) {
String jobName = ((EjbGlobalJobHandle) jobHandle).getUuid();
logger.debug("Invalidate job {} with job name {} in cache", jobName, localCache.remove(jobName));
logger.debug("Invalidate job {} with job name {} in cache", localCache.remove(jobName), jobName);
}

}

0 comments on commit 5fad599

Please sign in to comment.