first-time database initialization already-locked file #9984
-
Is there a way on an OrientDB server to create a database and initialize it with some classes and instances, the first time the server starts? I have a plugin installed with version 3.2.19 that needs certain things set up. It would be convenient to do this all in one place. I can create the DB (in /OrientDB/databases/) in the plugin in an OServerPlugin.startup override, but there's no listener hook inside which I can then open the created DB; it claims that a file is already locked, so it can't open OSystem. Even OServerLifecycleListener.onAfterActivate sees the conflict. The open() gets the exception: I haven't yet tried spinning off a thread. The stack backtraces look like this: |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 5 replies
-
A spun-off thread that runs after the server has become active has the same problem. |
Beta Was this translation helpful? Give feedback.
-
Hi, yes only one context at time can access the set of databases in a folder, the I hope this help. |
Beta Was this translation helpful? Give feedback.
-
I can create and initialize the DB as follows, but then when I try connecting in console.sh, it says the DB is locked: |
Beta Was this translation helpful? Give feedback.
-
The problem with an already-open DB was most likely that I wasn't using try-AutoCloseable for result sets during DB creation. I'm no longer prevented from opening embedded in console.sh . |
Beta Was this translation helpful? Give feedback.
The problem with an already-open DB was most likely that I wasn't using try-AutoCloseable for result sets during DB creation. I'm no longer prevented from opening embedded in console.sh .