diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-04-17 13:28:55 +0200 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-04-17 13:28:55 +0200 |
commit | f9203738fb20ddcce03598a16b92b63358ecb861 (patch) | |
tree | 312cf28a0a3a8e4703b526e7b85b3e12b1933977 /same/src | |
parent | 3f007673deb7b4c4a59f9d5ba501aa379db1dfc1 (diff) |
Add Services.Client to ConnectionManager.
Diffstat (limited to 'same/src')
3 files changed, 18 insertions, 0 deletions
diff --git a/same/src/main/java/com/orbekk/same/ConnectionManager.java b/same/src/main/java/com/orbekk/same/ConnectionManager.java index 4a24da5..f1ca65f 100644 --- a/same/src/main/java/com/orbekk/same/ConnectionManager.java +++ b/same/src/main/java/com/orbekk/same/ConnectionManager.java @@ -13,5 +13,6 @@ public interface ConnectionManager { PaxosService getPaxos(String url); Services.Master getMaster0(String location); + Services.Client getClient0(String location); Services.Directory getDirectory(String location); } diff --git a/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java b/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java index 8c3b9df..34536a0 100644 --- a/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java +++ b/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java @@ -127,6 +127,16 @@ public class ConnectionManagerImpl implements ConnectionManager { } @Override + public Services.Client getClient0(String location) { + RpcChannel channel = getChannel(location); + if (channel != null) { + return Services.Client.newStub(channel); + } else { + return null; + } + } + + @Override public Services.Directory getDirectory(String location) { RpcChannel channel = getChannel(location); if (channel != null) { diff --git a/same/src/main/java/com/orbekk/same/TestConnectionManager.java b/same/src/main/java/com/orbekk/same/TestConnectionManager.java index 8319467..2305311 100644 --- a/same/src/main/java/com/orbekk/same/TestConnectionManager.java +++ b/same/src/main/java/com/orbekk/same/TestConnectionManager.java @@ -21,6 +21,8 @@ public class TestConnectionManager implements ConnectionManager { new HashMap<String, Services.Directory>(); public Map<String, Services.Master> masterMap0 = new HashMap<String, Services.Master>(); + public Map<String, Services.Client> clientMap0 = + new HashMap<String, Services.Client>(); public TestConnectionManager() { } @@ -49,4 +51,9 @@ public class TestConnectionManager implements ConnectionManager { public Master getMaster0(String location) { return masterMap0.get(location); } + + @Override + public Services.Client getClient0(String location) { + return clientMap0.get(location); + } } |