@@ -155,6 +155,7 @@ protected ODatabaseDocumentEmbedded newSessionInstance(
155155 embedded = new ODatabaseDocumentEmbedded (storage );
156156 embedded .init (config , sharedContext );
157157 } else {
158+ waitForPluginStartup ();
158159 embedded = new ODatabaseDocumentDistributed (storage , plugin , sharedContext );
159160 embedded .init (config , sharedContext );
160161 registerNewDatabaseIfNeeded (embedded , sharedContext );
@@ -170,6 +171,7 @@ protected ODatabaseDocumentEmbedded newCreateSessionInstance(
170171 embedded = new ODatabaseDocumentEmbedded (storage );
171172 embedded .internalCreate (config , getOrCreateSharedContext (storage ));
172173 } else {
174+ waitForPluginStartup ();
173175 embedded = new ODatabaseDocumentDistributed (storage , plugin , sharedContext );
174176 embedded .internalCreate (config , getOrCreateSharedContext (storage ));
175177 registerNewDatabaseIfNeeded (embedded , sharedContext );
@@ -184,6 +186,7 @@ protected ODatabaseDocumentEmbedded newPooledSessionInstance(
184186 embedded = new ODatabaseDocumentEmbeddedPooled (pool , storage );
185187 embedded .init (pool .getConfig (), getOrCreateSharedContext (storage ));
186188 } else {
189+ waitForPluginStartup ();
187190 embedded = new ODatabaseDocumentDistributedPooled (pool , storage , plugin , sharedContext );
188191 embedded .init (pool .getConfig (), getOrCreateSharedContext (storage ));
189192 registerNewDatabaseIfNeeded (embedded , sharedContext );
@@ -268,8 +271,21 @@ public ODatabaseDocumentInternal poolOpen(
268271 return session ;
269272 }
270273
274+ @ Override
275+ public void create (
276+ String name ,
277+ String user ,
278+ String password ,
279+ ODatabaseType type ,
280+ OrientDBConfig config ,
281+ ODatabaseTask <Void > createOps ) {
282+ waitForPluginStartup ();
283+ super .create (name , user , password , type , config , createOps );
284+ }
285+
271286 @ Override
272287 public void internalDrop (String name ) {
288+ waitForPluginStartup ();
273289 synchronized (this ) {
274290 checkOpen ();
275291 // This is a temporary fix for distributed drop that avoid scheduled view update to re-open
@@ -314,7 +330,8 @@ public void internalDrop(String name) {
314330
315331 @ Override
316332 public void drop (String name , String user , String password ) {
317- if (getPlugin () != null && getPlugin ().isEnabled ()) {
333+ if (isDistributedPluginEnabled ()) {
334+ waitForPluginStartup ();
318335 plugin .executeInDistributedDatabaseLock (
319336 name ,
320337 20000 ,
@@ -434,6 +451,7 @@ public ODistributedServerManager getDistributedManager() {
434451
435452 @ Override
436453 public boolean deltaSync (String dbName , InputStream backupStream , OrientDBConfig config ) {
454+ waitForPluginStartup ();
437455 if (new ONewDeltaSyncImporter ()
438456 .importDelta (server , dbName , backupStream , plugin .getLocalNodeName ())) {
439457 getDatabase (dbName ).setOnline ();
@@ -444,6 +462,7 @@ public boolean deltaSync(String dbName, InputStream backupStream, OrientDBConfig
444462 }
445463
446464 private void offlineOnShutdown () {
465+ waitForPluginStartup ();
447466 // SET ALL DATABASES TO NOT_AVAILABLE
448467 for (Entry <String , ODistributedDatabaseImpl > m : databases .entrySet ()) {
449468 if (OSystemDatabase .SYSTEM_DB_NAME .equals (m .getKey ())) continue ;
@@ -464,12 +483,14 @@ public ODistributedDatabaseImpl getDatabase(final String iDatabaseName) {
464483
465484 private ODistributedDatabaseImpl newDistributedDatabase (
466485 String key , ODatabaseDocumentInternal session ) {
486+ waitForPluginStartup ();
467487 ODistributedDatabaseImpl db = new ODistributedDatabaseImpl (this , plugin , key );
468488 db .initFirstOpen (session );
469489 return db ;
470490 }
471491
472492 public ODistributedDatabaseImpl unregisterDatabase (final String iDatabaseName ) {
493+ waitForPluginStartup ();
473494 try {
474495 plugin .setDatabaseStatus (plugin .getLocalNodeName (), iDatabaseName , DB_STATUS .OFFLINE );
475496 } catch (Exception t ) {
@@ -529,6 +550,7 @@ public ODistributedConfiguration getOrInitDistributedConfiguration(ODatabaseSess
529550 }
530551
531552 public ODistributedConfigurationManager getOrInitConfigurationManager (String database ) {
553+ waitForPluginStartup ();
532554 return configurations .computeIfAbsent (
533555 database ,
534556 (key ) -> {
0 commit comments