• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LifecycleListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.gerrit.extensions.events.LifecycleListener的典型用法代码示例。如果您正苦于以下问题:Java LifecycleListener类的具体用法?Java LifecycleListener怎么用?Java LifecycleListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LifecycleListener类属于com.google.gerrit.extensions.events包,在下文中一共展示了LifecycleListener类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: stop

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
/** Stop all listeners, in the reverse order they were registered. */
public void stop() {
  for (int i = handles.size() - 1; 0 <= i; i--) {
    handles.get(i).remove();
  }
  handles.clear();

  for (int i = startedIndex; 0 <= i; i--) {
    LifecycleListener obj = listeners.get(i).get();
    try {
      obj.stop();
    } catch (Throwable err) {
      LoggerFactory.getLogger(obj.getClass()).warn("Failed to stop", err);
    }
    startedIndex = i - 1;
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:LifecycleManager.java


示例2: configure

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
@Override
protected void configure() {
  listener()
      .toInstance(
          new LifecycleListener() {
            @Inject MetricMaker metrics;

            @Override
            public void start() {
              configure(metrics);
            }

            @Override
            public void stop() {}
          });
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:17,代码来源:MetricModule.java


示例3: start

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
public static LifecycleListener start(Path sitePath, Config config) throws IOException {
  Path logdir =
      FileUtil.mkdirsOrDie(new SitePaths(sitePath).logs_dir, "Cannot create log directory");
  if (SystemLog.shouldConfigure()) {
    initLogSystem(logdir, config);
  }

  return new LifecycleListener() {
    @Override
    public void start() {}

    @Override
    public void stop() {
      LogManager.shutdown();
    }
  };
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:18,代码来源:ErrorLogFile.java


示例4: configure

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
@Override
protected void configure() {
  bind(SessionFactory.class).toProvider(SessionFactoryProvider.class);

  Multibinder<Section> sectionBinder = Multibinder.newSetBinder(binder(), Section.class);
  sectionBinder.addBinding().to(AMQP.class);
  sectionBinder.addBinding().to(Exchange.class);
  sectionBinder.addBinding().to(Gerrit.class);
  sectionBinder.addBinding().to(Message.class);
  sectionBinder.addBinding().to(Monitor.class);

  Multibinder<Solver> solverBinder = Multibinder.newSetBinder(binder(), Solver.class);
  solverBinder.addBinding().to(V1.class);

  install(new FactoryModuleBuilder().implement(Publisher.class, MessagePublisher.class).build(PublisherFactory.class));
  install(new FactoryModuleBuilder().implement(Properties.class, PluginProperties.class).build(PropertiesFactory.class));
  install(new FactoryModuleBuilder().implement(EventWorker.class, UserEventWorker.class).build(EventWorkerFactory.class));

  DynamicSet.bind(binder(), LifecycleListener.class).to(Manager.class);
  DynamicSet.bind(binder(), ChangeListener.class).to(DefaultEventWorker.class);
}
 
开发者ID:rinrinne,项目名称:gerrit-rabbitmq-plugin,代码行数:22,代码来源:Module.java


示例5: configure

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
@Override
protected void configure() {
  bind(DestinationFactory.class).in(Scopes.SINGLETON);
  bind(ReplicationQueue.class).in(Scopes.SINGLETON);

  DynamicSet.bind(binder(), GitReferenceUpdatedListener.class).to(ReplicationQueue.class);
  DynamicSet.bind(binder(), NewProjectCreatedListener.class).to(ReplicationQueue.class);
  DynamicSet.bind(binder(), ProjectDeletedListener.class).to(ReplicationQueue.class);
  DynamicSet.bind(binder(), HeadUpdatedListener.class).to(ReplicationQueue.class);

  bind(OnStartStop.class).in(Scopes.SINGLETON);
  bind(LifecycleListener.class).annotatedWith(UniqueAnnotations.create()).to(OnStartStop.class);
  bind(LifecycleListener.class)
      .annotatedWith(UniqueAnnotations.create())
      .to(ReplicationLogFile.class);
  bind(CredentialsFactory.class)
      .to(AutoReloadSecureCredentialsFactoryDecorator.class)
      .in(Scopes.SINGLETON);
  bind(CapabilityDefinition.class)
      .annotatedWith(Exports.named(START_REPLICATION))
      .to(StartReplicationCapability.class);

  install(new FactoryModuleBuilder().build(PushAll.Factory.class));
  install(new FactoryModuleBuilder().build(RemoteSiteUser.Factory.class));

  bind(ReplicationConfig.class).to(AutoReloadConfigDecorator.class);
  bind(ReplicationStateListener.class).to(ReplicationStateLogger.class);

  EventTypes.register(RefReplicatedEvent.TYPE, RefReplicatedEvent.class);
  EventTypes.register(RefReplicationDoneEvent.TYPE, RefReplicationDoneEvent.class);
  EventTypes.register(ReplicationScheduledEvent.TYPE, ReplicationScheduledEvent.class);
  bind(SshSessionFactory.class).toProvider(ReplicationSshSessionFactoryProvider.class);
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:34,代码来源:ReplicationModule.java


示例6: add

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
/**
 * Add all {@link LifecycleListener}s registered in the Injector.
 *
 * @param injector the injector to add.
 */
public void add(Injector injector) {
  Preconditions.checkState(startedIndex < 0, "Already started");
  for (Binding<LifecycleListener> binding : get(injector)) {
    add(binding.getProvider());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:12,代码来源:LifecycleManager.java


示例7: start

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
/** Start all listeners, in the order they were registered. */
public void start() {
  for (int i = startedIndex + 1; i < listeners.size(); i++) {
    LifecycleListener listener = listeners.get(i).get();
    startedIndex = i;
    listener.start();
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:LifecycleManager.java


示例8: IndexManagerOnInit

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
@Inject
IndexManagerOnInit(
    @Named(IndexModuleOnInit.INDEX_MANAGER) LifecycleListener indexManager,
    Collection<IndexDefinition<?, ?, ?>> defs) {
  this.indexManager = indexManager;
  this.defs = defs;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:8,代码来源:IndexManagerOnInit.java


示例9: configure

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
@Override
protected void configure() {
  // The AccountIndex implementations (LuceneAccountIndex and
  // ElasticAccountIndex) need AccountCache only for reading from the index.
  // On init we only want to write to the index, hence we don't need the
  // account cache.
  bind(AccountCache.class).toProvider(Providers.of(null));

  // AccountIndexDefinition wants to have AllAccountsIndexer but it is only
  // used by the Reindex program and the OnlineReindexer which are both not
  // used during init, hence we don't need AllAccountsIndexer.
  bind(AllAccountsIndexer.class).toProvider(Providers.of(null));

  bind(AccountIndexCollection.class);

  // The GroupIndex implementations (LuceneGroupIndex and ElasticGroupIndex)
  // need GroupCache only for reading from the index. On init we only want to
  // write to the index, hence we don't need the group cache.
  bind(GroupCache.class).toProvider(Providers.of(null));

  // GroupIndexDefinition wants to have AllGroupsIndexer but it is only used
  // by the Reindex program and the OnlineReindexer which are both not used
  // during init, hence we don't need AllGroupsIndexer.
  bind(AllGroupsIndexer.class).toProvider(Providers.of(null));

  bind(GroupIndexCollection.class);

  bind(new TypeLiteral<Map<String, Integer>>() {})
      .annotatedWith(Names.named(SingleVersionModule.SINGLE_VERSIONS))
      .toInstance(ImmutableMap.<String, Integer>of());
  bind(LifecycleListener.class)
      .annotatedWith(Names.named(INDEX_MANAGER))
      .to(SingleVersionListener.class);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:35,代码来源:IndexModuleOnInit.java


示例10: registerInParentInjectors

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
public static LifecycleListener registerInParentInjectors() {
  return new LifecycleListener() {
    private List<RegistrationHandle> handles;

    @Inject private Injector self;

    @Override
    public void start() {
      handles = new ArrayList<>(4);
      Injector parent = self.getParent();
      while (parent != null) {
        handles.addAll(attachSets(self, dynamicSetsOf(parent)));
        handles.addAll(attachMaps(self, "gerrit", dynamicMapsOf(parent)));
        parent = parent.getParent();
      }
      if (handles.isEmpty()) {
        handles = null;
      }
    }

    @Override
    public void stop() {
      remove(handles);
      handles = null;
    }
  };
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:28,代码来源:PrivateInternals_DynamicTypes.java


示例11: get

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
private static List<Binding<LifecycleListener>> get(Injector i) {
  return i.findBindingsByType(new TypeLiteral<LifecycleListener>() {});
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:4,代码来源:LifecycleManager.java


示例12: shouldCopy

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
private boolean shouldCopy(Key<?> key) {
  if (copyConfigKeys.contains(key)) {
    return false;
  }
  Class<?> type = key.getTypeLiteral().getRawType();
  if (LifecycleListener.class.isAssignableFrom(type)
      // This is needed for secondary index to work from plugin listeners
      && !is("com.google.gerrit.server.index.IndexCollection", type)) {
    return false;
  }
  if (StartPluginListener.class.isAssignableFrom(type)) {
    return false;
  }
  if (StopPluginListener.class.isAssignableFrom(type)) {
    return false;
  }
  if (MetricMaker.class.isAssignableFrom(type)) {
    return false;
  }

  if (type.getName().startsWith("com.google.inject.")) {
    return false;
  }

  if (is("org.apache.sshd.server.Command", type)) {
    return false;
  }

  if (is("javax.servlet.Filter", type)) {
    return false;
  }
  if (is("javax.servlet.ServletContext", type)) {
    return false;
  }
  if (is("javax.servlet.ServletRequest", type)) {
    return false;
  }
  if (is("javax.servlet.ServletResponse", type)) {
    return false;
  }
  if (is("javax.servlet.http.HttpServlet", type)) {
    return false;
  }
  if (is("javax.servlet.http.HttpServletRequest", type)) {
    return false;
  }
  if (is("javax.servlet.http.HttpServletResponse", type)) {
    return false;
  }
  if (is("javax.servlet.http.HttpSession", type)) {
    return false;
  }
  if (Map.class.isAssignableFrom(type)
      && key.getAnnotationType() != null
      && "com.google.inject.servlet.RequestParameters"
          .equals(key.getAnnotationType().getName())) {
    return false;
  }
  if (type.getName().startsWith("com.google.gerrit.httpd.GitOverHttpServlet$")) {
    return false;
  }
  return true;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:64,代码来源:PluginGuiceEnvironment.java


示例13: configureServlets

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
@Override
protected void configureServlets() {
	log.info("Configuring servlet and filters");
	// Plugin life-cycle listener
	bind(PluginActivator.class);
	bind(LifecycleListener.class).annotatedWith(UniqueAnnotations.create()).to(PluginActivator.class);

	// Changed things
	bind(IStoredSettings.class).to(GitBlitSettings.class);
	bind(IRuntimeManager.class).to(GerritGitBlitRuntimeManager.class);
	bind(IUserManager.class).to(GerritGitBlitUserManager.class);
	bind(IAuthenticationManager.class).to(GerritGitBlitAuthenticationManager.class);
	bind(IRepositoryManager.class).to(GerritGitBlitRepositoryManager.class);
	bind(GitblitContext.class).to(GerritGitBlitContext.class);
	bind(GitBlitWebApp.class).to(GerritGitBlitWebApp.class);
	bind(IPluginManager.class).to(NullPluginManager.class);
	bind(ITicketService.class).to(ReallyNullTicketService.class);

	// Gitblit bindings
	bind(XssFilter.class).to(JSoupXssFilter.class);
	bind(AvatarGenerator.class).to(GravatarGenerator.class);
	bind(WorkQueue.class).toProvider(WorkQueueProvider.class);

	bind(IGitblit.class).to(GitblitManager.class);

	// core managers
	bind(IPluginManager.class).to(NullPluginManager.class);
	bind(INotificationManager.class).to(NotificationManager.class);
	bind(IProjectManager.class).to(ProjectManager.class);
	bind(IFederationManager.class).to(FederationManager.class);
	bind(IFilestoreManager.class).to(FilestoreManager.class);
	bind(IPublicKeyManager.class).toProvider(IPublicKeyManagerProvider.class);

	// manager for long-running daemons and services
	bind(IServicesManager.class).to(ServicesManager.class);

	// Servlets -- note: FilestoreServlet is not configured
	serve('/' + WrappedPagesFilter.SERVLET_RELATIVE_PATH + '*').with(PagesServlet.class);
	serve('/' + WrappedRawFilter.SERVLET_RELATIVE_PATH + '*').with(RawServlet.class);
	serve('/' + WrappedSyndicationFilter.SERVLET_RELATIVE_PATH + '*').with(WrappedSyndicationServlet.class);
	serve("/zip/*").with(DownloadZipServlet.class);
	serve("/logo.png").with(LogoServlet.class);
	serve("/static/logo.png").with(LogoServlet.class);
	serve("/graph/*").with(BranchGraphServlet.class);
	serve("/static/*").with(StaticResourcesServlet.class);
	serve("/clippy.swf").with(StaticResourcesServlet.class);
	serve("/pt").with(PtServlet.class);

	// Filters
	filter("/*").through(GerritWicketFilter.class);
	filter('/' + WrappedPagesFilter.SERVLET_RELATIVE_PATH + '*').through(WrappedPagesFilter.class);
	filter('/' + WrappedRawFilter.SERVLET_RELATIVE_PATH + '*').through(WrappedRawFilter.class);
	filter('/' + WrappedSyndicationFilter.SERVLET_RELATIVE_PATH + '*').through(WrappedSyndicationFilter.class);
}
 
开发者ID:tomaswolf,项目名称:gerrit-gitblit-plugin,代码行数:55,代码来源:GitBlitServletModule.java


示例14: listener

import com.google.gerrit.extensions.events.LifecycleListener; //导入依赖的package包/类
/**
 * @return a unique listener binding.
 *     <p>To create a listener binding use:
 *     <pre>
 * listener().to(MyListener.class);
 * </pre>
 *     where {@code MyListener} is a {@link Singleton} implementing the {@link LifecycleListener}
 *     interface.
 */
protected LinkedBindingBuilder<LifecycleListener> listener() {
  final Annotation id = UniqueAnnotations.create();
  return bind(LifecycleListener.class).annotatedWith(id);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:14,代码来源:LifecycleModule.java



注:本文中的com.google.gerrit.extensions.events.LifecycleListener类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java XSWildcardVisitor类代码示例发布时间:2022-05-23
下一篇:
Java XBreakpointManager类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap