/** * Publish the given event to all listeners. * <p>Note: Listeners get initialized after the MessageSource, to be able * to access it within listener implementations. Thus, MessageSource * implementations cannot publish events. * @param event the event to publish (may be application-specific or a * standard framework event) */ @Override public void publishEvent(ApplicationEvent event) { publishEvent(event, null); }
/** * Publish the given event to all listeners. * <p>Note: Listeners get initialized after the MessageSource, to be able * to access it within listener implementations. Thus, MessageSource * implementations cannot publish events. * @param event the event to publish (may be an {@link ApplicationEvent} * or a payload object to be turned into a {@link PayloadApplicationEvent}) */ @Override public void publishEvent(Object event) { publishEvent(event, null); }
/** * Publish the given event to all listeners. * <p>Note: Listeners get initialized after the MessageSource, to be able * to access it within listener implementations. Thus, MessageSource * implementations cannot publish events. * @param event the event to publish (may be application-specific or a * standard framework event) */ @Override public void publishEvent(ApplicationEvent event) { publishEvent(event, null); }
/** * Publish the given event to all listeners. * <p>Note: Listeners get initialized after the MessageSource, to be able * to access it within listener implementations. Thus, MessageSource * implementations cannot publish events. * @param event the event to publish (may be an {@link ApplicationEvent} * or a payload object to be turned into a {@link PayloadApplicationEvent}) */ @Override public void publishEvent(Object event) { publishEvent(event, null); }
@Override public void stop() { getLifecycleProcessor().stop(); publishEvent(new ContextStoppedEvent(this)); }
@Override public void start() { getLifecycleProcessor().start(); publishEvent(new ContextStartedEvent(this)); }
publishEvent(new ContextClosedEvent(this));
/** * Send crawl change event to all listeners. * @param newState State change we're to tell listeners' about. * @param status */ protected void sendCrawlStateChangeEvent(State newState, CrawlStatus status) { if(this.state == newState) { // suppress duplicate state-reports return; } this.state = newState; LOGGER.fine("reached CrawlController.State " + this.state + ", notifying listeners"); CrawlStateEvent event = new CrawlStateEvent(this,newState,status.getDescription()); appCtx.publishEvent(event); }
@Override public void start() { getLifecycleProcessor().start(); publishEvent(new ContextStartedEvent(this)); }
@Override public void stop() { getLifecycleProcessor().stop(); publishEvent(new ContextStoppedEvent(this)); }
((AbstractApplicationContext) this.parent).publishEvent(event, eventType);
publishEvent(new ContextClosedEvent(this));
((AbstractApplicationContext) this.parent).publishEvent(event, eventType);
/** * Finish the refresh of this context, invoking the LifecycleProcessor's * onRefresh() method and publishing the * {@link org.springframework.context.event.ContextRefreshedEvent}. */ protected void finishRefresh() { // Clear context-level resource caches (such as ASM metadata from scanning). clearResourceCaches(); // Initialize lifecycle processor for this context. initLifecycleProcessor(); // Propagate refresh to lifecycle processor first. getLifecycleProcessor().onRefresh(); // Publish the final event. publishEvent(new ContextRefreshedEvent(this)); // Participate in LiveBeansView MBean, if active. LiveBeansView.registerApplicationContext(this); }
appCtx.publishEvent(new StopCompleteEvent(this));
/** * Finish the refresh of this context, invoking the LifecycleProcessor's * onRefresh() method and publishing the * {@link org.springframework.context.event.ContextRefreshedEvent}. */ protected void finishRefresh() { // Clear context-level resource caches (such as ASM metadata from scanning). clearResourceCaches(); // Initialize lifecycle processor for this context. initLifecycleProcessor(); // Propagate refresh to lifecycle processor first. getLifecycleProcessor().onRefresh(); // Publish the final event. publishEvent(new ContextRefreshedEvent(this)); // Participate in LiveBeansView MBean, if active. LiveBeansView.registerApplicationContext(this); }
/** * Force logging, etc. of operator- deleted CrawlURIs * * @see org.archive.crawler.framework.Frontier#deleted(org.archive.modules.CrawlURI) */ public void deleted(CrawlURI curi) { //treat as disregarded appCtx.publishEvent( new CrawlURIDispositionEvent(this,curi,DISREGARDED)); log(curi); incrementDisregardedUriCount(); curi.stripToMinimal(); curi.processingCleanup(); }
appCtx.publishEvent(new CheckpointSuccessEvent(this, checkpointInProgress)); } catch (Exception e) {
@Override public void run(String... args) throws Exception { log.info("Starting gRPC Server ..."); Collection<ServerInterceptor> globalInterceptors = getBeanNamesByTypeWithAnnotation(GRpcGlobalInterceptor.class, ServerInterceptor.class) .map(name -> applicationContext.getBeanFactory().getBean(name, ServerInterceptor.class)) .collect(Collectors.toList()); // Adding health service serverBuilder.addService(healthStatusManager.getHealthService()); // find and register all GRpcService-enabled beans getBeanNamesByTypeWithAnnotation(GRpcService.class, BindableService.class) .forEach(name -> { BindableService srv = applicationContext.getBeanFactory().getBean(name, BindableService.class); ServerServiceDefinition serviceDefinition = srv.bindService(); GRpcService gRpcServiceAnn = applicationContext.findAnnotationOnBean(name, GRpcService.class); serviceDefinition = bindInterceptors(serviceDefinition, gRpcServiceAnn, globalInterceptors); serverBuilder.addService(serviceDefinition); String serviceName = serviceDefinition.getServiceDescriptor().getName(); healthStatusManager.setStatus(serviceName, HealthCheckResponse.ServingStatus.SERVING); log.info("'{}' service has been registered.", srv.getClass().getName()); }); if (gRpcServerProperties.isEnableReflection()) { serverBuilder.addService(ProtoReflectionService.newInstance()); log.info("'{}' service has been registered.", ProtoReflectionService.class.getName()); } configurer.configure(serverBuilder); server = serverBuilder.build().start(); applicationContext.publishEvent(new GRpcServerInitializedEvent(server)); log.info("gRPC Server started, listening on port {}.", server.getPort()); startDaemonAwaitThread(); }
wq.update(this, curi); // rewrite any changes handleQueue(wq, curi.includesRetireDirective(), now, delay_ms); appCtx.publishEvent(new CrawlURIDispositionEvent(this, curi, DEFERRED_FOR_RETRY)); doJournalReenqueued(curi); appCtx.publishEvent( new CrawlURIDispositionEvent(this, curi, SUCCEEDED)); doJournalFinishedSuccess(curi); appCtx.publishEvent( new CrawlURIDispositionEvent(this, curi, DISREGARDED)); holderCost = 0; // no charge for disregarded URIs appCtx.publishEvent( new CrawlURIDispositionEvent(this, curi, FAILED));