Closing a “local” OrientDB when using connection p

2020-03-04 02:46发布

So I basically do this.

OObjectDatabaseTx result = OObjectDatabasePool.global().acquire( "local:orientdb", "admin", "admin");
//dostuff
result.close;

The problem is that when I redeploy my webapp (without restarting the Java EE container) I get the folling error:

com.orientechnologies.orient.core.exception.OStorageException: Cannot open local storage 'orientdb' with mode=rw

which I interpret to mean "Tomcat still has a filelock from the last app".

So my question is how do I cleanly exit in this scenario? I've tried:

OObjectDatabasePool.global().close()

and

new OObjectDatabaseTx("local:orientdb").close()

but neither seem to work. Any ideas? The documentation isn't exactly clear on this issue.

1条回答
太酷不给撩
2楼-- · 2020-03-04 03:06

Set the property "storage.keepOpen" to false:

java ... -Dstorage.keepOpen=false ...

or via Java code:

OGlobalConfiguration.STORAGE_KEEP_OPEN.setValue( false );
查看更多
登录 后发表回答