sashidhar commented on a change in pull request #7764: #7316 Use
map.putIfAbsent() or map.computeIfAbsent() as appropriate instead of
containsKey() + put()
URL: https://github.com/apache/incubator-druid/pull/7764#discussion_r288214927
##########
File path:
indexing-service/src/main/java/org/apache/druid/indexing/overlord/ForkingTaskRunner.java
##########
@@ -214,309 +214,307 @@ public void unregisterListener(String listenerId)
public ListenableFuture<TaskStatus> run(final Task task)
{
synchronized (tasks) {
- if (!tasks.containsKey(task.getId())) {
- tasks.put(
- task.getId(),
- new ForkingTaskRunnerWorkItem(
- task,
- exec.submit(
- new Callable<TaskStatus>()
- {
- @Override
- public TaskStatus call()
- {
- final String attemptUUID =
UUID.randomUUID().toString();
- final File taskDir =
taskConfig.getTaskDir(task.getId());
- final File attemptDir = new File(taskDir, attemptUUID);
-
- final ProcessHolder processHolder;
- final String childHost = node.getHost();
- int childPort = -1;
- int tlsChildPort = -1;
-
- if (node.isEnablePlaintextPort()) {
- childPort = portFinder.findUnusedPort();
+ tasks.putIfAbsent(
+ task.getId(),
+ new ForkingTaskRunnerWorkItem(
+ task,
+ exec.submit(
Review comment:
Done.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]