jonyangx commented on code in PR #3044:
URL: 
https://github.com/apache/incubator-eventmesh/pull/3044#discussion_r1096602798


##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/EventMeshThreadFactory.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * 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 org.apache.eventmesh.common;
+
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import lombok.Getter;
+
+public class EventMeshThreadFactory implements ThreadFactory {
+
+    @Getter
+    private final String threadNamePrefix;
+    private final AtomicInteger threadIndex;
+    private final boolean daemon;
+    private Integer priority;
+
+    public EventMeshThreadFactory(final String threadNamePrefix, final 
AtomicInteger threadIndex, final boolean daemon,
+        final Integer priority) {
+        this.threadNamePrefix = threadNamePrefix;
+        this.threadIndex = threadIndex;
+        this.daemon = daemon;
+        this.priority = priority;
+    }
+
+    public EventMeshThreadFactory(final String threadNamePrefix, final 
AtomicInteger threadIndex,
+        final boolean daemon) {
+        this(threadNamePrefix, threadIndex, daemon, null);
+    }
+
+    public EventMeshThreadFactory(final String threadNamePrefix, final boolean 
daemon, final Integer priority) {
+        this(threadNamePrefix, new AtomicInteger(0), daemon, priority);
+    }
+
+    public EventMeshThreadFactory(final String threadNamePrefix, final boolean 
daemon) {
+        this(threadNamePrefix, new AtomicInteger(0), daemon);
+    }
+
+    public EventMeshThreadFactory(final String threadNamePrefix) {
+        this(threadNamePrefix, new AtomicInteger(0), false);
+    }
+
+    /**
+     * Constructs a new {@code Thread}.  Implementations may also initialize
+     * priority, name, daemon status, {@code ThreadGroup}, etc.
+     *
+     * @param runnable a runnable to be executed by new thread instance
+     * @return constructed thread, or {@code null} if the request to
+     * create a thread is rejected
+     */
+    @Override
+    public Thread newThread(Runnable runnable) {

Review Comment:
   Suggest add abstract method newThread(final Runnable runnable ) in parent 
Class.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to