uschindler commented on PR #816: URL: https://github.com/apache/lucene/pull/816#issuecomment-1110778339
Something like: ```java private final Lock readLock, writeLock; CloseableThreadLocal#ctor() { super(); var rwLock = new ReadWriteLock(); this readLock = rwLock.readLock(); this.writeLock = rwLock.writeLock(); //... more init here } // later in get() when reading instead of synchronized:: readLock.lock(); try { // read value for current thread } finally { readLock.unlock(); } // later when cleaning up and modifiying map instead of synchronized: writeLock.lock(); try { // modify the map and clean up / purge threads } finally { writeLock.unlock(); } ``` -- 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. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org