public void logMutations(DataOutput out) { Preconditions.checkArgument(hasMutations()); VariableLong.writePositive(out,writtenValues.size()); for (Map.Entry<String,Object> entry : writtenValues.entrySet()) { out.writeObjectNotNull(entry.getKey()); out.writeClassAndObject(entry.getValue()); } }
public void commit() { for (Map.Entry<String,Object> entry : writtenValues.entrySet()) { if (config instanceof ConcurrentWriteConfiguration && readValues.containsKey(entry.getKey())) { ((ConcurrentWriteConfiguration)config) .set(entry.getKey(), entry.getValue(), readValues.get(entry.getKey())); } else { config.set(entry.getKey(),entry.getValue()); } } rollback(); }
@Override public synchronized void commit() { ensureOpen(); //Commit config changes if (transactionalConfig.hasMutations()) { DataOutput out = graph.getDataSerializer().getDataOutput(128); out.writeObjectNotNull(MgmtLogType.CONFIG_MUTATION); transactionalConfig.logMutations(out); sysLog.add(out.getStaticBuffer()); } transactionalConfig.commit(); //Commit underlying transaction transaction.commit(); //Communicate schema changes if (!updatedTypes.isEmpty() || evictGraphFromCache) { managementLogger.sendCacheEviction(updatedTypes, evictGraphFromCache, updatedTypeTriggers, getOpenInstancesInternal()); for (JanusGraphSchemaVertex schemaVertex : updatedTypes) { schemaCache.expireSchemaElement(schemaVertex.longId()); } } if (graphShutdownRequired) graph.close(); close(); }
public ManagementSystem(StandardJanusGraph graph, KCVSConfiguration config, Log sysLog, ManagementLogger managementLogger, SchemaCache schemaCache) { Preconditions.checkArgument(config != null && graph != null && sysLog != null && managementLogger != null); this.graph = graph; this.sysLog = sysLog; this.managementLogger = managementLogger; this.schemaCache = schemaCache; this.transactionalConfig = new TransactionalConfiguration(config); this.modifyConfig = new ModifiableConfiguration(ROOT_NS, transactionalConfig, BasicConfiguration.Restriction.GLOBAL); this.userConfig = new UserModifiableConfiguration(modifyConfig, configVerifier); this.updatedTypes = new HashSet<>(); this.evictGraphFromCache = false; this.updatedTypeTriggers = new ArrayList<>(); this.graphShutdownRequired = false; this.transaction = (StandardJanusGraphTx) graph.buildTransaction().disableBatchLoading().start(); this.txStartTime = graph.getConfiguration().getTimestampProvider().getTime(); this.isOpen = true; }
@Override public synchronized void rollback() { ensureOpen(); transactionalConfig.rollback(); transaction.rollback(); close(); }