[AMQ-6763] Add timeout on transport client to avoid blocking thread

This commit is contained in:
jbonofre 2021-04-01 17:13:59 +02:00
parent fc2ad12e6b
commit a0d740aac1
1 changed files with 2 additions and 1 deletions

View File

@ -42,10 +42,11 @@ public class FutureResponse {
this.transportFilter = transportFilter;
}
public Response getResult() throws IOException {
boolean hasInterruptPending = Thread.interrupted();
try {
return responseSlot.take();
return responseSlot.poll(2, TimeUnit.MINUTES);
} catch (InterruptedException e) {
hasInterruptPending = false;
throw dealWithInterrupt(e);