steveloughran commented on a change in pull request #2368:
URL: https://github.com/apache/hadoop/pull/2368#discussion_r531625370
##########
File path:
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/ReadBufferManager.java
##########
@@ -49,21 +51,37 @@
private Queue<ReadBuffer> readAheadQueue = new LinkedList<>(); // queue of
requests that are not picked up by any worker thread yet
private LinkedList<ReadBuffer> inProgressList = new LinkedList<>(); //
requests being processed by worker threads
private LinkedList<ReadBuffer> completedReadList = new LinkedList<>(); //
buffers available for reading
- private static final ReadBufferManager BUFFER_MANAGER; // singleton,
initialized in static initialization block
+ private static ReadBufferManager bufferManager; // singleton, initialized in
static initialization block
+ private static final ReentrantLock LOCK = new ReentrantLock();
- static {
- BUFFER_MANAGER = new ReadBufferManager();
- BUFFER_MANAGER.init();
+ static ReadBufferManager getBufferManager() {
Review comment:
FWIW, synchronize on the Class object is a standard pattern here, but
the lock is fine, just a bit of extra coding
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]