本文整理汇总了Java中org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener类的典型用法代码示例。如果您正苦于以下问题:Java AbstractLifeCycleListener类的具体用法?Java AbstractLifeCycleListener怎么用?Java AbstractLifeCycleListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AbstractLifeCycleListener类属于org.eclipse.jetty.util.component.AbstractLifeCycle包,在下文中一共展示了AbstractLifeCycleListener类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instrument
import org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener; //导入依赖的package包/类
public void instrument(Server server) {
server.addLifeCycleListener(new AbstractLifeCycleListener() {
@Override
public void lifeCycleStarting(LifeCycle event) {
server.insertHandler(new JettyMetricsHandler());
}
});
}
示例2: run
import org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void run(@NonNull T configuration, @NonNull Environment environment) {
finishBinding();
// Bridge into Jersey's locator
environment.jersey().register(new AbstractBinder() {
@Override
protected void configure() {
bind(getLocator()).to(ServiceLocator.class).named(SERVICE_LOCATOR);
}
});
// Make the service locator available to the admin context too.
environment.getAdminContext().setAttribute(SERVICE_LOCATOR, getLocator());
// Finish configuring HK2 when Jetty starts (after the Application.run() method)
environment.lifecycle().addLifeCycleListener(new AbstractLifeCycleListener() {
@Override
public void lifeCycleStarting(LifeCycle event) {
if (event instanceof Server) {
finishBinding();
ServiceLocatorUtilities.addOneConstant(getLocator(), event, null, Server.class);
immediateController.setImmediateState(ImmediateServiceState.RUNNING);
((Server) event).addBean(mBeanContainer);
((Server) event).addBean(new ManagedMBeanContainer(mBeanContainer));
}
}
});
ServiceLocatorUtilities.bind(getLocator(), new EnvironmentBinder<>(bootstrap, configuration, environment));
ServiceLocatorUtilities.bind(getLocator(), new HK2MetricBinder());
ServiceLocatorUtilities.bind(getLocator(), new BundleBinder(bootstrap));
ServiceLocatorUtilities.addOneConstant(getLocator(), mBeanContainer, null, MBeanContainer.class);
// Register Jersey components to activate injectable dropwizard components when Jersey starts up
environment.jersey().register(HK2BridgeFeature.class);
environment.jersey().register(HealthCheckActivator.class);
environment.jersey().register(MetricActivator.class);
environment.jersey().register(LifeCycleActivator.class);
environment.jersey().register(TaskActivator.class);
autoBind(MBeanActivator.class);
}