From 6a030381607aaf7b44529c4d5a6552749305c3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Tue, 28 Feb 2012 11:57:48 +0100 Subject: Run SameService in a separate process. --- same/src/main/java/com/orbekk/same/Client.java | 4 +++- same/src/main/java/com/orbekk/util/DelayedOperation.java | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'same/src/main/java') diff --git a/same/src/main/java/com/orbekk/same/Client.java b/same/src/main/java/com/orbekk/same/Client.java index b18f523..d035881 100644 --- a/same/src/main/java/com/orbekk/same/Client.java +++ b/same/src/main/java/com/orbekk/same/Client.java @@ -44,7 +44,9 @@ public class Client implements DiscoveryListener { boolean success = master.updateStateRequest( component.getName(), component.getData(), component.getRevision()); - if (!success) { + if (success) { + op.complete(DelayedOperation.Status.createOk()); + } else { op.complete(DelayedOperation.Status .createConflict("Conflict from master")); } diff --git a/same/src/main/java/com/orbekk/util/DelayedOperation.java b/same/src/main/java/com/orbekk/util/DelayedOperation.java index 21215e7..c423a7d 100644 --- a/same/src/main/java/com/orbekk/util/DelayedOperation.java +++ b/same/src/main/java/com/orbekk/util/DelayedOperation.java @@ -26,6 +26,18 @@ public class DelayedOperation { this.message = message; } + public boolean isOk() { + return status == OK; + } + + public int getStatusCode() { + return status; + } + + public String getMessage() { + return message; + } + @Override public String toString() { switch(status) { case OK: -- cgit v1.2.3