summaryrefslogtreecommitdiff
path: root/src/main/java/com/orbekk/protobuf/Rpc.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/orbekk/protobuf/Rpc.java')
-rw-r--r--src/main/java/com/orbekk/protobuf/Rpc.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/com/orbekk/protobuf/Rpc.java b/src/main/java/com/orbekk/protobuf/Rpc.java
index c208380..0f6b6cb 100644
--- a/src/main/java/com/orbekk/protobuf/Rpc.java
+++ b/src/main/java/com/orbekk/protobuf/Rpc.java
@@ -24,6 +24,7 @@ import com.google.protobuf.RpcController;
public class Rpc implements RpcController {
private String errorText = "";
+ private CountDownLatch done = new CountDownLatch(1);
private boolean hasFailed;
private boolean canceled;
private List<RpcCallback<Object>> cancelNotificationListeners = null;
@@ -64,6 +65,18 @@ public class Rpc implements RpcController {
return errorText;
}
+ public boolean isDone() {
+ return done.getCount() == 0;
+ }
+
+ public void await() throws InterruptedException {
+ done.await();
+ }
+
+ void complete() {
+ done.countDown();
+ }
+
public boolean isOk() {
return !hasFailed && !canceled;
}