private StatusResponse() { super(com.yahoo.jdisc.http.HttpResponse.Status.OK); // status may be overwritten below if (vipStatus != null && ! vipStatus.isInRotation()) { searchContainerOutOfService(); } else if (accessDisk) { preSlurpFile(); } else { vipRespond(); } }
public Builder(ThreadpoolConfig config) { maxthreads(config.maxthreads()); maxThreadExecutionTimeSeconds(config.maxThreadExecutionTimeSeconds()); }
private Builder override(Builder __superior) { if (__superior.maxthreads != null) maxthreads(__superior.maxthreads); if (__superior.maxThreadExecutionTimeSeconds != null) maxThreadExecutionTimeSeconds(__superior.maxThreadExecutionTimeSeconds); return this; }
public ThreadPoolProvider(ThreadpoolConfig threadpoolConfig, Metric metric, ProcessTerminator processTerminator) { WorkerCompletionTimingThreadPoolExecutor executor = new WorkerCompletionTimingThreadPoolExecutor(threadpoolConfig.maxthreads(), threadpoolConfig.maxthreads(), 0L, TimeUnit.SECONDS, new SynchronousQueue<>(false), ThreadFactoryFactory.getThreadFactory("threadpool")); // Prestart needed, if not all threads will be created by the fist N tasks and hence they might also // get the dreaded thread locals initialized even if they will never run. // That counters what we we want to achieve with the Q that will prefer thread locality. executor.prestartAllCoreThreads(); threadpool = new ExecutorServiceWrapper(executor, metric, processTerminator, threadpoolConfig.maxThreadExecutionTimeSeconds() * 1000L); }
@Override public void getConfig(ThreadpoolConfig.Builder builder) { builder.maxthreads(10); } }
/** @deprecated use removeFromRotation(String) instead */ @Deprecated // TODO: Remove on Vespa 8 public void removeFromRotation(Object clusterIdentifier) { removeFromRotation((String) clusterIdentifier); }
/** @deprecated use addToRotation(String) instead */ @Deprecated // TODO: Remove on Vespa 8 public void addToRotation(Object clusterIdentifier) { addToRotation((String) clusterIdentifier); }
@Override public HttpResponse handle(HttpRequest request) { if (metric != null) metric.add(NUM_REQUESTS_METRIC, 1, null); if (vipStatus != null) updateAndLogRotationState(); return new StatusResponse(); }
/** Note that a cluster (which influences up/down state) is down */ public void removeFromRotation(String clusterIdentifier) { clustersStatus.setDown(clusterIdentifier); }
private static long getEvalStart(Timing timing, long startTime) { if (timing == null || timing.getQueryStartTime() == 0L) { return startTime; } else { return timing.getQueryStartTime(); } }
@java.lang.Override public final boolean dispatchGetConfig(ConfigInstance.Producer producer) { if (producer instanceof Producer) { ((Producer)producer).getConfig(this); return true; } return false; }
private Coverage(long docs, long active, int nodes, int resultSets, FullCoverageDefinition fullReason) { this.docs = docs; this.nodes = nodes; this.nodesTried = nodes; this.active = active; this.soonActive = active; this.degradedReason = 0; this.resultSets = resultSets; this.fullReason = fullReason; this.fullResultSets = getFull() ? resultSets : 0; }
/** Note that a cluster (which influences up/down state) is up */ public void addToRotation(String clusterIdentifier) { clustersStatus.setUp(clusterIdentifier); }
/** Returns whether this container should receive traffic at this time */ public boolean isInRotation() { if (inRotationOverride != null) return inRotationOverride; return clustersStatus.containerShouldReceiveTraffic(); }
public ThreadpoolConfig build() { return new ThreadpoolConfig(this); }
public boolean isDegradedByNonIdealState() { return (degradedReason == 0) && (getResultPercentage() != 100);}
public boolean isDegraded() { return (degradedReason != 0) || isDegradedByNonIdealState(); } public boolean isDegradedByMatchPhase() { return (degradedReason & DEGRADED_BY_MATCH_PHASE) != 0; }
public Coverage setNodesTried(int nodesTried) { super.setNodesTried(nodesTried); return this; } }
private void accessDenied() { contentType = "text/plain"; data = Utf8.toBytes("Status file inaccessible.\n"); setStatus(com.yahoo.jdisc.http.HttpResponse.Status.NOT_FOUND); }
/** @deprecated use setDown(String) instead */ @Deprecated // TODO: Remove on Vespa 8 public void setDown(Object clusterIdentifier) { setDown((String) clusterIdentifier); }