diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-16 21:33:33 +0100 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-01-16 21:33:33 +0100 |
commit | 25fa884b6bd18fe132ea3986229efa1990cb4974 (patch) | |
tree | 818ebfbc966d83b07b97936e41db78480d5b3f80 /same/old/Client.java | |
parent | 3954fd70274cb175394a5060f251331a96d9dc8b (diff) |
Remove old SameService code.
Diffstat (limited to 'same/old/Client.java')
-rw-r--r-- | same/old/Client.java | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/same/old/Client.java b/same/old/Client.java deleted file mode 100644 index 11a7449..0000000 --- a/same/old/Client.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.orbekk.same; - -import com.googlecode.jsonrpc4j.JsonRpcServer; -import com.orbekk.net.HttpUtil; -import org.eclipse.jetty.server.Server; - -public class Client { - - public static void main(String[] args) { - if (args.length < 4) { - System.err.println("Arguments: port clientId thisNetworkName " + - "remoteNetworkAddr"); - System.exit(1); - } - int port = Integer.parseInt(args[0]); - String clientId = args[1]; - String networkName = args[2]; - String remoteAddr = args[3]; - - ConnectionManagerImpl connections = new ConnectionManagerImpl(); - - SameState sameState = new SameState(networkName, clientId, - connections); - sameState.start(); - - SameServiceImpl service = new SameServiceImpl(sameState); - JsonRpcServer jsonServer = new JsonRpcServer(service, - SameService.class); - - Server server = new Server(port); - RpcHandler rpcHandler = new RpcHandler(jsonServer, sameState); - server.setHandler(rpcHandler); - - try { - server.start(); - } catch (Exception e) { - System.out.println("Could not start jetty server."); - e.printStackTrace(); - } - - while (sameState.getUrl() == null) { - HttpUtil.sendHttpRequest(remoteAddr + "ping?port=" + port); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // Ignore interrupt in wait loop. - } - } - - SameService remoteService = connections.getConnection(remoteAddr); - remoteService.notifyNetwork("NoNetwork"); - remoteService.participateNetwork("FirstNetwork", - sameState.getClientId(), sameState.getUrl()); - - try { - server.join(); - } catch (InterruptedException e) { - System.out.println("Interrupt"); - } - - } -} |