Simplified ManagedAsyncClientConnection interface
This commit is contained in:
parent
447e276fb6
commit
a1d6db5ec3
|
@ -178,21 +178,13 @@ final class DefaultManagedAsyncClientConnection implements ManagedAsyncClientCon
|
|||
}
|
||||
|
||||
@Override
|
||||
public void submitPriorityCommand(final Command command) {
|
||||
public void submitCommand(final Command command, final Command.Priority priority) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(getId() + ": priority command " + command);
|
||||
log.debug(getId() + ": " + command.getClass().getSimpleName() + " with " + priority + " priority");
|
||||
}
|
||||
ioSession.enqueue(command, Command.Priority.IMMEDIATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submitCommand(final Command command) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(getId() + ": command " + command);
|
||||
}
|
||||
ioSession.enqueue(command, Command.Priority.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void passivate() {
|
||||
ioSession.setSocketTimeoutMillis(0);
|
||||
|
|
|
@ -73,6 +73,7 @@ import org.apache.hc.core5.pool.PoolEntry;
|
|||
import org.apache.hc.core5.pool.PoolReusePolicy;
|
||||
import org.apache.hc.core5.pool.PoolStats;
|
||||
import org.apache.hc.core5.pool.StrictConnPool;
|
||||
import org.apache.hc.core5.reactor.Command;
|
||||
import org.apache.hc.core5.reactor.ConnectionInitiator;
|
||||
import org.apache.hc.core5.util.Args;
|
||||
import org.apache.hc.core5.util.Asserts;
|
||||
|
@ -247,7 +248,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
|
|||
poolEntry.getUpdated() + timeValue.toMillis() <= System.currentTimeMillis()) {
|
||||
final ProtocolVersion protocolVersion = connection.getProtocolVersion();
|
||||
if (HttpVersion.HTTP_2_0.greaterEquals(protocolVersion)) {
|
||||
connection.submitPriorityCommand(new PingCommand(new BasicPingHandler(new Callback<Boolean>() {
|
||||
connection.submitCommand(new PingCommand(new BasicPingHandler(new Callback<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void execute(final Boolean result) {
|
||||
|
@ -260,7 +261,7 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
|
|||
leaseCompleted(poolEntry);
|
||||
}
|
||||
|
||||
})));
|
||||
})), Command.Priority.IMMEDIATE);
|
||||
} else {
|
||||
if (!connection.isOpen()) {
|
||||
if (log.isDebugEnabled()) {
|
||||
|
@ -564,7 +565,9 @@ public class PoolingAsyncClientConnectionManager implements AsyncClientConnectio
|
|||
log.debug(id + ": executing exchange " + ConnPoolSupport.getId(exchangeHandler) +
|
||||
" over " + ConnPoolSupport.getId(connection));
|
||||
}
|
||||
connection.submitCommand(new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, context));
|
||||
connection.submitCommand(
|
||||
new RequestExecutionCommand(exchangeHandler, pushHandlerFactory, context),
|
||||
Command.Priority.NORMAL);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,9 +35,7 @@ import org.apache.hc.core5.reactor.ssl.TransportSecurityLayer;
|
|||
@Internal
|
||||
public interface ManagedAsyncClientConnection extends HttpConnection, TransportSecurityLayer {
|
||||
|
||||
void submitPriorityCommand(Command command);
|
||||
|
||||
void submitCommand(Command command);
|
||||
void submitCommand(Command command, Command.Priority priority);
|
||||
|
||||
/**
|
||||
* Puts the connection into idle mode.
|
||||
|
|
Loading…
Reference in New Issue