May anyone use the orientdb with java so that it closes the used connections and avoids the error "Reached maximum number of concurrent connections" ?
A simple test that I do. I'm using java8 and orientdb 2.2.14 with remote. Config sets don't work.
val poolFactory = new OPartitionedDatabasePoolFactory()
poolFactory.setMaxPoolSize(40)
val pool = poolFactory.get("remote:db.adimplere.com.br/adimplere", "admin", "ab12HTT")
val conn = pool.acquire()
try {
val query = StringBuilder.newBuilder
query.append("SELECT @this.tojson(\"fetchPlan:*:-1\") AS itens FROM Parceiro limit 1000;")
//connection.query(new OSQLSynchQuery[ODocument]("SELECT * FROM Cliente WHERE cpfCnpj=?").setFetchPlan("*:-1"))
val res = conn.query[java.util.List[ODocument]](new OSQLSynchQuery[ODocument](query.toString)).asScala.toList
val result = {
if (res.isEmpty) {
None
} else {
Some(res(0).field("itens"))
}
}
result
} finally {
conn.close()
pool.close()
poolFactory.close()
}