diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-04-11 14:55:47 +0200 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-04-11 14:55:47 +0200 |
commit | 64139964ffb1ac9fb21d936b3d4865fc9a616b40 (patch) | |
tree | c78d8d72684661c1cf94ae51e0c82727025b33fd /same/src/main/java/com/orbekk | |
parent | 172beb67bf3f27fe1861a94cbcaad1e4d7a2390d (diff) |
Rename NewRpcChannel => RpcChannel.
Diffstat (limited to 'same/src/main/java/com/orbekk')
3 files changed, 17 insertions, 18 deletions
diff --git a/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java b/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java index a57bbdf..9aa4f81 100644 --- a/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java +++ b/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java @@ -16,19 +16,18 @@ import java.util.concurrent.FutureTask; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.protobuf.RpcChannel; import com.googlecode.jsonrpc4j.ProxyUtil; import com.orbekk.net.MyJsonRpcHttpClient; import com.orbekk.paxos.PaxosService; -import com.orbekk.protobuf.NewRpcChannel; +import com.orbekk.protobuf.RpcChannel; public class ConnectionManagerImpl implements ConnectionManager { private int connectionTimeout; private int readTimeout; private Map<String, MyJsonRpcHttpClient> connectionCache = new HashMap<String, MyJsonRpcHttpClient>(); - private ConcurrentMap<String, Future<NewRpcChannel>> channels = - new ConcurrentHashMap<String, Future<NewRpcChannel>>(); + private ConcurrentMap<String, Future<RpcChannel>> channels = + new ConcurrentHashMap<String, Future<RpcChannel>>(); private Logger logger = LoggerFactory.getLogger(getClass()); @@ -64,16 +63,16 @@ public class ConnectionManagerImpl implements ConnectionManager { return service; } - private NewRpcChannel getChannel(String location) { - Future<NewRpcChannel> channel = channels.get(location); + private RpcChannel getChannel(String location) { + Future<RpcChannel> channel = channels.get(location); if (channel == null) { final String hostname = location.split(":")[0]; final int port = Integer.valueOf(location.split(":")[1]); - Callable<NewRpcChannel> channelFactory = - new Callable<NewRpcChannel>() { - @Override public NewRpcChannel call() { + Callable<RpcChannel> channelFactory = + new Callable<RpcChannel>() { + @Override public RpcChannel call() { try { - return NewRpcChannel.create(hostname, port); + return RpcChannel.create(hostname, port); } catch (UnknownHostException e) { logger.error("Could not connect: ", e); return null; @@ -83,8 +82,8 @@ public class ConnectionManagerImpl implements ConnectionManager { } } }; - FutureTask<NewRpcChannel> task = - new FutureTask<NewRpcChannel>(channelFactory); + FutureTask<RpcChannel> task = + new FutureTask<RpcChannel>(channelFactory); channel = channels.putIfAbsent(location, task); if (channel == null) { task.run(); diff --git a/same/src/main/java/com/orbekk/same/DirectoryApp.java b/same/src/main/java/com/orbekk/same/DirectoryApp.java index 54636bc..08c3cc5 100644 --- a/same/src/main/java/com/orbekk/same/DirectoryApp.java +++ b/same/src/main/java/com/orbekk/same/DirectoryApp.java @@ -8,7 +8,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.protobuf.RpcCallback; -import com.orbekk.protobuf.NewRpcChannel; +import com.orbekk.protobuf.RpcChannel; import com.orbekk.protobuf.Rpc; import com.orbekk.protobuf.RpcChannel; import com.orbekk.same.Services.Directory; @@ -68,9 +68,9 @@ public class DirectoryApp { public void run() throws InterruptedException { String host = args[0]; int port = Integer.valueOf(args[1]); - NewRpcChannel channel = null; + RpcChannel channel = null; try { - channel = NewRpcChannel.create(host, port); + channel = RpcChannel.create(host, port); } catch (UnknownHostException e1) { e1.printStackTrace(); System.exit(1); diff --git a/same/src/main/java/com/orbekk/same/benchmark/ClientBenchmark.java b/same/src/main/java/com/orbekk/same/benchmark/ClientBenchmark.java index 6108630..a2fc663 100644 --- a/same/src/main/java/com/orbekk/same/benchmark/ClientBenchmark.java +++ b/same/src/main/java/com/orbekk/same/benchmark/ClientBenchmark.java @@ -5,7 +5,7 @@ import java.net.UnknownHostException; import java.util.concurrent.CountDownLatch; import com.google.protobuf.RpcCallback; -import com.orbekk.protobuf.NewRpcChannel; +import com.orbekk.protobuf.RpcChannel; import com.orbekk.protobuf.Rpc; import com.orbekk.protobuf.RpcChannel; import com.orbekk.same.benchmark.Example.Data; @@ -17,9 +17,9 @@ public class ClientBenchmark { public static void benchmark(String host, int port, int warmupIterations, int iterations) throws InterruptedException { - NewRpcChannel channel = null; + RpcChannel channel = null; try { - channel = NewRpcChannel.create(host, port); + channel = RpcChannel.create(host, port); Example.Service service = Example.Service.newStub(channel); ClientBenchmark benchmark = new ClientBenchmark( service, warmupIterations, iterations); |