summaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin/src
diff options
context:
space:
mode:
authorHaakon Dybdahl <dybdahl@yahoo-inc.com>2017-02-28 08:52:06 +0100
committerHaakon Dybdahl <dybdahl@yahoo-inc.com>2017-02-28 08:52:06 +0100
commita13bfb6cba23ef22bd47c320372a5717fa52654b (patch)
treee7d8b5a16bf6706a5c3cc001f5ebdfb3ffbb39ba /vespaclient-container-plugin/src
parent3d4104770e24160717b0638f4331c4e8e71813d5 (diff)
Route is sticky, need to be set every time.
Diffstat (limited to 'vespaclient-container-plugin/src')
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java
index db9cc1fd9a7..4387f975d01 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/OperationHandlerImpl.java
@@ -142,14 +142,12 @@ public class OperationHandlerImpl implements OperationHandler {
}
private void setRoute(SyncSession session, Optional<String> route) throws RestApiException {
- if (route.isPresent()) {
- if (! (session instanceof MessageBusSyncSession)) {
- // Not sure if this ever could happen but better be safe.
- throw new RestApiException(Response.createErrorResponse(
- 400, "Can not set route since the API is not using message bus."));
- }
- ((MessageBusSyncSession) session).setRoute(route.get());
+ if (! (session instanceof MessageBusSyncSession)) {
+ // Not sure if this ever could happen but better be safe.
+ throw new RestApiException(Response.createErrorResponse(
+ 400, "Can not set route since the API is not using message bus."));
}
+ ((MessageBusSyncSession) session).setRoute(route.orElse("default"));
}
@Override
@@ -207,6 +205,7 @@ public class OperationHandlerImpl implements OperationHandler {
@Override
public Optional<String> get(RestUri restUri) throws RestApiException {
SyncSession syncSession = syncSessions.alloc();
+ setRoute(syncSession, Optional.empty());
try {
DocumentId id = new DocumentId(restUri.generateFullId());
final Document document = syncSession.get(id);