本文整理了Java中org.apache.druid.java.util.common.lifecycle.Lifecycle.addHandler()
方法的一些代码示例,展示了Lifecycle.addHandler()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Lifecycle.addHandler()
方法的具体详情如下:
包路径:org.apache.druid.java.util.common.lifecycle.Lifecycle
类名称:Lifecycle
方法名:addHandler
[英]Adds a handler to the Lifecycle at the Stage.NORMAL stage. If the lifecycle has already been started, it throws an ISE
[中]在阶段中将处理程序添加到生命周期。正常期。如果生命周期已经开始,它会抛出一个ISE
代码示例来源:origin: apache/incubator-druid
/**
* Adds a handler to the Lifecycle at the Stage.NORMAL stage. If the lifecycle has already been started, it throws
* an {@link ISE}
*
* @param handler The hander to add to the lifecycle
*
* @throws ISE {@link Lifecycle#addHandler(Handler, Stage)}
*/
public void addHandler(Handler handler)
{
addHandler(handler, Stage.NORMAL);
}
代码示例来源:origin: apache/incubator-druid
/**
* Adds a Closeable instance to the lifecycle at {@link Stage#NORMAL} stage, doesn't try to call any "start" method on
* it, use {@link #addStartCloseInstance(Object)} instead if you need the latter behaviour.
*/
public <T extends Closeable> T addCloseableInstance(T o)
{
addHandler(new CloseableHandler(o));
return o;
}
代码示例来源:origin: apache/incubator-druid
/**
* Adds a "managed" instance (annotated with {@link LifecycleStart} and {@link LifecycleStop}) to the Lifecycle at
* Stage.NORMAL. If the lifecycle has already been started, it throws an {@link ISE}
*
* @param o The object to add to the lifecycle
*
* @throws ISE {@link Lifecycle#addHandler(Handler, Stage)}
*/
public <T> T addManagedInstance(T o)
{
addHandler(new AnnotationBasedHandler(o));
return o;
}
代码示例来源:origin: apache/incubator-druid
/**
* Adds a "managed" instance (annotated with {@link LifecycleStart} and {@link LifecycleStop}) to the Lifecycle.
* If the lifecycle has already been started, it throws an {@link ISE}
*
* @param o The object to add to the lifecycle
* @param stage The stage to add the lifecycle at
*
* @throws ISE {@link Lifecycle#addHandler(Handler, Stage)}
*/
public <T> T addManagedInstance(T o, Stage stage)
{
addHandler(new AnnotationBasedHandler(o), stage);
return o;
}
代码示例来源:origin: apache/incubator-druid
/**
* Adds an instance with a start() and/or close() method to the Lifecycle. If the lifecycle has already been started,
* it throws an {@link ISE}
*
* @param o The object to add to the lifecycle
* @param stage The stage to add the lifecycle at
*
* @throws ISE {@link Lifecycle#addHandler(Handler, Stage)}
*/
public <T> T addStartCloseInstance(T o, Stage stage)
{
addHandler(new StartCloseHandler(o), stage);
return o;
}
代码示例来源:origin: apache/incubator-druid
/**
* Adds an instance with a start() and/or close() method to the Lifecycle at Stage.NORMAL. If the lifecycle has
* already been started, it throws an {@link ISE}
*
* @param o The object to add to the lifecycle
*
* @throws ISE {@link Lifecycle#addHandler(Handler, Stage)}
*/
public <T> T addStartCloseInstance(T o)
{
addHandler(new StartCloseHandler(o));
return o;
}
代码示例来源:origin: apache/incubator-druid
@Override
public MetadataSegmentManager get()
{
lifecycle.addHandler(
new Lifecycle.Handler()
{
@Override
public void start()
{
connector.createSegmentTable();
}
@Override
public void stop()
{
}
}
);
return new SQLMetadataSegmentManager(
jsonMapper,
config,
storageConfig,
connector
);
}
}
代码示例来源:origin: apache/incubator-druid
public static PrioritizedExecutorService create(Lifecycle lifecycle, DruidProcessingConfig config)
{
final PrioritizedExecutorService service = new PrioritizedExecutorService(
new ThreadPoolExecutor(
config.getNumThreads(),
config.getNumThreads(),
0L,
TimeUnit.MILLISECONDS,
new PriorityBlockingQueue<Runnable>(),
new ThreadFactoryBuilder().setDaemon(true).setNameFormat(config.getFormatString()).build()
),
config
);
lifecycle.addHandler(
new Lifecycle.Handler()
{
@Override
public void start()
{
}
@Override
public void stop()
{
service.shutdownNow();
}
}
);
return service;
}
代码示例来源:origin: apache/incubator-druid
@Provides @ManageLifecycle
public ConfigManager getConfigManager(
final MetadataStorageConnector dbConnector,
final Supplier<MetadataStorageTablesConfig> dbTables,
final Supplier<ConfigManagerConfig> config,
final Lifecycle lifecycle
)
{
lifecycle.addHandler(
new Lifecycle.Handler()
{
@Override
public void start()
{
dbConnector.createConfigTable();
}
@Override
public void stop()
{
}
}
);
return new ConfigManager(dbConnector, dbTables, config);
}
}
代码示例来源:origin: apache/incubator-druid
lifecycle.addHandler(
new Lifecycle.Handler()
代码示例来源:origin: apache/incubator-druid
leaderLifecycle.addManagedInstance(overlordHelperManager);
leaderLifecycle.addHandler(
new Lifecycle.Handler()
代码示例来源:origin: apache/incubator-druid
lifecycle.addHandler(exceptionalHandler);
Collection<ListenableFuture<?>> futures = new ArrayList<>(numThreads);
final AtomicBoolean threadsStartLatch = new AtomicBoolean(false);
代码示例来源:origin: apache/incubator-druid
lifecycle.addHandler(stoppingHandler);
lifecycle.start();
new Thread(lifecycle::stop).start(); // will stop at stoppingHandler.stop()
lifecycle.addHandler(dummyHandler);
Assert.fail("Expected exception");
代码示例来源:origin: apache/incubator-druid
lifecycle.addHandler(exceptionalHandler);
lifecycle.start();
lifecycle.stop();
代码示例来源:origin: apache/incubator-druid
lifecycle.addHandler(
new Lifecycle.Handler()
代码示例来源:origin: apache/incubator-druid
lifecycle.addHandler(
new Lifecycle.Handler()
代码示例来源:origin: apache/incubator-druid
lifecycle.addHandler(
new Lifecycle.Handler()
代码示例来源:origin: org.apache.druid/java-util
/**
* Adds a handler to the Lifecycle at the Stage.NORMAL stage. If the lifecycle has already been started, it throws
* an {@link ISE}
*
* @param handler The hander to add to the lifecycle
*
* @throws ISE {@link Lifecycle#addHandler(Handler, Stage)}
*/
public void addHandler(Handler handler)
{
addHandler(handler, Stage.NORMAL);
}
代码示例来源:origin: org.apache.druid/java-util
/**
* Adds a Closeable instance to the lifecycle at {@link Stage#NORMAL} stage, doesn't try to call any "start" method on
* it, use {@link #addStartCloseInstance(Object)} instead if you need the latter behaviour.
*/
public <T extends Closeable> T addCloseableInstance(T o)
{
addHandler(new CloseableHandler(o));
return o;
}
代码示例来源:origin: org.apache.druid/java-util
/**
* Adds an instance with a start() and/or close() method to the Lifecycle at Stage.NORMAL. If the lifecycle has
* already been started, it throws an {@link ISE}
*
* @param o The object to add to the lifecycle
*
* @throws ISE {@link Lifecycle#addHandler(Handler, Stage)}
*/
public <T> T addStartCloseInstance(T o)
{
addHandler(new StartCloseHandler(o));
return o;
}
内容来源于网络,如有侵权,请联系作者删除!