本文整理了Java中org.janusgraph.core.JanusGraph.close()
方法的一些代码示例,展示了JanusGraph.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JanusGraph.close()
方法的具体详情如下:
包路径:org.janusgraph.core.JanusGraph
类名称:JanusGraph
方法名:close
[英]Closes the graph database.
Closing the graph database causes a disconnect and possible closing of the underlying storage backend and a release of all occupied resources by this graph database. Closing a graph database requires that all open thread-independent transactions have been closed - otherwise they will be left abandoned.
[中]关闭图形数据库。
关闭图形数据库会导致断开连接并可能关闭底层存储后端,并释放此图形数据库占用的所有资源。关闭图形数据库需要关闭所有打开的独立于线程的事务,否则它们将被放弃。
代码示例来源:origin: JanusGraph/janusgraph
/**
* Calls {@link JanusGraphFactory#open(String)}, passing the JanusGraph configuration file path
* which must be the sole element in the {@code args} array, then calls
* {@link #load(org.janusgraph.core.JanusGraph)} on the opened graph,
* then calls {@link org.janusgraph.core.JanusGraph#close()}
* 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(org.janusgraph.core.JanusGraph)}) when calling from
* an enclosing application.
*
* @param args a singleton array containing a path to a JanusGraph config properties file
*/
public static void main(String args[]) {
if (null == args || 1 != args.length) {
System.err.println("Usage: GraphOfTheGodsFactory <janusgraph-config-file>");
System.exit(1);
}
JanusGraph g = JanusGraphFactory.open(args[0]);
load(g);
g.close();
}
}
代码示例来源:origin: JanusGraph/janusgraph
/**
* Drop graph database, deleting all data in storage and indexing backends. Graph can be open or closed (will be
* closed as part of the drop operation). The graph is also removed from the {@link JanusGraphManager}
* graph reference tracker, if there.
*
* <p><b>WARNING: This is an irreversible operation that will delete all graph and index data.</b></p>
* @param graph JanusGraph graph database. Can be open or closed.
* @throws BackendException If an error occurs during deletion
*/
public static void drop(JanusGraph graph) throws BackendException {
Preconditions.checkNotNull(graph);
Preconditions.checkArgument(graph instanceof StandardJanusGraph,"Invalid graph instance detected: %s",graph.getClass());
final StandardJanusGraph g = (StandardJanusGraph) graph;
final JanusGraphManager jgm = JanusGraphManagerUtility.getInstance();
if (jgm != null) {
jgm.removeGraph(g.getGraphName());
}
if (graph.isOpen()) {
graph.close();
}
final GraphDatabaseConfiguration config = g.getConfiguration();
final Backend backend = config.getBackend();
try {
backend.clearStorage();
} finally {
IOUtils.closeQuietly(backend);
}
}
代码示例来源:origin: JanusGraph/janusgraph
g2.close();
代码示例来源:origin: Netflix/ndbench
@Override
public void shutdown() throws Exception {
graph.close();
logger.info("JanusGraph DB shutdown");
}
代码示例来源:origin: apache/atlas
@Override
public void shutdown() {
getGraph().close();
}
代码示例来源:origin: apache/atlas
public static void unload() {
synchronized (AtlasJanusGraphDatabase.class) {
if (graphInstance == null) {
return;
}
graphInstance.tx().commit();
graphInstance.close();
graphInstance = null;
}
}
代码示例来源:origin: IBM/janusgraph-utils
public static void main(String[] args) {
if (null == args || args.length < 2) {
System.err.println("Usage: SchemaLoader <janusgraph-config-file> <schema-file>");
System.exit(1);
}
String configFile = args[0];
String schemaFile = args[1];
// use custom or default config file to get JanusGraph
JanusGraph g = JanusGraphFactory.open(configFile);
try {
new SchemaLoader().loadSchema(g, schemaFile);
} catch (Exception e) {
System.out.println("Failed to import schema due to " + e.getMessage());
} finally {
g.close();
}
}
代码示例来源:origin: org.jboss.windup.graph/windup-graph-impl
this.graph.close();
代码示例来源:origin: apache/atlas
@Override
public void cleanup() {
JanusGraph g = getGraphInstance();
try {
if(g != null) {
g.close();
}
} catch (Throwable t) {
LOG.warn("Could not close test JanusGraph", t);
t.printStackTrace();
}
try {
if(g != null) {
JanusGraphFactory.drop(g);
}
} catch (Throwable t) {
LOG.warn("Could not clear test JanusGraph", t);
t.printStackTrace();
}
try {
LocalSolrRunner.stop();
} catch (Throwable t) {
LOG.warn("Could not stop local solr server", t);
}
}
代码示例来源:origin: windup/windup
this.graph.close();
代码示例来源:origin: apache/atlas
@Override
public void clear() {
JanusGraph graph = getGraph();
if (graph.isOpen()) {
// only a shut down graph can be cleared
graph.close();
}
try {
JanusGraphFactory.drop(graph);
} catch (BackendException ignoreEx) {
}
}
代码示例来源:origin: marcelocf/janusgraph_tutorial
/**
* Commit the current transaction and close the graph.
*/
private void close(){
// we need to commit the Management changes or else they are not applied.
mgt.commit();
graph.tx().commit();
graph.close();
}
代码示例来源:origin: IBM/janusgraph-utils
public static void main(String args[]) throws Exception {
if (null == args || args.length < 4) {
System.err.println(
"Usage: BatchImport <janusgraph-config-file> <data-files-directory> <schema.json> <data-mapping.json> [skipSchema]");
System.exit(1);
}
JanusGraph graph = JanusGraphFactory.open(args[0]);
if (!(args.length > 4 && args[4].equals("skipSchema")))
new SchemaLoader().loadSchema(graph, args[2]);
new DataLoader(graph).loadVertex(args[1], args[3]);
new DataLoader(graph).loadEdges(args[1], args[3]);
graph.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!