Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import org.apache.hugegraph.testutil.Utils;
import org.apache.hugegraph.util.Log;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
Expand All @@ -52,11 +51,29 @@
public class CoreTestSuite {

private static boolean registered = false;
private static HugeGraph graph = null;
private static volatile HugeGraph graph = null;

public static HugeGraph graph() {
Assert.assertNotNull(graph);
//Assert.assertFalse(graph.closed());
if (graph == null) {
synchronized (CoreTestSuite.class) {
if (graph == null) {
try {
initEnv();
init();
} catch (Throwable e) {
LOG.error("Failed to initialize HugeGraph instance", e);
graph = null;
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assignment graph = null is redundant here. At this point in the code flow, graph is guaranteed to be null because it's only assigned a value in the init() method at line 95. This redundant assignment has no effect and can be removed.

Copilot uses AI. Check for mistakes.
throw new RuntimeException("Failed to initialize HugeGraph instance", e);
}
if (graph == null) {
String msg = "HugeGraph instance is null after initialization. " +
"Please check Utils.open() configuration.";
LOG.error(msg);
throw new IllegalStateException(msg);
}
}
}
}
return graph;
}

Expand Down
Loading