the max_connections property is set to 0 (unlimited number of connections) but still the ems server keeps on spitting out this to tibemsd.log
[admin:somehost]: connect failed: reached maximum number of connections 0
how can this be possible?
Thanks!
On
To protect on the client side from overloading the server with connections, I wrote a simple commons pool2 class.
import com.tibco.tibjms.admin.TibjmsAdmin;
import com.tibco.tibjms.admin.TibjmsAdminException;
import org.apache.commons.pool2.PooledObject;
import org.apache.commons.pool2.PooledObjectFactory;
import org.apache.commons.pool2.impl.DefaultPooledObject;
public class TibcoAdminPoolableObjectFactory implements PooledObjectFactory<TibjmsAdmin>{
@Override
public PooledObject<TibjmsAdmin> makeObject() throws Exception {
TibjmsAdmin admin = new TibjmsAdmin("tcp://tibco:7222","USER","password");
return new DefaultPooledObject<>(admin);
}
@Override
public void destroyObject(PooledObject<TibjmsAdmin> po) throws Exception {
po.getObject().close();
}
@Override
public boolean validateObject(PooledObject<TibjmsAdmin> po) {
try {
po.getObject().getQueue("xyzabc");
} catch (TibjmsAdminException ex) {
System.out.println(ex.getMessage());
return false;
}
return true;
}
@Override
public void activateObject(PooledObject<TibjmsAdmin> po) throws Exception {}
@Override
public void passivateObject(PooledObject<TibjmsAdmin> po) throws Exception {}
}
GenericObjectPool<TibjmsAdmin> pool = new GenericObjectPool<>(new TibcoAdminPoolableObjectFactory());
TibjmsAdmin admin = pool.borrowObject();
QueueInfo infos[] = admin.getQueues("YOURQUEUE");
pool.returnObject(admin);//in a finally block
For anyone interested,
it appears that there is a limit of maximum 256 admin connections that can be open concurrently to the ems server. This limit is apparently not controlled by the max_connections property for some reason.
Here is a small example to verify this.