Permalink
Browse files

Single shared riak client for all threads

  • Loading branch information...
1 parent 9804b26 commit 254dc682b49138f307aee3b4946bb560c50521fe @russelldb russelldb committed Aug 23, 2011
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/main/java/com/basho/riak/bench/ClientFactory.java
@@ -26,6 +26,15 @@
*
*/
public class ClientFactory {
+
+ private static final RawClient httpClient;
+
+ static {
+ RiakConfig conf = new RiakConfig(makeUrl("den-test-01.den.basho", 8098));
+ conf.setMaxConnections(500);
+ httpClient = new HTTPClientAdapter(new com.basho.riak.client.http.RiakClient(conf));
+ }
+
/**
* @param config
@@ -41,9 +50,7 @@ public static RawClient newClient(ClientConfig config) throws IOException {
client = new PBClientAdapter(new RiakClient(config.getHost(), config.getPort(), config.getBufferSizeKb()));
break;
case HTTP:
- RiakConfig conf = new RiakConfig(makeUrl(config.getHost(), config.getPort()));
- com.basho.riak.client.http.RiakClient del = new com.basho.riak.client.http.RiakClient(conf);
- client = new HTTPClientAdapter(del);
+ client = httpClient;
break;
default:
throw new RuntimeException("unknown transport " + transport);

0 comments on commit 254dc68

Please sign in to comment.