cwildman commented on a change in pull request #163: Allow for timeout while 
acquiring lock in StrictConnPool.
URL: 
https://github.com/apache/httpcomponents-core/pull/163#discussion_r356768486
 
 

 ##########
 File path: httpcore5/src/main/java/org/apache/hc/core5/pool/StrictConnPool.java
 ##########
 @@ -171,21 +171,33 @@ public void close() {
         Args.notNull(route, "Route");
         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);
-        this.lock.lock();
+        boolean acquiredLock = false;
+
         try {
-            final LeaseRequest<T, C> request = new LeaseRequest<>(route, 
state, requestTimeout, future);
-            final boolean completed = processPendingRequest(request);
-            if (!request.isDone() && !completed) {
-                this.leasingRequests.add(request);
-            }
-            if (request.isDone()) {
-                this.completedRequests.add(request);
+            acquiredLock = this.lock.tryLock(requestTimeout.getDuration(), 
requestTimeout.getTimeUnit());
+        } catch (final InterruptedException ignored) {
 
 Review comment:
   Makes sense. I updated to set interrupted again and immediately return a 
failed future with the InterruptedException.

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to