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 {@link org.scale7.cassandra.pelops.Pelops}.
Inject the instance of {@link org.scale7.cassandra.pelops.pool.IThriftPool} created by this factory bean into yourapplication code and use it's method directly.
For example:
private IThriftPool pool;
public void doStuff() { Selector selector = pool.createSelector(); ... }
Note: the use of the class required the *optional* spring dependency.