rschmitt commented on a change in pull request #277:
URL:
https://github.com/apache/httpcomponents-core/pull/277#discussion_r605128093
##########
File path: httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
##########
@@ -172,7 +175,20 @@ public void close() {
Args.notNull(requestTimeout, "Request timeout");
Asserts.check(!this.isShutDown.get(), "Connection pool shut down");
final Deadline deadline = Deadline.calculate(requestTimeout);
- final BasicFuture<PoolEntry<T, C>> future = new
BasicFuture<>(callback);
+ final BasicFuture<PoolEntry<T, C>> future = new
BasicFuture<PoolEntry<T, C>>(callback) {
+
+ @Override
+ public synchronized PoolEntry<T, C> get(
+ final long timeout, final TimeUnit unit) throws
InterruptedException, ExecutionException, TimeoutException {
+ try {
+ return super.get(timeout, unit);
+ } catch (final TimeoutException ex) {
+ cancel();
+ throw ex;
+ }
+ }
+
+ };
Review comment:
Bad abstractions are a bigger maintenance burden than duplication.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]