I am using OrientGraphFactory to manage pool of connection
OrientGraphFactory graphFactory = new OrientGraphFactory(url,username,password).setupPool(DEFAULT_MIN_POOL_SIZE, maxPoolSize);
and i have a function which checks the active connection on thread and returns it
public OrientGraph openDatabase() {
OrientGraph db = (OrientGraph)OrientGraph.getActiveGraph();
if(db==null || db.isClosed())
{
db = graphFactory.getTx();
}
return db ;
}
in my functions do i have to close/shutdown connection after use or it will be shutdown after the thread is terminated.
This approach is incorrect because you use internal API.
More simple version db = graphFactory.getTx();
takes in account all check which you done above.