@Override public void save() { backend.save(); }
/** * Increments the operation counter, and commit the persistence back-end if the number of operation is equals to * {@code OPS_BETWEEN_COMMITS_DEFAULT}. */ private void incrementAndCommit() { opCount = (opCount + 1) % OPS_BETWEEN_COMMITS_DEFAULT; if (opCount == 0) { backend.save(); } }
@Override public void save(Map<?, ?> options) throws IOException { if (nonNull(this.options)) { // Check that the save options do not collide with previous load options for (Entry<?, ?> entry : options.entrySet()) { if (this.options.containsKey(entry.getKey()) && !Objects.equals(entry.getValue(), this.options.get(entry.getKey()))) { throw new InvalidOptionException(MessageFormat.format("key = {0}; value = {1}", entry.getKey().toString(), entry.getValue().toString())); } } } if (!isLoaded() || !isPersistent) { PersistenceBackend newBackend = PersistenceBackendFactoryRegistry.getFactoryProvider(uri.scheme()).createPersistentBackend(getFile(), options); PersistenceBackendFactoryRegistry.getFactoryProvider(uri.scheme()).copyBackend(backend, newBackend); this.backend = newBackend; this.store = PersistenceBackendFactoryRegistry.getFactoryProvider(uri.scheme()).createPersistentStore(this, backend, options); this.isLoaded = true; this.isPersistent = true; } backend.save(); NeoLogger.info("{0} saved: {1}", PersistentResource.class.getSimpleName(), uri); }
@Override public void processEndDocument() { long unlinkedNumber = unlinkedElementsMap.size(); if (unlinkedNumber > 0) { NeoLogger.warn("Some elements have not been linked ({0})", unlinkedNumber); for (String e : unlinkedElementsMap.asMap().keySet()) { NeoLogger.warn(" > " + e); } unlinkedElementsMap.clear(); } long conflictedId = conflictElementIdCache.estimatedSize(); if (conflictedId > 0) { NeoLogger.info("{0} key conflicts", conflictElementIdCache.estimatedSize()); conflictElementIdCache.invalidateAll(); } backend.save(); }