use of org.hotswap.agent.command.MergeableCommand in project HotswapAgent by HotswapProjects.
the class SchedulerImpl method scheduleCommand.
@Override
public void scheduleCommand(Command command, int timeout, DuplicateSheduleBehaviour behaviour) {
synchronized (scheduledCommands) {
Command targetCommand = command;
if (scheduledCommands.containsKey(command) && (command instanceof MergeableCommand)) {
// get existing equals command and merge it
for (Command scheduledCommand : scheduledCommands.keySet()) {
if (command.equals(scheduledCommand)) {
targetCommand = ((MergeableCommand) command).merge(scheduledCommand);
break;
}
}
}
// map may already contain equals command, put will replace it and reset timer
scheduledCommands.put(targetCommand, new DuplicateScheduleConfig(System.currentTimeMillis() + timeout, behaviour));
LOGGER.trace("{} scheduled for execution in {}ms", targetCommand, timeout);
}
}
Aggregations