[
https://issues.apache.org/jira/browse/STORM-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13869352#comment-13869352
]
Panfeng Yuan commented on STORM-51:
-----------------------------------
How to use it:
1) First create a DRPCClientPool:
final String drpcServers = "host1:port1,host2:port2,host3:port3";
final int maxSize = 10;
DRPCClientPool pool = new DRPCClientPool(drpcServers, maxSize);
2) Get DRPCClientIface (the interface of DRPCClient), make rpc call, and put it
back:
DRPCClientIface client = pool.getClient();
// Make drpc calls to DRPC server (eg. ReachTopology in storm-starter)
try {
String result = client.execute("reach", "foo.com/blog/1");
} catch (DRPCExecutionException e) {
e.printStackTrace();
} catch (TException e) {
e.printStackTrace();
} finally {
//Put client back to the pool
client.close();
}
......
3) At last, close the pool:
try {
pool.close();
} catch (IOException e) {
e.printStackTrace();
}
> DRPC client pool
> ----------------
>
> Key: STORM-51
> URL: https://issues.apache.org/jira/browse/STORM-51
> Project: Apache Storm (Incubating)
> Issue Type: New Feature
> Reporter: James Xu
> Attachments: STORM-51.patch
>
>
> DRPC clients should really be working via a pool to manage connection
> resources and load against the DRPC server. Opening this ticket to track this
> PR -https://github.com/nathanmarz/storm/pull/584
> There's a couple of other issues that could be helped along with a pool, for
> example, https://github.com/nathanmarz/storm/pull/430, or async requests as
> per https://github.com/nathanmarz/storm/pull/62
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)