Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cast into a local variable before dereferencing
  • Loading branch information
rom1v committed May 22, 2013
commit fddcc1b68fe156a14fb80557776c84a29f456d6f
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ private static Future<?> directExecute(Runnable runnable, int delay) {
if (!(executor instanceof ScheduledExecutorService)) {
throw new IllegalArgumentException("The executor set does not support scheduling");
}
future = ((ScheduledExecutorService) executor).schedule(runnable, delay, TimeUnit.MILLISECONDS);
ScheduledExecutorService scheduledExecutorService = (ScheduledExecutorService) executor;
future = scheduledExecutorService.schedule(runnable, delay, TimeUnit.MILLISECONDS);
} else {
/* no serial, no delay: execute now */
if (executor instanceof ExecutorService) {
future = ((ExecutorService) executor).submit(runnable);
ExecutorService executorService = (ExecutorService) executor;
future = executorService.submit(runnable);
} else {
/* non-cancellable task */
executor.execute(runnable);
Expand Down