This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git
The following commit(s) were added to refs/heads/master by this push:
new 4b77d24 Revert "[LANG-1455] Add a DaemonThreadFactory.</action>"
4b77d24 is described below
commit 4b77d24042a411204c25f81bf4e5f38e43ab94a1
Author: Gary Gregory <[email protected]>
AuthorDate: Wed May 1 18:43:39 2019 -0400
Revert "[LANG-1455] Add a DaemonThreadFactory.</action>"
This reverts commit b30be60a81a14921b3c6bca9689f4886693f1bcd.
---
src/changes/changes.xml | 1 -
.../lang3/concurrent/DaemonThreadFactory.java | 55 ----------------------
.../lang3/concurrent/DaemonThreadFactoryTest.java | 50 --------------------
3 files changed, 106 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index ac0834f..7ef4c18 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -47,7 +47,6 @@ The <action> type attribute can be add,update,fix,remove.
<release version="3.10" date="YYYY-MM-DD" description="TBD">
<action issue="LANG-1450" type="fix" dev="chtompki">Generate javadoc jar
on build.</action>
- <action issue="LANG-1455" type="add" dev="ggregory">Add a
DaemonThreadFactory.</action>
</release>
<release version="3.9" date="2019-04-09" description="New features and bug
fixes. Requires Java 8, supports Java 9, 10, 11">
diff --git
a/src/main/java/org/apache/commons/lang3/concurrent/DaemonThreadFactory.java
b/src/main/java/org/apache/commons/lang3/concurrent/DaemonThreadFactory.java
deleted file mode 100644
index b8e4b17..0000000
--- a/src/main/java/org/apache/commons/lang3/concurrent/DaemonThreadFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.commons.lang3.concurrent;
-
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * A {@link ThreadFactory} that produces daemon threads.
- *
- * @since 3.10
- */
-public class DaemonThreadFactory implements ThreadFactory {
-
- private static final String FORMAT = "%s-%s";
- private final String namePrefix;
- private final AtomicInteger threadCount = new AtomicInteger(0);
-
- public DaemonThreadFactory() {
- this(DaemonThreadFactory.class.getSimpleName());
- }
-
- public DaemonThreadFactory(final String prefix) {
- this.namePrefix = prefix;
- }
-
- @Override
- public Thread newThread(final Runnable runnable) {
- if (runnable == null) {
- return null;
- }
- final String name = String.format(FORMAT, this.namePrefix,
this.threadCount.incrementAndGet());
- final Thread thread = new Thread(runnable, name);
- thread.setDaemon(true);
- if (thread.getPriority() != Thread.NORM_PRIORITY) {
- thread.setPriority(Thread.NORM_PRIORITY);
- }
- return thread;
- }
-}
diff --git
a/src/test/java/org/apache/commons/lang3/concurrent/DaemonThreadFactoryTest.java
b/src/test/java/org/apache/commons/lang3/concurrent/DaemonThreadFactoryTest.java
deleted file mode 100644
index 07203cd..0000000
---
a/src/test/java/org/apache/commons/lang3/concurrent/DaemonThreadFactoryTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.commons.lang3.concurrent;
-
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-public class DaemonThreadFactoryTest {
-
- private static Runnable NOOP_RUNNABLE = new Runnable() {
-
- @Override
- public void run() {
- // noop
-
- }
- };
-
- @Test
- public void testThreadFactory() {
- final Thread thread = new
DaemonThreadFactory().newThread(NOOP_RUNNABLE);
- Assertions.assertTrue(thread.isDaemon());
- final String name = thread.getName();
- Assertions.assertTrue(name.startsWith("DaemonThreadFactory-"), name);
- }
-
- @Test
- public void testThreadFactoryPrefix() {
- final String expectedName =
DaemonThreadFactoryTest.class.getSimpleName();
- final Thread thread = new
DaemonThreadFactory(expectedName).newThread(NOOP_RUNNABLE);
- Assertions.assertTrue(thread.isDaemon());
- final String name = thread.getName();
- Assertions.assertTrue(name.startsWith(expectedName + "-"), name);
- }
-}