diff options
Diffstat (limited to 'same/src')
-rw-r--r-- | same/src/main/java/com/orbekk/util/RpcList.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/same/src/main/java/com/orbekk/util/RpcList.java b/same/src/main/java/com/orbekk/util/RpcList.java new file mode 100644 index 0000000..10eecc1 --- /dev/null +++ b/same/src/main/java/com/orbekk/util/RpcList.java @@ -0,0 +1,21 @@ +package com.orbekk.util; + +import java.util.ArrayList; +import java.util.List; + +import com.orbekk.protobuf.Rpc; + +public class RpcList { + private List<Rpc> rpcs = new ArrayList<Rpc>(); + + public synchronized void add(Rpc rpc) { + rpcs.add(rpc); + } + + public synchronized void awaitAll() throws InterruptedException { + for (Rpc rpc : rpcs) { + rpc.await(); + } + rpcs.clear(); + } +} |