From 64139964ffb1ac9fb21d936b3d4865fc9a616b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Wed, 11 Apr 2012 14:55:47 +0200 Subject: Rename NewRpcChannel => RpcChannel. --- .../com/orbekk/same/ConnectionManagerImpl.java | 23 +++++++++++----------- .../main/java/com/orbekk/same/DirectoryApp.java | 6 +++--- .../com/orbekk/same/benchmark/ClientBenchmark.java | 6 +++--- 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 connectionCache = new HashMap(); - private ConcurrentMap> channels = - new ConcurrentHashMap>(); + private ConcurrentMap> channels = + new ConcurrentHashMap>(); private Logger logger = LoggerFactory.getLogger(getClass()); @@ -64,16 +63,16 @@ public class ConnectionManagerImpl implements ConnectionManager { return service; } - private NewRpcChannel getChannel(String location) { - Future channel = channels.get(location); + private RpcChannel getChannel(String location) { + Future channel = channels.get(location); if (channel == null) { final String hostname = location.split(":")[0]; final int port = Integer.valueOf(location.split(":")[1]); - Callable channelFactory = - new Callable() { - @Override public NewRpcChannel call() { + Callable channelFactory = + new Callable() { + @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 task = - new FutureTask(channelFactory); + FutureTask task = + new FutureTask(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); -- cgit v1.2.3