diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-04-29 09:35:44 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-04-29 09:35:44 +0200 |
commit | 2a7e2027f1e3cd4643b35bbac412f65f305d994c (patch) | |
tree | f15d99b87a1686b385d3006d96d32b50835add0c /vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java | |
parent | ed25d1bffcfe410e4806402db41fa9b9654c61ca (diff) |
GC unused config
Diffstat (limited to 'vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java')
-rw-r--r-- | vespaclient-core/src/main/java/com/yahoo/feedapi/MessagePropertyProcessor.java | 74 |
1 files changed, 10 insertions, 64 deletions
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; |