diff options
Diffstat (limited to 'vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java')
-rwxr-xr-x | vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java | 160 |
1 files changed, 21 insertions, 139 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 dc78f037534..ecfd3c9eded 100755 --- a/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java +++ b/vespaclient-core/src/main/java/com/yahoo/feedapi/FeederOptions.java @@ -2,9 +2,11 @@ package com.yahoo.feedapi; import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol; -import com.yahoo.messagebus.*; +import com.yahoo.messagebus.DynamicThrottlePolicy; +import com.yahoo.messagebus.RateThrottlingPolicy; +import com.yahoo.messagebus.SourceSessionParams; +import com.yahoo.messagebus.StaticThrottlePolicy; import com.yahoo.messagebus.network.rpc.RPCNetworkParams; -import com.yahoo.messagebus.routing.RetryTransientErrorsPolicy; import com.yahoo.vespaclient.config.FeederConfig; @@ -19,61 +21,28 @@ public class FeederOptions { private boolean abortOnDocumentError = true; private boolean abortOnSendError = true; private boolean retryEnabled = true; - private double retryDelay = 1; private double timeout = 60; private int maxPendingBytes = 0; private int maxPendingDocs = 0; private double maxFeedRate = 0.0; - private String documentManagerConfigId = "client"; - private String idPrefix = ""; private String route = "default"; - private String routingConfigId; - private String slobrokConfigId; private int traceLevel; private int mbusPort; private DocumentProtocol.Priority priority = DocumentProtocol.Priority.NORMAL_3; - private boolean priorityExplicitlySet = false; private String docprocChain = ""; /** Constructs an options object with all default values. */ - public FeederOptions() { + FeederOptions() { // empty } - /** - * Implements the copy constructor. - * - * @param src The options to copy. - */ - public FeederOptions(FeederOptions src) { - abortOnDocumentError = src.abortOnDocumentError; - abortOnSendError = src.abortOnSendError; - retryEnabled = src.retryEnabled; - retryDelay = src.retryDelay; - timeout = src.timeout; - maxPendingBytes = src.maxPendingBytes; - maxPendingDocs = src.maxPendingDocs; - maxFeedRate = src.maxFeedRate; - documentManagerConfigId = src.documentManagerConfigId; - idPrefix = src.idPrefix; - route = src.route; - routingConfigId = src.routingConfigId; - slobrokConfigId = src.slobrokConfigId; - traceLevel = src.traceLevel; - mbusPort = src.mbusPort; - priority = src.priority; - docprocChain = src.docprocChain; - } - /** Constructor that sets values from config. */ - public FeederOptions(FeederConfig config) { + FeederOptions(FeederConfig config) { setAbortOnDocumentError(config.abortondocumenterror()); setAbortOnSendError(config.abortonsenderror()); - setIdPrefix(config.idprefix()); setMaxPendingBytes(config.maxpendingbytes()); setMaxPendingDocs(config.maxpendingdocs()); setRetryEnabled(config.retryenabled()); - setRetryDelay(config.retrydelay()); setRoute(config.route()); setTimeout(config.timeout()); setTraceLevel(config.tracelevel()); @@ -82,31 +51,18 @@ public class FeederOptions { setMaxFeedRate(config.maxfeedrate()); } - public void setMaxFeedRate(double feedRate) { + void setMaxFeedRate(double feedRate) { maxFeedRate = feedRate; } - - public double getMaxFeedRate() { - return maxFeedRate; - } - - public boolean getRetryEnabled() { + boolean getRetryEnabled() { return retryEnabled; } - public void setRetryEnabled(boolean retryEnabled) { + private void setRetryEnabled(boolean retryEnabled) { this.retryEnabled = retryEnabled; } - public double getRetryDelay() { - return retryDelay; - } - - public void setRetryDelay(double retryDelay) { - this.retryDelay = retryDelay; - } - public double getTimeout() { return timeout; } @@ -115,46 +71,30 @@ public class FeederOptions { this.timeout = timeout; } - public int getMaxPendingBytes() { - return maxPendingBytes; - } - - public void setMaxPendingBytes(int maxPendingBytes) { + private void setMaxPendingBytes(int maxPendingBytes) { this.maxPendingBytes = maxPendingBytes; } - public int getMaxPendingDocs() { - return maxPendingDocs; - } - - public void setMaxPendingDocs(int maxPendingDocs) { + private void setMaxPendingDocs(int maxPendingDocs) { this.maxPendingDocs = maxPendingDocs; } - public boolean abortOnDocumentError() { + boolean abortOnDocumentError() { return abortOnDocumentError; } - public void setAbortOnDocumentError(boolean abortOnDocumentError) { + void setAbortOnDocumentError(boolean abortOnDocumentError) { this.abortOnDocumentError = abortOnDocumentError; } - public boolean abortOnSendError() { + boolean abortOnSendError() { return abortOnSendError; } - public void setAbortOnSendError(boolean abortOnSendError) { + private void setAbortOnSendError(boolean abortOnSendError) { this.abortOnSendError = abortOnSendError; } - public String getIdPrefix() { - return idPrefix; - } - - public void setIdPrefix(String idPrefix) { - this.idPrefix = idPrefix; - } - public void setRoute(String route) { this.route = route; } @@ -167,35 +107,7 @@ public class FeederOptions { return priority; } - public boolean isPriorityExplicitlySet() { - return priorityExplicitlySet; - } - - public String getSlobrokConfigId() { - return slobrokConfigId; - } - - public void setSlobrokConfigId(String slobrokConfigId) { - this.slobrokConfigId = slobrokConfigId; - } - - public String getRoutingConfigId() { - return routingConfigId; - } - - public void setRoutingConfigId(String routingConfigId) { - this.routingConfigId = routingConfigId; - } - - public String getDocumentManagerConfigId() { - return documentManagerConfigId; - } - - public void setDocumentManagerConfigId(String documentManagerConfigId) { - this.documentManagerConfigId = documentManagerConfigId; - } - - public int getTraceLevel() { + int getTraceLevel() { return traceLevel; } @@ -203,24 +115,19 @@ public class FeederOptions { this.traceLevel = traceLevel; } - public int getMessageBusPort() { - return mbusPort; - } - - public void setMessageBusPort(int mbusPort) { + private void setMessageBusPort(int mbusPort) { this.mbusPort = mbusPort; } public void setPriority(DocumentProtocol.Priority priority) { this.priority = priority; - this.priorityExplicitlySet = true; } - public String getDocprocChain() { + String getDocprocChain() { return docprocChain; } - public void setDocprocChain(String chain) { + private void setDocprocChain(String chain) { docprocChain = chain; } @@ -228,7 +135,7 @@ public class FeederOptions { * Creates a source session params object with parameters set as these options * dictate. */ - public SourceSessionParams toSourceSessionParams() { + SourceSessionParams toSourceSessionParams() { SourceSessionParams params = new SourceSessionParams(); StaticThrottlePolicy policy; @@ -252,7 +159,7 @@ public class FeederOptions { return params; } - public RPCNetworkParams getNetworkParams() { + RPCNetworkParams getNetworkParams() { try { RPCNetworkParams networkParams = new RPCNetworkParams(); if (mbusPort != -1) { @@ -271,19 +178,13 @@ public class FeederOptions { "abortOnDocumentError=" + abortOnDocumentError + ", abortOnSendError=" + abortOnSendError + ", retryEnabled=" + retryEnabled + - ", retryDelay=" + retryDelay + ", timeout=" + timeout + ", maxPendingBytes=" + maxPendingBytes + ", maxPendingDocs=" + maxPendingDocs + - ", documentManagerConfigId='" + documentManagerConfigId + '\'' + - ", idPrefix='" + idPrefix + '\'' + ", route='" + route + '\'' + - ", routingConfigId='" + routingConfigId + '\'' + - ", slobrokConfigId='" + slobrokConfigId + '\'' + ", traceLevel=" + traceLevel + ", mbusPort=" + mbusPort + ", priority=" + priority.name() + - ", priorityExplicitlySet=" + priorityExplicitlySet + ", docprocChain='" + docprocChain + '\'' + '}'; } @@ -301,24 +202,12 @@ public class FeederOptions { if (maxPendingDocs != that.maxPendingDocs) return false; if (maxFeedRate != that.maxFeedRate) return false; if (mbusPort != that.mbusPort) return false; - if (priorityExplicitlySet != that.priorityExplicitlySet) return false; - if (Double.compare(that.retryDelay, retryDelay) != 0) 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 (documentManagerConfigId != null ? !documentManagerConfigId.equals(that.documentManagerConfigId) : that.documentManagerConfigId != null) { - return false; - } - if (idPrefix != null ? !idPrefix.equals(that.idPrefix) : that.idPrefix != null) return false; if (priority != that.priority) return false; if (route != null ? !route.equals(that.route) : that.route != null) return false; - if (routingConfigId != null ? !routingConfigId.equals(that.routingConfigId) : that.routingConfigId != null) { - return false; - } - if (slobrokConfigId != null ? !slobrokConfigId.equals(that.slobrokConfigId) : that.slobrokConfigId != null) { - return false; - } return true; } @@ -330,22 +219,15 @@ public class FeederOptions { result = (abortOnDocumentError ? 1 : 0); result = 31 * result + (abortOnSendError ? 1 : 0); result = 31 * result + (retryEnabled ? 1 : 0); - temp = retryDelay != +0.0d ? Double.doubleToLongBits(retryDelay) : 0L; - result = 31 * result + (int) (temp ^ (temp >>> 32)); 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 + (documentManagerConfigId != null ? documentManagerConfigId.hashCode() : 0); - result = 31 * result + (idPrefix != null ? idPrefix.hashCode() : 0); result = 31 * result + (route != null ? route.hashCode() : 0); - result = 31 * result + (routingConfigId != null ? routingConfigId.hashCode() : 0); - result = 31 * result + (slobrokConfigId != null ? slobrokConfigId.hashCode() : 0); result = 31 * result + traceLevel; result = 31 * result + mbusPort; result = 31 * result + (priority != null ? priority.hashCode() : 0); - result = 31 * result + (priorityExplicitlySet ? 1 : 0); result = 31 * result + (docprocChain != null ? docprocChain.hashCode() : 0); return result; } |