当前位置: 首页>>代码示例>>Java>>正文


Java AbstractLifeCycleListener类代码示例

本文整理汇总了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());
    }
  });
}
 
开发者ID:ApptuitAI,项目名称:JInsight,代码行数:9,代码来源:JettyRuleHelper.java

示例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);
}
 
开发者ID:baharclerode,项目名称:dropwizard-hk2,代码行数:39,代码来源:HK2Bundle.java


注:本文中的org.eclipse.jetty.util.component.AbstractLifeCycle.AbstractLifeCycleListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。