use of org.apache.hc.core5.http.RequestNotExecutedException in project httpcomponents-core by apache.
the class CommandSupport method cancelCommands.
/**
* Cancels all pending session {@link Command}s.
*/
public static void cancelCommands(final IOSession ioSession) {
Args.notNull(ioSession, "I/O session");
Command command;
while ((command = ioSession.poll()) != null) {
if (command instanceof ExecutableCommand) {
if (!ioSession.isOpen()) {
((ExecutableCommand) command).failed(new RequestNotExecutedException());
} else {
command.cancel();
}
} else {
command.cancel();
}
}
}
Aggregations