summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@yahoo-inc.com>2016-10-03 11:39:05 +0200
committerJon Bratseth <bratseth@yahoo-inc.com>2016-10-03 11:39:05 +0200
commite9b22c8134ef21efeaefc235070439e4a30495e6 (patch)
tree8c1dfa33f24cb066b5963077660b9bc1becaf231
parentd2707307aded3dccec0ce3a965d9d5ed4a24d8e0 (diff)
Dirty workaround to DI hostile legacy code
-rw-r--r--document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java8
-rwxr-xr-xvespaclient-core/src/main/java/com/yahoo/feedapi/FeedContext.java25
2 files changed, 24 insertions, 9 deletions
diff --git a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java
index 49e61f64e3d..9e764aae798 100644
--- a/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java
+++ b/document/src/main/java/com/yahoo/document/serialization/VespaDocumentDeserializer42.java
@@ -78,8 +78,8 @@ import static com.yahoo.text.Utf8.calculateStringPositions;
* @deprecated Please use {@link com.yahoo.document.serialization.VespaDocumentDeserializerHead} instead for new code.
* @author baldersheim
*/
-@Deprecated // OK: Don't remove on Vespa 6: Mail may have documents on this format still
-// When removing: Move content of this class into VespaDocumentDeserializerHead (and subclass VespaDocumentSerializerHead in that)
+@Deprecated // Remove on Vespa 7
+// When removing: Move content of this class into VespaDocumentDeserializerHead
public class VespaDocumentDeserializer42 extends VespaDocumentSerializer42 implements DocumentDeserializer {
private final Compressor compressor = new Compressor();
@@ -597,8 +597,8 @@ public class VespaDocumentDeserializer42 extends VespaDocumentSerializer42 imple
DocumentType docType = manager.getDocumentType(new DataTypeName(docTypeName));
if (docType == null) {
- throw new DeserializationException(
- "No known document type with name " + new Utf8String(docTypeName).toString());
+ throw new DeserializationException("No known document type with name " +
+ new Utf8String(docTypeName).toString());
}
return docType;
}
diff --git a/vespaclient-core/src/main/java/com/yahoo/feedapi/FeedContext.java b/vespaclient-core/src/main/java/com/yahoo/feedapi/FeedContext.java
index c08d70b02f4..885e28b63a5 100755
--- a/vespaclient-core/src/main/java/com/yahoo/feedapi/FeedContext.java
+++ b/vespaclient-core/src/main/java/com/yahoo/feedapi/FeedContext.java
@@ -11,6 +11,7 @@ import com.yahoo.clientmetrics.ClientMetrics;
import com.yahoo.vespaclient.ClusterList;
import com.yahoo.vespaclient.config.FeederConfig;
+import javax.naming.OperationNotSupportedException;
import java.util.Map;
import java.util.TreeMap;
@@ -100,11 +101,25 @@ public class FeedContext {
try {
if (instance == null) {
MessagePropertyProcessor proc = new MessagePropertyProcessor(feederConfig, loadTypeConfig);
- MessageBusSessionFactory mbusFactory = new MessageBusSessionFactory(proc, documentmanagerConfig, slobroksConfig);
- instance = new FeedContext(proc,
- mbusFactory,
- mbusFactory.getAccess().getDocumentTypeManager(),
- new ClusterList(clusterListConfig), metric);
+
+ if (System.getProperty("vespa.local", "false").equals("true")) {
+ // Use injected configs when running from Application. This means we cannot reconfigure
+ MessageBusSessionFactory mbusFactory = new MessageBusSessionFactory(proc, documentmanagerConfig, slobroksConfig);
+ instance = new FeedContext(proc,
+ mbusFactory,
+ mbusFactory.getAccess().getDocumentTypeManager(),
+ new ClusterList(clusterListConfig), metric);
+ }
+ else {
+ // Don't send configs to messagebus to make it self-subscribe instead as this instance
+ // survives reconfig :-/
+ // This code will die soon ...
+ MessageBusSessionFactory mbusFactory = new MessageBusSessionFactory(proc, null, null);
+ instance = new FeedContext(proc,
+ mbusFactory,
+ mbusFactory.getAccess().getDocumentTypeManager(),
+ new ClusterList("client"), metric);
+ }
} else {
instance.getPropertyProcessor().configure(feederConfig, loadTypeConfig);
}