diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-18 20:17:10 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-18 20:17:10 +0100 |
commit | 6c150264b21eded212b9e2cf9c802b36c3f75144 (patch) | |
tree | 3c832ca031d4ee679981fd8e9639f87a8203069c /same/src | |
parent | 6965ac2e1c471238c6c394a75dc07d19fc33703c (diff) |
Refactor client.
Diffstat (limited to 'same/src')
-rw-r--r-- | same/src/main/java/com/orbekk/same/ClientApp.java | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/same/src/main/java/com/orbekk/same/ClientApp.java b/same/src/main/java/com/orbekk/same/ClientApp.java index 34380a0..5829c5d 100644 --- a/same/src/main/java/com/orbekk/same/ClientApp.java +++ b/same/src/main/java/com/orbekk/same/ClientApp.java @@ -12,7 +12,8 @@ public class ClientApp { private Server server; private static final int timeout = 1000; - public void run(int port, String networkName, String masterUrl) { + public ClientService getClient(int port, String networkName, + String masterUrl) { logger.info("Starting client with port:{}, networkName:{}, masterUrl:{}", new Object[]{port, networkName, masterUrl}); ConnectionManagerImpl connections = new ConnectionManagerImpl(timeout, @@ -45,11 +46,16 @@ public class ClientApp { } client.joinNetwork(masterUrl + "MasterService.json"); - + return client; + } + + public void run(int port, String networkName, + String masterUrl) { + getClient(port, networkName, masterUrl); try { server.join(); } catch (InterruptedException e) { - logger.info("Received exception. Exiting. {}", e); + logger.warn("Interrupted.", e); } } @@ -62,5 +68,6 @@ public class ClientApp { String networkName = args[1]; String masterUrl = args[2]; (new ClientApp()).run(port, networkName, masterUrl); + } } |