File tree Expand file tree Collapse file tree 1 file changed +21
-4
lines changed
hugegraph-server/hugegraph-test/src/main/java/org/apache/hugegraph/core Expand file tree Collapse file tree 1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change 2626import org .apache .hugegraph .testutil .Utils ;
2727import org .apache .hugegraph .util .Log ;
2828import org .junit .AfterClass ;
29- import org .junit .Assert ;
3029import org .junit .BeforeClass ;
3130import org .junit .runner .RunWith ;
3231import org .junit .runners .Suite ;
5251public class CoreTestSuite {
5352
5453 private static boolean registered = false ;
55- private static HugeGraph graph = null ;
54+ private static volatile HugeGraph graph = null ;
5655
5756 public static HugeGraph graph () {
58- Assert .assertNotNull (graph );
59- //Assert.assertFalse(graph.closed());
57+ if (graph == null ) {
58+ synchronized (CoreTestSuite .class ) {
59+ if (graph == null ) {
60+ try {
61+ initEnv ();
62+ init ();
63+ } catch (Throwable e ) {
64+ LOG .error ("Failed to initialize HugeGraph instance" , e );
65+ graph = null ;
66+ throw new RuntimeException ("Failed to initialize HugeGraph instance" , e );
67+ }
68+ if (graph == null ) {
69+ String msg = "HugeGraph instance is null after initialization. " +
70+ "Please check Utils.open() configuration." ;
71+ LOG .error (msg );
72+ throw new IllegalStateException (msg );
73+ }
74+ }
75+ }
76+ }
6077 return graph ;
6178 }
6279
You can’t perform that action at this time.
0 commit comments