当运行多个实例时,OrientDB返回空顶点

问题描述 投票:-1回答:2

测试应该是非常自我解释的,但无论如何,正在寻找这个奇怪的错误,并在经过数十万次不同的测试之后确定了这一点。

服务器必须处理来自不同领域(例如来自不同域)的数据,并且最好将它们存储在完全不同的数据库中。

出于某种原因,当早先在其他某个位置打开另一个OrientGraph时,OrientDB返回空顶点。

希望这是StackOverflow算法的无意义文本,这里是代码:

@Test
public void testLowLevelMultipleRealms() throws Exception {

    String location=("plocal:"+StorageHandler.getBase("test")+"db/orient/");
    String location2=("plocal:"+StorageHandler.getBase("local")+"db/orient/");

    boolean importantVariable=true;
    if(importantVariable){
        //fails
        OrientGraph graph =  new OrientGraphFactory(location).setupPool(1,10).getTx();
        graph.shutdown();

        //also fails
        //OrientGraph graph =  new OrientGraphFactory(location).setupPool(1,10).getTx();

        //also fails
        //new OrientGraphFactory(location).setupPool(1,10);

        //doesn't fail
        //new OrientGraphFactory(location);

        //doesn't fail
        //OrientGraph graph =  new OrientGraphFactory(location2).setupPool(1,10).getTx();


    }
    OrientGraph graph =  new OrientGraphFactory(location2).setupPool(1,10).getTx();

    Vertex v = graph.getVertex("#9:1");
    assertNotNull(v);//passes
    assertNotNull(v.getProperty("title"));//fails iff. importantVariable==true


}
java database orientdb
2个回答
0
投票

事实证明,OrientDB只检查路径的最后一个文件夹,以检查db:s是否相同。由于两条路径都以db / orient结束,因此它搞得一团糟。添加冗余但唯一的子文件夹就可以了。


0
投票

您也可以使用$而不是/,它会起作用。

© www.soinside.com 2019 - 2024. All rights reserved.