Exemplo n.º 1
0
  private void saveInternal() {
    final ODatabaseDocument db = getDatabase();

    if (db.getTransaction().isActive()) {
      reload(null, true);
      throw new OSchemaException(
          "Cannot change the schema while a transaction is active. Schema changes are not transactional");
    }

    setDirty();

    OScenarioThreadLocal.executeAsDistributed(
        new Callable<Object>() {
          @Override
          public Object call() {
            try {
              toStream();
              document.save(OMetadataDefault.CLUSTER_INTERNAL_NAME);
              if (fullCheckpointOnChange) getDatabase().getStorage().synch();
            } catch (OConcurrentModificationException e) {
              reload(null, true);
              throw e;
            }
            return null;
          }
        });

    snapshot = new OImmutableSchema(this);
  }