mgmtLogger = new ManagementLogger(this, mgmtLog, schemaCache, this.times); mgmtLog.registerReader(ReadMarker.fromNow(), mgmtLogger);
@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()) { mgmtLogger.sendCacheEviction(updatedTypes, updatedTypeTriggers, getOpenInstancesInternal()); for (TitanSchemaVertex schemaVertex : updatedTypes) { schemaCache.expireSchemaElement(schemaVertex.longId()); } } if (graphShutdownRequired) graph.close(); close(); }
@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()) { mgmtLogger.sendCacheEviction(updatedTypes, updatedTypeTriggers, getOpenInstancesInternal()); for (TitanSchemaVertex schemaVertex : updatedTypes) { schemaCache.expireSchemaElement(schemaVertex.longId()); } } if (graphShutdownRequired) graph.close(); close(); }
mgmtLogger = new ManagementLogger(this, mgmtLog, schemaCache, this.times); mgmtLog.registerReader(ReadMarker.fromNow(), mgmtLogger);
@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()) { mgmtLogger.sendCacheEviction(updatedTypes,updatedTypeTriggers,getOpenInstancesInternal()); for (TitanSchemaVertex schemaVertex : updatedTypes) { schemaCache.expireSchemaElement(schemaVertex.getLongId()); } } if (graphShutdownRequired) graph.shutdown(); close(); }
public StandardTitanGraph(GraphDatabaseConfiguration configuration) { this.config = configuration; this.backend = configuration.getBackend(); this.idAssigner = config.getIDAssigner(backend); this.idManager = idAssigner.getIDManager(); this.serializer = config.getSerializer(); StoreFeatures storeFeatures = backend.getStoreFeatures(); this.indexSerializer = new IndexSerializer(configuration.getConfiguration(), this.serializer, this.backend.getIndexInformation(),storeFeatures.isDistributed() && storeFeatures.isKeyOrdered()); this.edgeSerializer = new EdgeSerializer(this.serializer); this.vertexExistenceQuery = edgeSerializer.getQuery(BaseKey.VertexExists, Direction.OUT, new EdgeSerializer.TypedInterval[0]).setLimit(1); this.queryCache = new RelationQueryCache(this.edgeSerializer); this.schemaCache = configuration.getTypeCache(typeCacheRetrieval); this.times = configuration.getTimestampProvider(); isOpen = true; txCounter = new AtomicLong(0); openTransactions = Collections.newSetFromMap(new ConcurrentHashMap<StandardTitanTx, Boolean>(100,0.75f,1)); //Register instance and ensure uniqueness String uniqueInstanceId = configuration.getUniqueGraphId(); ModifiableConfiguration globalConfig = GraphDatabaseConfiguration.getGlobalSystemConfig(backend); if (globalConfig.has(REGISTRATION_TIME,uniqueInstanceId)) { throw new TitanException(String.format("A Titan graph with the same instance id [%s] is already open. Might required forced shutdown.",uniqueInstanceId)); } globalConfig.set(REGISTRATION_TIME, times.getTime(), uniqueInstanceId); Log mgmtLog = backend.getSystemMgmtLog(); mgmtLogger = new ManagementLogger(this,mgmtLog,schemaCache,this.times); mgmtLog.registerReader(ReadMarker.fromNow(),mgmtLogger); shutdownHook = new ShutdownThread(this); Runtime.getRuntime().addShutdownHook(shutdownHook); }