Skip to content
Closed
Show file tree
Hide file tree
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
9 changes: 2 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Before submitting the code, we need to do some preparation:
git config user.email "{email-address-of-github}" # like "jermy@apache.org"
```

5. Sign the HugeGraph CLA: [https://cla-assistant.io/hugegraph/hugegraph](https://cla-assistant.io/hugegraph/hugegraph)

Optional: You can use [GitHub desktop](https://desktop.github.com/) to greatly simplify the commit and update process.

## 2. Create an Issue on GitHub
Expand Down Expand Up @@ -108,13 +110,6 @@ Note that since GitHub requires submitting code through `username + token` (inst

Go to the web page of GitHub fork repo, there would be a chance to create a Pull Request after pushing to a new branch, just click button "Compare & pull request" to do it. Then edit the description for proposed changes, which can just be copied from the commit message.

Please sign the HugeGraph CLA when contributing code for the first time. You can sign the CLA by just posting a Pull Request Comment same as the below format:

`I have read the CLA Document and I hereby sign the CLA`

Note: please make sure the email address you used to submit the code is bound to the GitHub account. For how to bind the email address, please refer to https://github.com/settings/emails:
<img width="1280" alt="image" src="https://user-images.githubusercontent.com/9625821/163522445-2a50a72a-dea2-434f-9868-3a0d40d0d037.png">

## 5. Code review

Maintainers will start the code review after all the **automatic** checks are passed:
Expand Down
20 changes: 10 additions & 10 deletions hugegraph-core/src/main/java/com/baidu/hugegraph/HugeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class HugeFactory {

private static final Logger LOG = Log.logger(HugeGraph.class);

private static final Thread shutdownHook = new Thread(() -> {
private static final Thread SHUTDOWN_HOOK = new Thread(() -> {
LOG.info("HugeGraph is shutting down");
HugeFactory.shutdown(30L);
}, "hugegraph-shutdown");
Expand All @@ -53,14 +53,14 @@ public class HugeFactory {
SerialEnum.registerInternalEnums();
HugeGraph.registerTraversalStrategies(StandardHugeGraph.class);

Runtime.getRuntime().addShutdownHook(shutdownHook);
Runtime.getRuntime().addShutdownHook(SHUTDOWN_HOOK);
}

private static final String NAME_REGEX = "^[A-Za-z][A-Za-z0-9_]{0,47}$";

private static final Map<String, HugeGraph> graphs = new HashMap<>();
private static final Map<String, HugeGraph> GRAPHS = new HashMap<>();

private static final AtomicBoolean shutdown = new AtomicBoolean(false);
private static final AtomicBoolean SHUTDOWN = new AtomicBoolean(false);

public static synchronized HugeGraph open(Configuration config) {
HugeConfig conf = config instanceof HugeConfig ?
Expand All @@ -82,10 +82,10 @@ public static synchronized HugeGraph open(HugeConfig config) {
String name = config.get(CoreOptions.STORE);
checkGraphName(name, "graph config(like hugegraph.properties)");
name = name.toLowerCase();
HugeGraph graph = graphs.get(name);
HugeGraph graph = GRAPHS.get(name);
if (graph == null || graph.closed()) {
graph = new StandardHugeGraph(config);
graphs.put(name, graph);
GRAPHS.put(name, graph);
} else {
String backend = config.get(CoreOptions.BACKEND);
E.checkState(backend.equalsIgnoreCase(graph.backend()),
Expand All @@ -105,7 +105,7 @@ public static HugeGraph open(URL url) {

public static void remove(HugeGraph graph) {
String name = graph.option(CoreOptions.STORE);
graphs.remove(name);
GRAPHS.remove(name);
}

public static void checkGraphName(String name, String configFile) {
Expand Down Expand Up @@ -143,7 +143,7 @@ public static PropertiesConfiguration getRemoteConfig(URL url) {
* @param timeout seconds
*/
public static void shutdown(long timeout) {
if (!shutdown.compareAndSet(false, true)) {
if (!SHUTDOWN.compareAndSet(false, true)) {
return;
}
try {
Expand All @@ -154,14 +154,14 @@ public static void shutdown(long timeout) {
OltpTraverser.destroy();
} catch (Throwable e) {
LOG.error("Error while shutdown", e);
shutdown.compareAndSet(true, false);
SHUTDOWN.compareAndSet(true, false);
throw new HugeException("Failed to shutdown", e);
}

LOG.info("HugeFactory shutdown");
}

public static void removeShutdownHook() {
Runtime.getRuntime().removeShutdownHook(shutdownHook);
Runtime.getRuntime().removeShutdownHook(SHUTDOWN_HOOK);
}
}
Loading