distributed/src/main/java/com/orientechnologies/orient/server/distributed/impl/ODistributedAbstractPlugin.java
@Override
  public void onOpen(final ODatabaseInternal iDatabase) {
    if (!isRelatedToLocalServer(iDatabase))
      return;

    if (isOffline() && status != NODE_STATUS.STARTING)
      return;

    final ODatabaseDocumentInternal currDb = ODatabaseRecordThreadLocal.instance().getIfDefined();
    try {
      final String dbName = iDatabase.getName();

      final ODistributedConfiguration cfg = getDatabaseConfiguration(dbName);
      if (cfg == null)
        return;

    } catch (HazelcastException e) {
      throw OException.wrapException(new OOfflineNodeException("Hazelcast instance is not available"), e);

    } catch (HazelcastInstanceNotActiveException e) {
      throw OException.wrapException(new OOfflineNodeException("Hazelcast instance is not available"), e);

    } finally {
      // RESTORE ORIGINAL DATABASE INSTANCE IN TL
      ODatabaseRecordThreadLocal.instance().set(currDb);
    }
  }
@Override
  public void onOpen(final ODatabaseInternal iDatabase) {
    if (!isRelatedToLocalServer(iDatabase))
      return;

    if (isOffline() && status != NODE_STATUS.STARTING)
      return;

    final ODatabaseDocumentInternal currDb = ODatabaseRecordThreadLocal.instance().getIfDefined();
    try {
      final String dbName = iDatabase.getName();

      final ODistributedConfiguration cfg = getDatabaseConfiguration(dbName);
      if (cfg == null)
        return;

    } catch (HazelcastException e) {
      throw OException.wrapException(new OOfflineNodeException("Hazelcast instance is not available"), e);

    } catch (HazelcastInstanceNotActiveException e) {
      throw OException.wrapException(new OOfflineNodeException("Hazelcast instance is not available"), e);

    } finally {
      // RESTORE ORIGINAL DATABASE INSTANCE IN TL
      ODatabaseRecordThreadLocal.instance().set(currDb);
    }
  }
@ Override public void onOpen ( final ODatabaseInternal iDatabase ) { if ( ! isRelatedToLocalServer ( iDatabase ) ) return ; if ( isOffline ( ) && status != NODE_STATUS . STARTING ) return ; final ODatabaseDocumentInternal currDb = ODatabaseRecordThreadLocal . instance ( ) . getIfDefined ( ) ; try { final String dbName = iDatabase . getName ( ) ; final ODistributedConfiguration cfg = getDatabaseConfiguration ( dbName ) ; if ( cfg == null ) return ; } catch ( HazelcastException e ) { throw OException . wrapException ( new OOfflineNodeException ( "Hazelcast instance is not available" ) , e ) ; } catch ( HazelcastInstanceNotActiveException e ) { throw OException . wrapException ( new OOfflineNodeException ( "Hazelcast instance is not available" ) , e ) ; } finally { // RESTORE ORIGINAL DATABASE INSTANCE IN TL ODatabaseRecordThreadLocal . instance ( ) . set ( currDb ) ; } }
Auto register myself as hook.
Auto register myself as hook .