Hi, I have a question about the operation of PoolFactory Interface.
I'm using this interface to create a ConnectionPool in a dynamic way. The code is this:
public void createConnectionPool() throws Exception
{
PoolFactory factory = PoolManager.createFactory();
int countLocatorFail = 0;
try
{
if (StringUtils.isNotBlank(locatorHost1))
{
factory.addLocator(locatorHost1, locatorPort1);
}
}
catch (Exception e)
{
countLocatorFail++;
}
try
{
if (StringUtils.isNotBlank(locatorHost2))
{
factory.addLocator(locatorHost2, locatorPort2);
}
}
catch (Exception e)
{
countLocatorFail++;
}
if (countLocatorFail == 2)
{
throw new Exception("No se pudo encontrar los Host: " + locatorHost1 + ", " + locatorHost2);
}
factory.setFreeConnectionTimeout(freeConnectionTimeout);
factory.setIdleTimeout(idleTimeout);
factory.setPingInterval(pingInterval);
factory.setReadTimeout(readTimeout);
factory.setRetryAttempts(retryAttempts);
factory.setSubscriptionRedundancy(subscriptionRedundancy);
factory.setSubscriptionMessageTrackingTimeout(subscriptionMessageTrackingTimeout);
factory.setSubscriptionEnabled(true);
this.connectionPool = factory.create(poolName);
}
The problem and doubt that i have, is i think that with this way my application was connected to a different locatorHost and a different server to (locatorHost1 and locatorHost2 ) that i configure.
I think that maybe try to connect to a server that share the same port, but for me this is a problem.
anyone know how works the poolFactory?