@Override public void close() { logger.info("Shutting down eXtended Objects for Titan on Cassandra..."); titanGraph.shutdown(); titanGraph = null; } }
@Override public void cleanup(final Reducer<LongWritable, FaunusVertex, NullWritable, FaunusVertex>.Context context) throws IOException, InterruptedException { this.graph.commit(); this.graph.shutdown(); } }
public static void unload() { synchronized (Titan0GraphDatabase.class) { if (graphInstance == null) { return; } graphInstance.commit(); //shutdown invalidates the graph instance graphInstance.shutdown(); graphInstance = null; } }
@Override public void shutdown() { getGraph().shutdown(); }
@Override public void shutdown() { if (titanGraph == null) { return; } try { titanGraph.shutdown(); } catch (IOError e) { // TODO Fix issue in shutting down titan-cassandra-embedded System.err.println("Failed to shutdown titan graph: " + e.getMessage()); } titanGraph = null; }
@Override public void cleanup() { try { getGraphInstance().shutdown(); } catch(Throwable t) { LOG.warn("Could not shutdown test TitanGraph", t); t.printStackTrace(); } try { TitanCleanup.clear(getGraphInstance()); } catch(Throwable t) { LOG.warn("Could not clear test TitanGraph", t); t.printStackTrace(); } }
public void cleanUp() throws BackendException { synchronized (openGraphs) { for (Map.Entry<String, TitanGraph> entry : openGraphs.entrySet()) { String uid = entry.getKey(); TitanGraph g = entry.getValue(); if (g.isOpen()) { log.warn("Detected possible graph[uid={}] leak in Blueprints GraphTest method {}, shutting down the leaked graph", uid, getMostRecentMethodName()); g.shutdown(); } extraCleanUp(uid); } openGraphs.clear(); } }
@Override public Graph generateGraph(String uid) { synchronized (openGraphs) { if (!openGraphs.containsKey(uid)) { beforeOpeningGraph(uid); } else if (openGraphs.get(uid).isOpen()) { log.warn("Detected possible graph[uid={}] leak in Blueprints GraphTest method {}, shutting down the leaked graph", uid, getMostRecentMethodName()); openGraphs.get(uid).shutdown(); } else { log.debug("Reopening previously-closed graph[uid={}]", uid); } } log.info("Opening graph with uid={}", uid); openGraphs.put(uid, openGraph(uid)); return openGraphs.get(uid); }
/** * Calls {@link TitanFactory#open(String)}, passing the Titan configuration file path * which must be the sole element in the {@code args} array, then calls * {@link #load(com.thinkaurelius.titan.core.TitanGraph)} on the opened graph, * then calls {@link com.thinkaurelius.titan.core.TitanGraph#shutdown()} * and returns. * <p> * This method may call {@link System#exit(int)} if it encounters an error, such as * failure to parse its arguments. Only use this method when executing main from * a command line. Use one of the other methods on this class ({@link #create(String)} * or {@link #load(com.thinkaurelius.titan.core.TitanGraph)}) when calling from * an enclosing application. * * @param args a singleton array containing a path to a Titan config properties file */ public static void main(String args[]) { if (null == args || 1 != args.length) { System.err.println("Usage: GraphOfTheGodsFactory <titan-config-file>"); System.exit(1); } TitanGraph g = TitanFactory.open(args[0]); load(g); g.shutdown(); } }
public static void main(String args[]) throws IOException { if (4 != args.length) { System.err.println("Usage: GraphGenerator titanproperties vertexcount edgecount outfile"); System.exit(1); } int i = 0; String c = args[i++]; int v = Integer.valueOf(args[i++]); int e = Integer.valueOf(args[i++]); String o = args[i++]; Schema s = new Schema.Builder(v, e).build(); TitanGraph graph = TitanFactory.open(c); new GraphGenerator(s).generateTypesAndData(graph); OutputStream out = new GZIPOutputStream(new FileOutputStream(o)); GraphGenerator.writeData(graph, out); out.close(); graph.shutdown(); System.exit(0); }
public static void main(String args[]) throws IOException { if (4 != args.length) { System.err.println("Usage: GraphGenerator titanproperties vertexcount edgecount outfile"); System.exit(1); } int i = 0; String c = args[i++]; int v = Integer.valueOf(args[i++]); int e = Integer.valueOf(args[i++]); String o = args[i++]; Schema s = new Schema.Builder(v, e).build(); TitanGraph graph = TitanFactory.open(c); new GraphGenerator(s).generateTypesAndData(graph); OutputStream out = new GZIPOutputStream(new FileOutputStream(o)); GraphGenerator.writeData(graph, out); out.close(); graph.shutdown(); System.exit(0); }
@Override public void clear() { TitanGraph graph = getGraph(); if (graph.isOpen()) { // only a shut down graph can be cleared graph.shutdown(); } TitanCleanup.clear(graph); }
@Override public void delete() { titanGraph = buildTitanGraph(type, dbStorageDirectory, config, false /* batchLoading */); try { titanGraph.shutdown(); } catch (IOError e) { // TODO Fix issue in shutting down titan-cassandra-embedded System.err.println("Failed to shutdown titan graph: " + e.getMessage()); } TitanCleanup.clear(titanGraph); try { titanGraph.shutdown(); } catch (IOError e) { // TODO Fix issue in shutting down titan-cassandra-embedded System.err.println("Failed to shutdown titan graph: " + e.getMessage()); } Utils.deleteRecursively(dbStorageDirectory); }
@Override public void shutdownMassiveGraph() { if (titanGraph == null) { return; } try { batchGraph.shutdown(); } catch (IOError e) { // TODO Fix issue in shutting down titan-cassandra-embedded System.err.println("Failed to shutdown batch graph: " + e.getMessage()); } try { titanGraph.shutdown(); } catch (IOError e) { // TODO Fix issue in shutting down titan-cassandra-embedded System.err.println("Failed to shutdown titan graph: " + e.getMessage()); } batchGraph = null; titanGraph = null; }
@Override public void testGraphQueryForEdges() { TitanGraph g = (TitanGraph) graphTest.generateGraph(); if (g.getType("weight") == null) { TitanKey weight = g.makeKey("weight").dataType(Double.class).single().make(); } g.shutdown(); super.testGraphQueryForEdges(); } }
@Override public void testGraphQueryForVertices() { TitanGraph g = (TitanGraph) graphTest.generateGraph(); if (g.getType("age") == null) { TitanKey age = g.makeKey("age").dataType(Integer.class).single().make(); } g.shutdown(); super.testGraphQueryForVertices(); }
@Override public void testGraphQueryForVertices() { TitanGraph g = (TitanGraph) graphTest.generateGraph(); if (g.getRelationType("age") == null) { TitanManagement mgmt = g.getManagementSystem(); mgmt.makePropertyKey("age").dataType(Integer.class).cardinality(Cardinality.SINGLE).make(); mgmt.commit(); } g.shutdown(); super.testGraphQueryForVertices(); }
@Override public void testGraphQueryForEdges() { TitanGraph g = (TitanGraph) graphTest.generateGraph(); if (g.getRelationType("weight") == null) { TitanManagement mgmt = g.getManagementSystem(); mgmt.makePropertyKey("weight").dataType(Double.class).cardinality(Cardinality.SINGLE).make(); mgmt.commit(); } g.shutdown(); super.testGraphQueryForEdges(); } }