szetszwo commented on PR #990:
URL: https://github.com/apache/ratis/pull/990#issuecomment-1863647417
@duongkame , I suggest to do the following:
- Wrap the `Closable` with `ReferenceCountedObject`, `retain()` (i.e.
refCount=1) and pass it around.
1. When the request log is added to the cache, `retain()` (i.e.
refCount=2).
2. When the log is evicted from the cache, `release()`.
3. When the request is processed, `release()`.
4. When refCount becomes zero, close the `Closable`.
Note that (ii) and (iii) can happen in any order.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]