aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@verizonmedia.com>2019-09-20 15:22:18 +0200
committerJon Bratseth <bratseth@verizonmedia.com>2019-09-20 15:22:18 +0200
commit58c42b2ee9d83f72a896076b3fb6a3a8b13544fd (patch)
tree8d73bd187011276b491cc916dda5628da9de6af7 /container-search/src/main/java
parent68d13112bbb3922e2456281cf155b256c8139d40 (diff)
Cleanup - no functional changes
Diffstat (limited to 'container-search/src/main/java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/cache/package-info.java10
-rw-r--r--container-search/src/main/java/com/yahoo/search/cluster/ClusterSearcher.java34
-rw-r--r--container-search/src/main/java/com/yahoo/search/cluster/Hasher.java18
-rw-r--r--container-search/src/main/java/com/yahoo/search/cluster/PingableSearcher.java3
4 files changed, 23 insertions, 42 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/cache/package-info.java b/container-search/src/main/java/com/yahoo/search/cache/package-info.java
deleted file mode 100644
index fb3a9188a55..00000000000
--- a/container-search/src/main/java/com/yahoo/search/cache/package-info.java
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-/**
- * Cache package, exported to keep the ignored legacy cache config around until Vespa 7.
- *
- * @author bratseth
- */
-@ExportPackage
-package com.yahoo.search.cache;
-
-import com.yahoo.osgi.annotation.ExportPackage;
diff --git a/container-search/src/main/java/com/yahoo/search/cluster/ClusterSearcher.java b/container-search/src/main/java/com/yahoo/search/cluster/ClusterSearcher.java
index e99199d85f7..dd8b953e3d0 100644
--- a/container-search/src/main/java/com/yahoo/search/cluster/ClusterSearcher.java
+++ b/container-search/src/main/java/com/yahoo/search/cluster/ClusterSearcher.java
@@ -63,9 +63,7 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod
}
}
- /**
- * Pinging a node, called from ClusterMonitor
- */
+ /** Pinging a node, called from ClusterMonitor */
@Override
public final void ping(T p, Executor executor) {
log(LogLevel.FINE, "Sending ping to: ", p);
@@ -149,9 +147,10 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod
do {
// The loop is in case there are other searchers available able to produce results
if (connection == null)
- return search(query, execution, ErrorMessage
- .createNoBackendsInService("No in node could handle " + query + " according to " +
- hasher + " in " + this));
+ return search(query,
+ execution,
+ ErrorMessage.createNoBackendsInService("No in node could handle " + query +
+ " according to " + hasher + " in " + this));
if (timedOut(query))
return new Result(query, ErrorMessage.createTimeout("No time left for searching"));
@@ -189,7 +188,7 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod
}
/**
- * This is called (instead of search(quer,execution,connextion) to handle
+ * This is called (instead of search(query, execution, connection) to handle
* searches where no (suitable) backend was available. The default
* implementation returns an error result.
*/
@@ -198,7 +197,7 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod
}
/**
- * Call search(Query,Execution,T) and handle any exceptions returned which
+ * Call search(Query, Execution, T) and handle any exceptions returned which
* we do not want to propagate upwards By default this catches all runtime
* exceptions and puts them into the result
*/
@@ -214,13 +213,12 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod
}
if (result == null)
- result = new Result(query, ErrorMessage
- .createBackendCommunicationError("No result returned in " + this +
- " from " + connection + " for " + query));
+ result = new Result(query, ErrorMessage.createBackendCommunicationError("No result returned in " + this +
+ " from " + connection + " for " + query));
if (result.hits().getError() != null) {
log(LogLevel.FINE, "FAILED: ", query);
- } else if (!result.isCached()) {
+ } else if ( ! result.isCached()) {
log(LogLevel.FINE, "WORKING: ", query);
} else {
log(LogLevel.FINE, "CACHE HIT: ", query);
@@ -243,15 +241,13 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod
T connection = nodes.select(code, 0);
if (connection != null) {
if (timedOut(query)) {
- result.hits().addError(
- ErrorMessage.createTimeout("No time left to get summaries for " + result));
+ result.hits().addError(ErrorMessage.createTimeout("No time left to get summaries for " + result));
} else {
// query.setTimeout(getNodeTimeout(query));
doFill(connection, result, summaryClass, execution);
}
} else {
- result.hits().addError(
- ErrorMessage.createNoBackendsInService("Could not fill '" + result + "' in '" + this + "'"));
+ result.hits().addError(ErrorMessage.createNoBackendsInService("Could not fill '" + result + "' in '" + this + "'"));
}
}
@@ -259,10 +255,8 @@ public abstract class ClusterSearcher<T> extends PingableSearcher implements Nod
try {
fill(result, summaryClass, execution, connection);
} catch (RuntimeException e) {
- result.hits().addError(
- ErrorMessage
- .createBackendCommunicationError("Error filling " + result + " from " + connection + ": " +
- Exceptions.toMessageString(e)));
+ result.hits().addError(ErrorMessage.createBackendCommunicationError("Error filling " + result + " from " + connection + ": " +
+ Exceptions.toMessageString(e)));
}
if (result.hits().getError() != null) {
log(LogLevel.FINE, "FAILED: ", result.getQuery());
diff --git a/container-search/src/main/java/com/yahoo/search/cluster/Hasher.java b/container-search/src/main/java/com/yahoo/search/cluster/Hasher.java
index 5eda79a0885..46752b0bedb 100644
--- a/container-search/src/main/java/com/yahoo/search/cluster/Hasher.java
+++ b/container-search/src/main/java/com/yahoo/search/cluster/Hasher.java
@@ -98,14 +98,13 @@ public class Hasher<T> {
* and determines how often this node will be selected compared
* to the other nodes
*/
- public synchronized void add(T node,int load) {
- assert(nodes != null);
- if(!nodes.hasNode(node)) {
+ public synchronized void add(T node, int load) {
+ if ( ! nodes.hasNode(node)) {
NodeFactor<T>[] oldNodes = nodes.nodes;
@SuppressWarnings("unchecked")
- NodeFactor<T>[] newNodes = (NodeFactor<T>[]) new NodeFactor[oldNodes.length+ 1];
- System.arraycopy(oldNodes,0,newNodes,0,oldNodes.length);
- newNodes[newNodes.length-1] = new NodeFactor<>(node, load);
+ NodeFactor<T>[] newNodes = (NodeFactor<T>[]) new NodeFactor[oldNodes.length + 1];
+ System.arraycopy(oldNodes, 0, newNodes, 0, oldNodes.length);
+ newNodes[newNodes.length - 1] = new NodeFactor<>(node, load);
//Atomic switch due to volatile
nodes = new NodeList<>(newNodes);
@@ -114,7 +113,7 @@ public class Hasher<T> {
/** Removes a node */
public synchronized void remove(T node) {
- if( nodes.hasNode(node)) {
+ if (nodes.hasNode(node)) {
NodeFactor<T>[] oldNodes = nodes.nodes;
@SuppressWarnings("unchecked")
NodeFactor<T>[] newNodes = (NodeFactor<T>[]) new NodeFactor[oldNodes.length - 1];
@@ -128,10 +127,9 @@ public class Hasher<T> {
}
}
- /**
- * Returns a list of nodes that are up.
- */
+ /** Returns a list of nodes that are up.*/
public NodeList<T> getNodes() {
return nodes;
}
+
}
diff --git a/container-search/src/main/java/com/yahoo/search/cluster/PingableSearcher.java b/container-search/src/main/java/com/yahoo/search/cluster/PingableSearcher.java
index 145970f5407..57bb5c9d47d 100644
--- a/container-search/src/main/java/com/yahoo/search/cluster/PingableSearcher.java
+++ b/container-search/src/main/java/com/yahoo/search/cluster/PingableSearcher.java
@@ -14,8 +14,7 @@ import com.yahoo.search.searchchain.Execution;
*/
public abstract class PingableSearcher extends Searcher {
- public PingableSearcher() {
- }
+ public PingableSearcher() { }
public PingableSearcher(ComponentId id) {
super(id);