aboutsummaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin/src/main/java/com/yahoo/documentapi
diff options
context:
space:
mode:
authorvalerijf <valerijf@yahoo-inc.com>2017-05-11 14:39:15 +0200
committervalerijf <valerijf@yahoo-inc.com>2017-05-11 14:39:15 +0200
commite227d212b3c0791fe233cd7ffa95d295cc9e078c (patch)
treedb159c1e2acda030759f71295eae48b8ed378253 /vespaclient-container-plugin/src/main/java/com/yahoo/documentapi
parenta661b7f44aecae50f15b61111cd6d567b6b62f58 (diff)
Set DocumentOperationType in ReplyContext
Diffstat (limited to 'vespaclient-container-plugin/src/main/java/com/yahoo/documentapi')
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/documentapi/metrics/DocumentOperationType.java23
1 files changed, 12 insertions, 11 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/documentapi/metrics/DocumentOperationType.java b/vespaclient-container-plugin/src/main/java/com/yahoo/documentapi/metrics/DocumentOperationType.java
index 56849b9db8f..8f699c156b4 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/documentapi/metrics/DocumentOperationType.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/documentapi/metrics/DocumentOperationType.java
@@ -1,25 +1,26 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.documentapi.metrics;
-import com.yahoo.documentapi.messagebus.protocol.DocumentProtocol;
+import com.yahoo.documentapi.messagebus.protocol.PutDocumentMessage;
+import com.yahoo.documentapi.messagebus.protocol.RemoveDocumentMessage;
+import com.yahoo.documentapi.messagebus.protocol.UpdateDocumentMessage;
import com.yahoo.messagebus.Message;
/**
* @author freva
*/
public enum DocumentOperationType {
- PUT, REMOVE, UPDATE;
+ PUT, REMOVE, UPDATE, ERROR;
public static DocumentOperationType fromMessage(Message msg) {
- switch (msg.getType()) {
- case DocumentProtocol.MESSAGE_PUTDOCUMENT:
- return PUT;
- case DocumentProtocol.MESSAGE_UPDATEDOCUMENT:
- return UPDATE;
- case DocumentProtocol.MESSAGE_REMOVEDOCUMENT:
- return REMOVE;
- default:
- return null;
+ if (msg instanceof PutDocumentMessage) {
+ return PUT;
+ } else if (msg instanceof RemoveDocumentMessage) {
+ return REMOVE;
+ } else if (msg instanceof UpdateDocumentMessage) {
+ return UPDATE;
+ } else {
+ return ERROR;
}
}
}