Esempio n. 1
0
  protected void writeRevision(InternalCDORevision revision, OMMonitor monitor) {
    Async async = null;
    monitor.begin(10);

    try {
      try {
        async = monitor.forkAsync();
        if (revision.isResourceNode()) {
          checkDuplicateResources(revision);
        }
      } finally {
        if (async != null) {
          async.stop();
        }
      }

      // TODO removal of previous version implies query, this should be optimized

      long start = System.currentTimeMillis();
      CDOID id = revision.getID();
      DB4OStore.removeRevision(getObjectContainer(), id);
      DB4ORevision primitiveRevision = DB4ORevision.getDB4ORevision(revision);
      writeObject(primitiveRevision, monitor);
      long end = System.currentTimeMillis();
      OM.LOG.debug("Writing revision " + id + " took: " + (end - start) + " milliseconds");
    } finally {
      monitor.done();
    }
  }
  @Override
  protected void indicating(CDODataInput in, OMMonitor monitor) throws IOException {
    try {
      monitor.begin();
      Async async = monitor.forkAsync();

      try {
        int viewID = in.readInt();
        CDOBranchPoint branchPoint = in.readCDOBranchPoint();

        int size = in.readInt();
        List<CDOID> invalidObjects = new ArrayList<CDOID>(size);
        for (int i = 0; i < size; i++) {
          CDOID id = in.readCDOID();
          invalidObjects.add(id);
        }

        InternalView view = getSession().getView(viewID);
        view.changeTarget(branchPoint, invalidObjects, allChangedObjects, allDetachedObjects);
      } finally {
        async.stop();
      }

    } finally {
      monitor.done();
    }
  }
Esempio n. 3
0
  protected void writeObject(Object object, OMMonitor monitor) {
    monitor.begin();
    Async async = monitor.forkAsync();

    try {
      getObjectContainer().store(object);
    } catch (Throwable t) {
      OM.LOG.error(t);
    } finally {
      async.stop();
      monitor.done();
    }
  }
Esempio n. 4
0
  @Override
  protected void doCommit(OMMonitor monitor) {
    monitor.begin();
    Async async = monitor.forkAsync();

    try {
      long start = System.currentTimeMillis();
      getObjectContainer().commit();
      long end = System.currentTimeMillis();
      OM.LOG.debug("Commit took -> " + (end - start) + " milliseconds");
    } catch (Exception e) {
      OM.LOG.error(e);
    } finally {
      async.stop();
      monitor.done();
    }
  }
Esempio n. 5
0
  public void createMapping(
      Connection connection, InternalCDOPackageUnit[] packageUnits, OMMonitor monitor) {
    Async async = null;
    monitor.begin();

    try {
      async = monitor.forkAsync();

      try {
        mapPackageUnits(packageUnits, connection, false);
      } finally {
        if (async != null) {
          async.stop();
        }
      }
    } finally {
      monitor.done();
    }
  }
Esempio n. 6
0
  public Set<CDOID> readChangeSet(
      IDBStoreAccessor accessor, OMMonitor monitor, CDOChangeSetSegment[] segments) {
    Set<CDOID> result = new HashSet<CDOID>();
    Collection<IClassMapping> classMappings = getClassMappings().values();

    monitor.begin(classMappings.size());

    try {
      for (IClassMapping mapping : classMappings) {
        Async async = monitor.forkAsync();

        try {
          Set<CDOID> ids = mapping.readChangeSet(accessor, segments);
          result.addAll(ids);
        } finally {
          async.stop();
        }
      }

      return result;
    } finally {
      monitor.done();
    }
  }