This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/master by this push: new b885f0c Fix await implementations b885f0c is described below commit b885f0cc858f51e995d4fe1c3fb86654cefa2edd Author: remm <r...@apache.org> AuthorDate: Tue Mar 26 10:11:22 2019 +0100 Fix await implementations In case they ever get used again, they need to use the notify flags as the semaphore gets released later. --- java/org/apache/tomcat/util/net/Nio2Endpoint.java | 36 ++++++++++++++--------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java b/java/org/apache/tomcat/util/net/Nio2Endpoint.java index c58aac9..0028edb 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -1433,30 +1433,38 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS @Override public boolean awaitReadComplete(long timeout, TimeUnit unit) { - try { - if (readPending.tryAcquire(timeout, unit)) { - readPending.release(); - return true; - } else { + synchronized (readCompletionHandler) { + try { + if (readNotify) { + return true; + } else if (readPending.tryAcquire(timeout, unit)) { + readPending.release(); + return true; + } else { + return false; + } + } catch (InterruptedException e) { return false; } - } catch (InterruptedException e) { - return false; } } @Override public boolean awaitWriteComplete(long timeout, TimeUnit unit) { - try { - if (writePending.tryAcquire(timeout, unit)) { - writePending.release(); - return true; - } else { + synchronized (writeCompletionHandler) { + try { + if (writeNotify) { + return true; + } else if (writePending.tryAcquire(timeout, unit)) { + writePending.release(); + return true; + } else { + return false; + } + } catch (InterruptedException e) { return false; } - } catch (InterruptedException e) { - return false; } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org