On Wed, 7 Jul 2021 17:22:07 GMT, Xue-Lei Andrew Fan <xue...@openjdk.org> wrote:
>> Alexey Bakhtin has updated the pull request incrementally with one >> additional commit since the last revision: >> >> Add read lock for inputRecord.deplete > > src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java line 1789: > >> 1787: appInput.readLock.unlock(); >> 1788: } >> 1789: } > > The blocking on close() may be not good in practice. I would use tryLock() > rather than lock() so as to avoid closure blocking. tryLock() is not > perfect, but it may be better than blocking the close(). > > BTW, you could use the intanceof pattern matching so as to avoid the cast > (See https://openjdk.java.net/jeps/394). > > > if (conContext.inputRecord instanceof > SSLSocketInputRecord inputRecord && > isConnected) { > if (appInput.readLock.tryLock()) { > try { > inputRecord.deplete(false); > } finally { > appInput.readLock.unlock(); > } > } > } Hi Xuelei, Thank you a lot again. Replaced lock with tryLock as you suggested ------------- PR: https://git.openjdk.java.net/jdk/pull/4520