sodonnel commented on code in PR #5191:
URL: https://github.com/apache/ozone/pull/5191#discussion_r1297632814
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerManagerImpl.java:
##########
@@ -202,22 +205,26 @@ public ContainerInfo allocateContainer(
" matching pipeline for replicationConfig: " + replicationConfig
+ ", State:PipelineState.OPEN", e);
}
- pipelineManager.acquireReadLock();
- lock.lock();
+
try {
- pipelines = pipelineManager
- .getPipelines(replicationConfig, Pipeline.PipelineState.OPEN);
- if (!pipelines.isEmpty()) {
- pipeline = pipelines.get(random.nextInt(pipelines.size()));
- containerInfo = createContainer(pipeline, owner);
- } else {
- throw new IOException("Could not allocate container. Cannot get any"
+
- " matching pipeline for replicationConfig: " + replicationConfig
- + ", State:PipelineState.OPEN");
+ lock.lock();
+ try {
+ pipelineManager.acquireReadLock();
Review Comment:
I was trying to make findbugs happy, as before I had the two nested try
blocks, findbugs complained. I'll see if I can get it happy while having the
locks outside of the try block.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]