Skip to content

Commit 8cf516a

Browse files
committed
Update ThreadUtils.java
1 parent 095d6bf commit 8cf516a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/main/java/io/github/intisy/utils/concurrency/ThreadUtils.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public static <T, U> Thread newThread(BiConsumer<T, U> biConsumer, T input1, U i
138138
* @return the started Thread object
139139
*/
140140
public static <T> Thread newThread(Supplier<T> supplier) {
141-
return newThread(supplier::get);
141+
return newThread(supplier, null);
142142
}
143143

144144
/**
@@ -152,7 +152,7 @@ public static <T> Thread newThread(Supplier<T> supplier) {
152152
* @return the started Thread object
153153
*/
154154
public static <T> Thread newThread(Supplier<T> supplier, String name) {
155-
return newThread(supplier::get, name);
155+
return newThread(supplier, name, false);
156156
}
157157

158158
/**
@@ -166,7 +166,9 @@ public static <T> Thread newThread(Supplier<T> supplier, String name) {
166166
* @return the started Thread object
167167
*/
168168
public static <T> Thread newThread(Supplier<T> supplier, String name, boolean daemon) {
169-
return newThread(supplier::get, name, daemon);
169+
return newThread(() -> {
170+
supplier.get();
171+
}, name, daemon);
170172
}
171173

172174
/**

0 commit comments

Comments
 (0)