This commit is contained in:
Zoltan Haindrich 2024-05-16 09:33:51 +00:00
parent 4a47b0229e
commit 7e10df1ffa
1 changed files with 6 additions and 28 deletions

View File

@ -20,7 +20,6 @@
package org.apache.druid.cli; package org.apache.druid.cli;
import com.github.rvesse.airline.annotations.Command; import com.github.rvesse.airline.annotations.Command;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.inject.Injector; import com.google.inject.Injector;
@ -283,10 +282,13 @@ public class CliBroker2 extends ServerRunnable
public void run2() public void run2()
{ {
final Injector injector = makeInjector2(getNodeRoles(getProperties()));
final Lifecycle lifecycle = initLifecycle(injector);
try { try {
Injector injector = new ServerInjectorBuilder(baseInjector)
.nodeRoles(null)
.serviceModules(getModules())
.build();
Lifecycle lifecycle = initLifecycle(injector);
lifecycle.join(); lifecycle.join();
} }
catch (Exception e) { catch (Exception e) {
@ -294,28 +296,4 @@ public class CliBroker2 extends ServerRunnable
} }
} }
public Injector makeInjector2(Set<NodeRole> nodeRoles)
{
try {
return makeServerInjector11(baseInjector, nodeRoles, getModules());
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
@VisibleForTesting
public static Injector makeServerInjector11(
final Injector baseInjector,
final Set<NodeRole> nodeRoles,
final Iterable<? extends Module> modules
)
{
return new ServerInjectorBuilder(baseInjector)
.nodeRoles(null)
.serviceModules(modules)
.build();
}
} }