本文整理了Java中org.apache.druid.java.util.common.lifecycle.Lifecycle.addManagedInstance()
方法的一些代码示例,展示了Lifecycle.addManagedInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lifecycle.addManagedInstance()
方法的具体详情如下:
包路径:org.apache.druid.java.util.common.lifecycle.Lifecycle
类名称:Lifecycle
方法名:addManagedInstance
[英]Adds a "managed" instance (annotated with LifecycleStart and LifecycleStop) to the Lifecycle at Stage.NORMAL. If the lifecycle has already been started, it throws an ISE
[中]在阶段将“托管”实例(用LifecycleStart和LifecycleStop注释)添加到生命周期。典型的如果生命周期已经开始,它会抛出一个ISE
代码示例来源:origin: apache/incubator-druid
public void setLifecycle(Lifecycle lifecycle)
{
synchronized (instances) {
this.lifecycle = lifecycle;
for (Object instance : instances) {
lifecycle.addManagedInstance(instance, stage);
}
}
}
代码示例来源:origin: apache/incubator-druid
public Emitter makeEmitter(Lifecycle lifecycle)
{
Emitter retVal = new NoopEmitter();
lifecycle.addManagedInstance(retVal);
return retVal;
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public Emitter makeEmitter(ObjectMapper objectMapper, AsyncHttpClient httpClient, Lifecycle lifecycle)
{
Emitter retVal = new HttpPostEmitter(this, httpClient, objectMapper);
lifecycle.addManagedInstance(retVal);
return retVal;
}
}
代码示例来源:origin: apache/incubator-druid
public Emitter makeEmitter(ObjectMapper objectMapper, Lifecycle lifecycle)
{
Emitter retVal = new LoggingEmitter(this, objectMapper);
lifecycle.addManagedInstance(retVal);
return retVal;
}
}
代码示例来源:origin: apache/incubator-druid
@Override
public Emitter makeEmitter(ObjectMapper objectMapper, AsyncHttpClient httpClient, Lifecycle lifecycle)
{
final Emitter retVal = new ParametrizedUriEmitter(this, httpClient, objectMapper);
lifecycle.addManagedInstance(retVal);
return retVal;
}
}
代码示例来源:origin: apache/incubator-druid
leaderLifecycle.addManagedInstance(taskRunner);
leaderLifecycle.addManagedInstance(taskQueue);
leaderLifecycle.addManagedInstance(supervisorManager);
leaderLifecycle.addManagedInstance(overlordHelperManager);
代码示例来源:origin: apache/incubator-druid
@Test
public void testSanity() throws Exception
{
Lifecycle lifecycle = new Lifecycle();
List<Integer> startOrder = new ArrayList<>();
List<Integer> stopOrder = new ArrayList<>();
lifecycle.addManagedInstance(new ObjectToBeLifecycled(0, startOrder, stopOrder));
lifecycle.addManagedInstance(new ObjectToBeLifecycled(1, startOrder, stopOrder), Lifecycle.Stage.NORMAL);
lifecycle.addManagedInstance(new ObjectToBeLifecycled(2, startOrder, stopOrder), Lifecycle.Stage.NORMAL);
lifecycle.addManagedInstance(new ObjectToBeLifecycled(3, startOrder, stopOrder), Lifecycle.Stage.LAST);
lifecycle.addStartCloseInstance(new ObjectToBeLifecycled(4, startOrder, stopOrder));
lifecycle.addManagedInstance(new ObjectToBeLifecycled(5, startOrder, stopOrder));
lifecycle.addStartCloseInstance(new ObjectToBeLifecycled(6, startOrder, stopOrder), Lifecycle.Stage.LAST);
lifecycle.addManagedInstance(new ObjectToBeLifecycled(7, startOrder, stopOrder));
lifecycle.addStartCloseInstance(new ObjectToBeLifecycled(8, startOrder, stopOrder), Lifecycle.Stage.INIT);
final List<Integer> expectedOrder = Arrays.asList(8, 0, 1, 2, 4, 5, 7, 3, 6);
lifecycle.start();
Assert.assertEquals(9, startOrder.size());
Assert.assertEquals(0, stopOrder.size());
Assert.assertEquals(expectedOrder, startOrder);
lifecycle.stop();
Assert.assertEquals(9, startOrder.size());
Assert.assertEquals(9, stopOrder.size());
Assert.assertEquals(Lists.reverse(expectedOrder), stopOrder);
}
代码示例来源:origin: apache/incubator-druid
final List<Integer> stopOrder = new ArrayList<>();
lifecycle.addManagedInstance(new ObjectToBeLifecycled(0, startOrder, stopOrder));
lifecycle.addHandler(
new Lifecycle.Handler()
代码示例来源:origin: org.apache.druid/druid-api
public void setLifecycle(Lifecycle lifecycle)
{
synchronized (instances) {
this.lifecycle = lifecycle;
for (Object instance : instances) {
lifecycle.addManagedInstance(instance, stage);
}
}
}
代码示例来源:origin: org.apache.druid/java-util
@Override
public Emitter makeEmitter(ObjectMapper objectMapper, AsyncHttpClient httpClient, Lifecycle lifecycle)
{
final Emitter retVal = new ParametrizedUriEmitter(this, httpClient, objectMapper);
lifecycle.addManagedInstance(retVal);
return retVal;
}
}
代码示例来源:origin: org.apache.druid/java-util
@Override
public Emitter makeEmitter(ObjectMapper objectMapper, AsyncHttpClient httpClient, Lifecycle lifecycle)
{
Emitter retVal = new HttpPostEmitter(this, httpClient, objectMapper);
lifecycle.addManagedInstance(retVal);
return retVal;
}
}
代码示例来源:origin: org.apache.druid/java-util
public Emitter makeEmitter(Lifecycle lifecycle)
{
Emitter retVal = new NoopEmitter();
lifecycle.addManagedInstance(retVal);
return retVal;
}
}
代码示例来源:origin: org.apache.druid/java-util
public Emitter makeEmitter(ObjectMapper objectMapper, Lifecycle lifecycle)
{
Emitter retVal = new LoggingEmitter(this, objectMapper);
lifecycle.addManagedInstance(retVal);
return retVal;
}
}
代码示例来源:origin: org.apache.druid/druid-indexing-service
leaderLifecycle.addManagedInstance(taskRunner);
leaderLifecycle.addManagedInstance(taskQueue);
leaderLifecycle.addManagedInstance(supervisorManager);
leaderLifecycle.addManagedInstance(overlordHelperManager);
内容来源于网络,如有侵权,请联系作者删除!