public Answer retry(final Command command, final Class<? extends Answer> answerClass, final Exception error) { if (commandsToRetry.containsKey(command)) { Integer numRetries = commandsToRetry.get(command); if (numRetries > ZERO) { commandsToRetry.put(command, --numRetries); s_logger.warn("Retrying " + command.getClass().getSimpleName() + ". Number of retries remaining: " + numRetries); return serverResource.executeRequest(command); } else { commandsToRetry.remove(command); } } try { final Constructor<? extends Answer> answerConstructor = answerClass.getConstructor(Command.class, Exception.class); return answerConstructor.newInstance(command, error); } catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { return Answer.createUnsupportedCommandAnswer(command); } } }
@Override public Answer sendMessage(Command cmd) { if ((cmd instanceof CopyCommand) || (cmd instanceof DownloadCommand)) { return resource.executeRequest(cmd); } // TODO Auto-generated method stub return new Answer(cmd, false, "unsupported command:" + cmd.toString()); }
_resource.executeRequest(new PostCertificateRenewalCommand());
answer = resource.executeRequest(cmds[i]); if (answer == null) { s_logger.warn("Resource returned null answer!");
answer = resource.executeRequest(cmds[i]); if (answer == null) { s_logger.warn("Resource returned null answer!");
_inProgress.incrementAndGet(); try { answer = _resource.executeRequest(command); } finally { _inProgress.decrementAndGet();
answer = _resource.executeRequest(cmd); } finally { _inProgress.decrementAndGet();