org.janusgraph.core.JanusGraph.isOpen()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.janusgraph.core.JanusGraph.isOpen()方法的一些代码示例,展示了JanusGraph.isOpen()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JanusGraph.isOpen()方法的具体详情如下:
包路径:org.janusgraph.core.JanusGraph
类名称:JanusGraph
方法名:isOpen

JanusGraph.isOpen介绍

[英]Checks whether the graph is open.
[中]检查图形是否打开。

代码示例

代码示例来源:origin: JanusGraph/janusgraph

public void setGraph(JanusGraph graph) {
  Preconditions.checkArgument(graph!=null && graph.isOpen(),"Need to provide open graph");
  this.graph = (StandardJanusGraph)graph;
  provided = true;
}

代码示例来源: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

private static void awaitIndexUpdate(JanusGraph g, String indexName, String relationTypeName, long time, TemporalUnit unit) {
  Preconditions.checkArgument(g!=null && g.isOpen(),"Need to provide valid, open graph instance");
  Preconditions.checkArgument(time>0 && unit!=null,"Need to provide valid time interval");
  Preconditions.checkArgument(StringUtils.isNotBlank(indexName),"Need to provide an index name");

代码示例来源:origin: JanusGraph/janusgraph

@Override
public void clear(Graph g, final Configuration configuration) throws Exception {
  if (null != g) {
    while (g instanceof WrappedGraph) g = ((WrappedGraph<? extends Graph>) g).getBaseGraph();
    JanusGraph graph = (JanusGraph) g;
    if (graph.isOpen()) {
      if (g.tx().isOpen()) g.tx().rollback();
      try {
        g.close();
      } catch (IOException | IllegalStateException e) {
        logger.warn("Titan graph may not have closed cleanly", e);
      }
    }
  }
  WriteConfiguration config = new CommonsConfiguration(configuration);
  BasicConfiguration readConfig = new BasicConfiguration(GraphDatabaseConfiguration.ROOT_NS, config,
    BasicConfiguration.Restriction.NONE);
  if (readConfig.has(GraphDatabaseConfiguration.STORAGE_BACKEND)) {
    JanusGraphBaseTest.clearGraph(config);
  }
}

代码示例来源:origin: Netflix/ndbench

protected String getConnectionInfo(JanusGraph graph) {
    String status = graph.isOpen() ? "opened" : "closed";
    return String.format("Backend: %s, Host: %s, Port: %s, Graph Status: %s",
        storageBackend,
        storageHost,
        storagePort,
        status);
  }
}

代码示例来源:origin: windup/windup

@Override
public void clear()
{
  if (this.graph == null)
    return;
  if (this.graph.isOpen())
    close();
  try
  {
    JanusGraphFactory.drop(this.graph);
  }
  catch (Exception e)
  {
    LOG.log(Level.WARNING, "Failed to delete graph due to: " + e.getMessage(), e);
  }
}

代码示例来源:origin: org.jboss.windup.graph/windup-graph-impl

@Override
public void clear()
{
  if (this.graph == null)
    return;
  if (this.graph.isOpen())
    close();
  try
  {
    JanusGraphFactory.drop(this.graph);
  }
  catch (Exception e)
  {
    LOG.log(Level.WARNING, "Failed to delete graph due to: " + e.getMessage(), e);
  }
}

代码示例来源: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: ai.grakn/janus-factory

@Override
public void openTransaction(GraknTxType txType){
  super.openTransaction(txType);
  if(getTinkerPopGraph().isOpen() && !getTinkerPopGraph().tx().isOpen()) getTinkerPopGraph().tx().open();
}

相关文章