默认情况下Pelops will have 20 connections per node-
我正在考虑修改它,使之与40 connections per node相关。那我怎么才能在佩洛普斯做到这一点?目前,我正在创建这样的游泳池-
private void createPool() {
Pelops.addPool(getPoolName(), getCluster(), getKeyspace());
}
/**
* Gets the cluster information
*
* @return
*/
private Cluster getCluster() {
Config casconf = new Config(ModelConstants.CASSANDRA_PORT, true, 0);
Cluster cluster= new Cluster(nodes, casconf, ModelConstants.NODE_DISCOVERY);
return cluster;
}
/**
* Get the keyspace name
*
* @return
*/
public String getKeyspace() {
return keyspace;
}
/**
* Get the pool name
*
* @return
*/
public String getPoolName() {
return poolName;
}有人能提供一个这样的例子,以便我可以修改它以容纳每个节点的40个连接吗?谢谢你的帮助。
更新代码:-
CommonsBackedPool.Policy pt = new Policy();
pt.setMaxActivePerNode(40);
OperandPolicy op = new OperandPolicy();
Pelops.addPool(getPoolName(), getCluster(), getKeyspace(), pt, op);我不知道我是否做了正确的事?如果看起来对的话请告诉我。
发布于 2013-05-02 21:30:04
查看佩洛普斯的JavaDocs,您将使用另一个Pelops.addPool()方法,该方法允许您提供CommonsBackedPool.Policy的一个实例,这是对它的控制。
https://stackoverflow.com/questions/16347867
复制相似问题