You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2017/10/27 09:18:00 UTC
mina git commit: Added a Thread Factory that creates daemon threads.
This can be used when passing an Executor to services.
Repository: mina
Updated Branches:
refs/heads/2.0 bf4b9e345 -> f67ccd7a5
Added a Thread Factory that creates daemon threads. This can be used
when passing an Executor to services.
Project: http://git-wip-us.apache.org/repos/asf/mina/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina/commit/f67ccd7a
Tree: http://git-wip-us.apache.org/repos/asf/mina/tree/f67ccd7a
Diff: http://git-wip-us.apache.org/repos/asf/mina/diff/f67ccd7a
Branch: refs/heads/2.0
Commit: f67ccd7a50230e9b50fb589165c92b2c011461f5
Parents: bf4b9e3
Author: Emmanuel Lécharny <el...@symas.com>
Authored: Fri Oct 27 11:17:56 2017 +0200
Committer: Emmanuel Lécharny <el...@symas.com>
Committed: Fri Oct 27 11:17:56 2017 +0200
----------------------------------------------------------------------
.../apache/mina/util/DaemonThreadFactory.java | 43 ++++++++++++++++++++
1 file changed, 43 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mina/blob/f67ccd7a/mina-core/src/main/java/org/apache/mina/util/DaemonThreadFactory.java
----------------------------------------------------------------------
diff --git a/mina-core/src/main/java/org/apache/mina/util/DaemonThreadFactory.java b/mina-core/src/main/java/org/apache/mina/util/DaemonThreadFactory.java
new file mode 100644
index 0000000..386bf68
--- /dev/null
+++ b/mina-core/src/main/java/org/apache/mina/util/DaemonThreadFactory.java
@@ -0,0 +1,43 @@
+/*
+ * 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.mina.util;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+
+/**
+ * A Thread Factory that creates Daemon threads
+ *
+ *
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class DaemonThreadFactory implements ThreadFactory {
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Thread newThread(Runnable runnable) {
+ // Create daemon threads.
+ Thread thread = Executors.defaultThreadFactory().newThread(runnable);
+ thread.setDaemon(true);
+
+ return thread;
+ }
+}