summaryrefslogtreecommitdiffstats
path: root/vespaclient-core
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2019-04-29 09:35:44 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2019-04-29 09:35:44 +0200
commit2a7e2027f1e3cd4643b35bbac412f65f305d994c (patch)
treef15d99b87a1686b385d3006d96d32b50835add0c /vespaclient-core
parented25d1bffcfe410e4806402db41fa9b9654c61ca (diff)
GC unused config
Diffstat (limited to 'vespaclient-core')
-rwxr-xr-xvespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java27
-rw-r--r--vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java74
-rw-r--r--vespaclient-core/src/main/resources/configdefinitions/feeder.def9
3 files changed, 11 insertions, 99 deletions
diff --git a/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java b/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java
index ecfd3c9eded..25ef7651e28 100755
--- a/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java
+++ b/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java
@@ -22,14 +22,12 @@ public class FeederOptions {
private boolean abortOnSendError = true;
private boolean retryEnabled = true;
private double timeout = 60;
- private int maxPendingBytes = 0;
private int maxPendingDocs = 0;
private double maxFeedRate = 0.0;
private String route = "default";
private int traceLevel;
private int mbusPort;
private DocumentProtocol.Priority priority = DocumentProtocol.Priority.NORMAL_3;
- private String docprocChain = "";
/** Constructs an options object with all default values. */
FeederOptions() {
@@ -40,14 +38,12 @@ public class FeederOptions {
FeederOptions(FeederConfig config) {
setAbortOnDocumentError(config.abortondocumenterror());
setAbortOnSendError(config.abortonsenderror());
- setMaxPendingBytes(config.maxpendingbytes());
setMaxPendingDocs(config.maxpendingdocs());
setRetryEnabled(config.retryenabled());
setRoute(config.route());
setTimeout(config.timeout());
setTraceLevel(config.tracelevel());
setMessageBusPort(config.mbusport());
- setDocprocChain(config.docprocchain());
setMaxFeedRate(config.maxfeedrate());
}
@@ -71,10 +67,6 @@ public class FeederOptions {
this.timeout = timeout;
}
- private void setMaxPendingBytes(int maxPendingBytes) {
- this.maxPendingBytes = maxPendingBytes;
- }
-
private void setMaxPendingDocs(int maxPendingDocs) {
this.maxPendingDocs = maxPendingDocs;
}
@@ -123,14 +115,6 @@ public class FeederOptions {
this.priority = priority;
}
- String getDocprocChain() {
- return docprocChain;
- }
-
- private void setDocprocChain(String chain) {
- docprocChain = chain;
- }
-
/**
* Creates a source session params object with parameters set as these options
* dictate.
@@ -141,7 +125,7 @@ public class FeederOptions {
StaticThrottlePolicy policy;
if (maxFeedRate > 0.0) {
policy = new RateThrottlingPolicy(maxFeedRate);
- } else if ((maxPendingDocs == 0) && (maxPendingBytes == 0)) {
+ } else if (maxPendingDocs == 0) {
policy = new DynamicThrottlePolicy();
} else {
policy = new StaticThrottlePolicy();
@@ -149,9 +133,6 @@ public class FeederOptions {
if (maxPendingDocs > 0) {
policy.setMaxPendingCount(maxPendingDocs);
}
- if (maxPendingBytes > 0) {
- policy.setMaxPendingSize(maxPendingBytes);
- }
params.setThrottlePolicy(policy);
@@ -179,13 +160,11 @@ public class FeederOptions {
", abortOnSendError=" + abortOnSendError +
", retryEnabled=" + retryEnabled +
", timeout=" + timeout +
- ", maxPendingBytes=" + maxPendingBytes +
", maxPendingDocs=" + maxPendingDocs +
", route='" + route + '\'' +
", traceLevel=" + traceLevel +
", mbusPort=" + mbusPort +
", priority=" + priority.name() +
- ", docprocChain='" + docprocChain + '\'' +
'}';
}
@@ -198,14 +177,12 @@ public class FeederOptions {
if (abortOnDocumentError != that.abortOnDocumentError) return false;
if (abortOnSendError != that.abortOnSendError) return false;
- if (maxPendingBytes != that.maxPendingBytes) return false;
if (maxPendingDocs != that.maxPendingDocs) return false;
if (maxFeedRate != that.maxFeedRate) return false;
if (mbusPort != that.mbusPort) return false;
if (retryEnabled != that.retryEnabled) return false;
if (Double.compare(that.timeout, timeout) != 0) return false;
if (traceLevel != that.traceLevel) return false;
- if (docprocChain != null ? !docprocChain.equals(that.docprocChain) : that.docprocChain != null) return false;
if (priority != that.priority) return false;
if (route != null ? !route.equals(that.route) : that.route != null) return false;
@@ -221,14 +198,12 @@ public class FeederOptions {
result = 31 * result + (retryEnabled ? 1 : 0);
temp = timeout != +0.0d ? Double.doubleToLongBits(timeout) : 0L;
result = 31 * result + (int) (temp ^ (temp >>> 32));
- result = 31 * result + maxPendingBytes;
result = 31 * result + maxPendingDocs;
result = 31 * result + ((int)(maxFeedRate * 1000));
result = 31 * result + (route != null ? route.hashCode() : 0);
result = 31 * result + traceLevel;
result = 31 * result + mbusPort;
result = 31 * result + (priority != null ? priority.hashCode() : 0);
- result = 31 * result + (docprocChain != null ? docprocChain.hashCode() : 0);
return result;
}
}
diff --git a/vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java b/vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java
index 11688ba62e4..74a4f916c07 100644
--- a/vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java
+++ b/vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java
@@ -1,20 +1,15 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.feedapi;
-import com.yahoo.component.provider.ComponentRegistry;
import com.yahoo.concurrent.SystemTimer;
import com.yahoo.config.subscription.ConfigSubscriber;
import com.yahoo.container.jdisc.HttpRequest;
import com.yahoo.vespa.config.content.LoadTypeConfig;
-import com.yahoo.container.Container;
-import com.yahoo.docproc.DocprocService;
-import com.yahoo.docproc.jdisc.DocumentProcessingHandler;
import com.yahoo.documentapi.VisitorParameters;
import com.yahoo.documentapi.messagebus.loadtypes.LoadType;
import com.yahoo.documentapi.messagebus.loadtypes.LoadTypeSet;
import com.yahoo.documentapi.messagebus.protocol.DocumentMessage;
import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
-import com.yahoo.jdisc.handler.RequestHandler;
import com.yahoo.log.LogLevel;
import com.yahoo.messagebus.Message;
import com.yahoo.messagebus.routing.Route;
@@ -29,6 +24,8 @@ import java.util.logging.Logger;
public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscriber<FeederConfig> {
private static final Logger log = Logger.getLogger(MessagePropertyProcessor.class.getName());
+ private static final boolean defaultCreateIfNonExistent = false;
+
private FeederOptions feederOptions = null;
private Route defaultRoute = null;
private long defaultTimeoutMillis = 0;
@@ -36,8 +33,7 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib
private String defaultDocprocChain = null;
private boolean defaultAbortOnDocumentError = true;
private boolean defaultAbortOnSendError = true;
- private boolean defaultCreateIfNonExistent = false;
- private LoadTypeSet loadTypes = null;
+ private final LoadTypeSet loadTypes;
private boolean configChanged = false;
@@ -50,50 +46,6 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib
defaultRoute = Route.parse(routeOverride);
}
- private synchronized String getDocprocChainParameter(HttpRequest request) {
- String docprocChainParam = request.getProperty("docprocchain");
- return (docprocChainParam == null ? defaultDocprocChain : docprocChainParam);
- }
-
- public synchronized DocprocService getDocprocChain(HttpRequest request) {
- ComponentRegistry<DocprocService> services = getDocprocServiceRegistry(request);
-
- String docprocChain = getDocprocChainParameter(request);
- if (docprocChain == null) {
- return null;
- }
-
- return services.getComponent(docprocChain);
- }
-
- public synchronized ComponentRegistry<DocprocService> getDocprocServiceRegistry(HttpRequest request) {
- String docprocChain = getDocprocChainParameter(request);
- if (docprocChain == null) {
- return null;
- }
-
- Container container = Container.get();
- if (container == null) {
- throw new IllegalStateException("Could not get Container instance.");
- }
-
- ComponentRegistry<RequestHandler> requestHandlerRegistry = container.getRequestHandlerRegistry();
- if (requestHandlerRegistry == null) {
- throw new IllegalStateException("Could not get requesthandlerregistry.");
- }
-
- DocumentProcessingHandler handler = (DocumentProcessingHandler) requestHandlerRegistry
- .getComponent(DocumentProcessingHandler.class.getName());
- if (handler == null) {
- return null;
- }
- ComponentRegistry<DocprocService> services = handler.getDocprocServiceRegistry();
- if (services == null) {
- throw new IllegalStateException("Could not get DocprocServiceRegistry.");
- }
- return services;
- }
-
public PropertySetter buildPropertySetter(HttpRequest request) {
String routeParam = null;
double timeoutParam = -1;
@@ -163,15 +115,15 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib
public long getDefaultTimeoutMillis() { return defaultTimeoutMillis; }
- public synchronized boolean configChanged() {
+ synchronized boolean configChanged() {
return configChanged;
}
- public synchronized void setConfigChanged(boolean configChanged) {
+ synchronized void setConfigChanged(boolean configChanged) {
this.configChanged = configChanged;
}
- public synchronized FeederOptions getFeederOptions() {
+ synchronized FeederOptions getFeederOptions() {
return feederOptions;
}
@@ -180,7 +132,7 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib
configure(config);
}
- public LoadTypeSet getLoadTypes() {
+ LoadTypeSet getLoadTypes() {
return loadTypes;
}
@@ -200,12 +152,6 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib
defaultAbortOnDocumentError = feederOptions.abortOnDocumentError();
defaultAbortOnSendError = feederOptions.abortOnSendError();
- if (!"".equals(feederOptions.getDocprocChain())) {
- defaultDocprocChain = feederOptions.getDocprocChain();
- } else {
- defaultDocprocChain = null;
- }
-
if (log.isLoggable(LogLevel.DEBUG)) {
log.log(LogLevel.DEBUG, "Received new config (" +
"route: " + (defaultRoute != null ? defaultRoute : "<none>") +
@@ -232,9 +178,9 @@ public class MessagePropertyProcessor implements ConfigSubscriber.SingleSubscrib
private LoadType loadType;
private int traceLevel;
- public PropertySetter(Route route, long timeout, long totalTimeout, DocumentProtocol.Priority priority, LoadType loadType,
- boolean retryEnabled, boolean abortOnDocumentError, boolean abortOnFeedError,
- boolean createIfNonExistent, int traceLevel) {
+ PropertySetter(Route route, long timeout, long totalTimeout, DocumentProtocol.Priority priority, LoadType loadType,
+ boolean retryEnabled, boolean abortOnDocumentError, boolean abortOnFeedError,
+ boolean createIfNonExistent, int traceLevel) {
this.route = route;
this.timeout = timeout;
this.totalTimeout = totalTimeout;
diff --git a/vespaclient-core/src/main/resources/configdefinitions/feeder.def b/vespaclient-core/src/main/resources/configdefinitions/feeder.def
index 2c95cf25398..e138be715d5 100644
--- a/vespaclient-core/src/main/resources/configdefinitions/feeder.def
+++ b/vespaclient-core/src/main/resources/configdefinitions/feeder.def
@@ -11,12 +11,6 @@ abortonsenderror bool default=true
## Max number of pending operations.
maxpendingdocs int default=0
-## Max number of bytes in pending operations.
-maxpendingbytes int default=0
-
-## Max number of busy threads
-maxbusythreads int default=150
-
## Max number of operations to perform per second (0 == no max)
maxfeedrate double default=0.0
@@ -35,8 +29,5 @@ tracelevel int default=0
## Messagebus port to start source session on
mbusport int default=-1
-## Default docproc chain to run
-docprocchain string default=""
-
## Whether or not to set create-if-non-existent flag on all document updates handled by a feeder.
createifnonexistent bool default=false