|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.scale7.cassandra.pelops.spring.CommonsBackedPoolFactoryBean
public class CommonsBackedPoolFactoryBean
Used to initialize a Pelops pool that honors Spring's context life cycle. Using this class ensures that the dependency graph that's managed by Spring won't attempt to use Pelops when it isn't available.
To use it add the following to your context file:<bean id="pelopsPool" class="org.scale7.cassandra.pelops.spring.CommonsBackedPoolFactoryBean"> <property name="cluster"> <bean class="org.scale7.cassandra.pelops.Cluster"> <constructor-arg index="0" type="java.lang.String" value="${digitalpigeon.cassandra.host}" /> <constructor-arg index="1" type="int" value="${digitalpigeon.cassandra.port}" /> </bean> </property> <property name="keyspace" value="keyspace" /> </bean>
NOTE: If you intend to use this class you'll need to bypass the static convenience methods on
Pelops
.
Inject the instance of IThriftPool
created by this factory bean into your
application code and use it's method directly.
private IThriftPool pool;
public void doStuff() { Selector selector = pool.createSelector(); ... }
Constructor Summary | |
---|---|
CommonsBackedPoolFactoryBean()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
Initializes the Pelops pool. |
void |
destroy()
Shuts down the Pelops pool. |
Cluster |
getCluster()
|
CommonsBackedPool.IConnectionValidator |
getConnectionValidator()
|
String |
getKeyspace()
|
CommonsBackedPool.INodeSelectionStrategy |
getNodeSelectionStrategy()
|
CommonsBackedPool.INodeSuspensionStrategy |
getNodeSuspensionStrategy()
|
IThriftPool |
getObject()
. |
Class<?> |
getObjectType()
. |
OperandPolicy |
getOperandPolicy()
|
CommonsBackedPool.Policy |
getPolicy()
|
boolean |
isSingleton()
. |
void |
setCluster(Cluster cluster)
|
void |
setConnectionValidator(CommonsBackedPool.IConnectionValidator connectionValidator)
|
void |
setKeyspace(String keyspace)
|
void |
setNodeSelectionStrategy(CommonsBackedPool.INodeSelectionStrategy nodeSelectionStrategy)
|
void |
setNodeSuspensionStrategy(CommonsBackedPool.INodeSuspensionStrategy nodeSuspensionStrategy)
|
void |
setOperandPolicy(OperandPolicy operandPolicy)
|
void |
setPolicy(CommonsBackedPool.Policy policy)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CommonsBackedPoolFactoryBean()
Method Detail |
---|
public IThriftPool getObject() throws Exception
getObject
in interface org.springframework.beans.factory.FactoryBean<IThriftPool>
Exception
public Class<?> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<IThriftPool>
IThriftPool
public boolean isSingleton()
isSingleton
in interface org.springframework.beans.factory.FactoryBean<IThriftPool>
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
- if an error occurspublic void destroy() throws Exception
destroy
in interface org.springframework.beans.factory.DisposableBean
Exception
- if an error occursorg.scale7.cassandra.pelops.pool.IThriftPool#shutdown()}
public Cluster getCluster()
public void setCluster(Cluster cluster)
public String getKeyspace()
public void setKeyspace(String keyspace)
public CommonsBackedPool.Policy getPolicy()
public void setPolicy(CommonsBackedPool.Policy policy)
public OperandPolicy getOperandPolicy()
public void setOperandPolicy(OperandPolicy operandPolicy)
public CommonsBackedPool.INodeSelectionStrategy getNodeSelectionStrategy()
public void setNodeSelectionStrategy(CommonsBackedPool.INodeSelectionStrategy nodeSelectionStrategy)
public CommonsBackedPool.INodeSuspensionStrategy getNodeSuspensionStrategy()
public void setNodeSuspensionStrategy(CommonsBackedPool.INodeSuspensionStrategy nodeSuspensionStrategy)
public CommonsBackedPool.IConnectionValidator getConnectionValidator()
public void setConnectionValidator(CommonsBackedPool.IConnectionValidator connectionValidator)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |