diff --git a/pom.xml b/pom.xml
index b2d6e712c..864480e41 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.baidu.hugegraph
hugegraph-common
- 1.5.2
+ 1.5.3
hugegraph-common
https://github.com/hugegraph/hugegraph-common
@@ -192,7 +192,7 @@
- 1.5.2.0
+ 1.5.3.0
diff --git a/src/main/java/com/baidu/hugegraph/event/EventHub.java b/src/main/java/com/baidu/hugegraph/event/EventHub.java
index cd6499792..6b6779f7b 100644
--- a/src/main/java/com/baidu/hugegraph/event/EventHub.java
+++ b/src/main/java/com/baidu/hugegraph/event/EventHub.java
@@ -26,7 +26,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
@@ -36,6 +35,7 @@
import com.baidu.hugegraph.iterator.ExtendableIterator;
import com.baidu.hugegraph.util.E;
+import com.baidu.hugegraph.util.ExecutorUtil;
import com.baidu.hugegraph.util.Log;
import com.google.common.collect.ImmutableList;
@@ -43,6 +43,7 @@ public class EventHub {
private static final Logger LOG = Log.logger(EventHub.class);
+ public static final String EVENT_WORKER = "event-worker-%d";
public static final String ANY_EVENT = "*";
private static final List EMPTY = ImmutableList.of();
@@ -70,7 +71,7 @@ public static synchronized void init(int poolSize) {
return;
}
LOG.debug("Init pool(size {}) for EventHub", poolSize);
- executor = Executors.newFixedThreadPool(poolSize);
+ executor = ExecutorUtil.newFixedThreadPool(poolSize, EVENT_WORKER);
}
public static synchronized boolean destroy(long timeout)
diff --git a/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java b/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java
new file mode 100644
index 000000000..bc2fea648
--- /dev/null
+++ b/src/main/java/com/baidu/hugegraph/util/ExecutorUtil.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2017 HugeGraph Authors
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+package com.baidu.hugegraph.util;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ThreadFactory;
+
+import org.apache.commons.lang3.concurrent.BasicThreadFactory;
+
+public final class ExecutorUtil {
+
+ public static ExecutorService newFixedThreadPool(int size, String name) {
+ ThreadFactory factory = new BasicThreadFactory.Builder()
+ .namingPattern(name)
+ .build();
+ return java.util.concurrent.Executors.newFixedThreadPool(size, factory);
+ }
+}