org.elasticsearch.common.component.Lifecycle Java Examples
The following examples show how to use
org.elasticsearch.common.component.Lifecycle.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageChannelHandler.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override public void onFailure(Throwable e) { if (transport.lifecycleState() == Lifecycle.State.STARTED) { // we can only send a response transport is started.... try { transportChannel.sendResponse(e); } catch (Throwable e1) { logger.warn("Failed to send error message back to client for action [" + reg.getAction() + "]", e1); logger.warn("Actual Exception", e); } } }
Example #2
Source File: GraphiteService.java From elasticsearch-graphite-plugin with Do What The F*ck You Want To Public License | 5 votes |
public void run() { while (!closed) { DiscoveryNode node = clusterService.localNode(); boolean isClusterStarted = clusterService.lifecycleState().equals(Lifecycle.State.STARTED); if (isClusterStarted && node != null && node.isMasterNode()) { NodeIndicesStats nodeIndicesStats = indicesService.stats(false); CommonStatsFlags commonStatsFlags = new CommonStatsFlags().clear(); NodeStats nodeStats = nodeService.stats(commonStatsFlags, true, true, true, true, true, true, true, true, true); List<IndexShard> indexShards = getIndexShards(indicesService); GraphiteReporter graphiteReporter = new GraphiteReporter(graphiteHost, graphitePort, graphitePrefix, nodeIndicesStats, indexShards, nodeStats, graphiteInclusionRegex, graphiteExclusionRegex); graphiteReporter.run(); } else { if (node != null) { logger.debug("[{}]/[{}] is not master node, not triggering update", node.getId(), node.getName()); } } try { Thread.sleep(graphiteRefreshInternal.millis()); } catch (InterruptedException e1) { continue; } } }
Example #3
Source File: TcpTransport.java From crate with Apache License 2.0 | 5 votes |
@Override public void onFailure(Exception e) { if (lifecycleState() == Lifecycle.State.STARTED) { // we can only send a response transport is started.... try { transportChannel.sendResponse(e); } catch (Exception inner) { inner.addSuppressed(e); logger.warn(() -> new ParameterizedMessage( "Failed to send error message back to client for action [{}]", reg.getAction()), inner); } } }
Example #4
Source File: StubbableTransport.java From crate with Apache License 2.0 | 4 votes |
@Override public Lifecycle.State lifecycleState() { return delegate.lifecycleState(); }
Example #5
Source File: MockTransport.java From crate with Apache License 2.0 | 4 votes |
@Override public Lifecycle.State lifecycleState() { return null; }
Example #6
Source File: AbstractLifecycleRunnable.java From crate with Apache License 2.0 | 2 votes |
/** * {@link AbstractLifecycleRunnable} must be aware of the actual {@code lifecycle} to react properly. * * @param lifecycle The lifecycle to react too * @param logger The logger to use when logging * @throws NullPointerException if any parameter is {@code null} */ public AbstractLifecycleRunnable(Lifecycle lifecycle, Logger logger) { this.lifecycle = Objects.requireNonNull(lifecycle, "lifecycle must not be null"); this.logger = Objects.requireNonNull(logger, "logger must not be null"); }