@Test public void namedThreads() { ThreadFactory f = Tools.namedThreads("foo-%d"); Thread t = f.newThread(() -> TestTools.print("yo")); assertTrue("wrong pattern", t.getName().startsWith("foo-")); }
public static ThreadFactory namedThreads(String pattern) { return new ThreadFactoryBuilder() .setNameFormat(pattern) .setUncaughtExceptionHandler((t, e) -> log.error("Uncaught exception on " + t.getName(), e)) .build(); }
Tools { public static ThreadFactory namedThreads(String pattern) { return new ThreadFactoryBuilder() .setNameFormat(pattern) .setUncaughtExceptionHandler((t, e) -> log.error("Uncaught exception on " + t.getName(), e)) .build(); } }
Tools { public static ThreadFactory namedThreads(String pattern) { return new ThreadFactoryBuilder() .setNameFormat(pattern) .setUncaughtExceptionHandler((t, e) -> log.error("Uncaught exception on " + t.getName(), e)) .build(); } private  Tools(); }
Tools { public static ThreadFactory namedThreads(String pattern) { return new ThreadFactoryBuilder() .setNameFormat(pattern) .setUncaughtExceptionHandler((t, e) -> log.error("Uncaught exception on " + t.getName(), e)) .build(); } private  Tools(); static ThreadFactory namedThreads(String pattern); static ThreadFactory groupedThreads(String groupName, String pattern); static ThreadFactory groupedThreads(String groupName, String pattern, Logger logger); static ThreadFactory minPriority(ThreadFactory factory); static boolean isNullOrEmpty(Collection collection); static T nullIsNotFound(T item, String message); static Set<T> emptyIsNotFound(Set<T> item, String message); static T nullIsIllegal(T item, String message); static long fromHex(String string); static String toHex(long value); static String toHex(long value, int width); static byte[] getBytesUtf8(String input); static String toStringUtf8(byte[] input); static byte[] copyOf(byte[] original); static String get(Dictionary<?, ?> properties, String propertyName); static Integer getIntegerProperty(Dictionary<?, ?> properties,
                                             String propertyName); static int getIntegerProperty(Dictionary<?, ?> properties,
                                         String propertyName,
                                         int defaultValue); static Boolean isPropertyEnabled(Dictionary<?, ?> properties,
                                             String propertyName); static boolean isPropertyEnabled(Dictionary<?, ?> properties,
                                            String propertyName,
                                            boolean defaultValue); static void delay(int ms); static Function<U, V> retryable(Function<U, V> base,
            Class<? extends Throwable> exceptionClass,
            int maxRetries,
            int maxDelayBetweenRetries); static Supplier<V> retryable(Supplier<V> base,
            Class<? extends Throwable> exceptionClass,
            int maxRetries,
            int maxDelayBetweenRetries); static void randomDelay(int ms); static void delay(int ms, int nanos); static void removeDirectory(String path); static void removeDirectory(File dir); static String timeAgo(long unixTime); static void copyDirectory(String src, String dst); static void copyDirectory(File src, File dst); static T futureGetOrElse(Future<T> future, T defaultValue); static T futureGetOrElse(Future<T> future,
                                        long timeout,
                                        TimeUnit timeUnit,
                                        T defaultValue); static CompletableFuture<T> exceptionalFuture(Throwable t); static CompletableFuture<List<T>> allOf(List<CompletableFuture<T>> futures); static byte[] byteBuffertoArray(ByteBuffer buffer); static Stream<T> stream(Iterable<T> it); static Stream<T> stream(Optional<? extends T> optional); }
Tools { public static ThreadFactory namedThreads(String pattern) { return new ThreadFactoryBuilder() .setNameFormat(pattern) .setUncaughtExceptionHandler((t, e) -> log.error("Uncaught exception on " + t.getName(), e)) .build(); } private  Tools(); static ThreadFactory namedThreads(String pattern); static ThreadFactory groupedThreads(String groupName, String pattern); static ThreadFactory groupedThreads(String groupName, String pattern, Logger logger); static ThreadFactory minPriority(ThreadFactory factory); static boolean isNullOrEmpty(Collection collection); static T nullIsNotFound(T item, String message); static Set<T> emptyIsNotFound(Set<T> item, String message); static T nullIsIllegal(T item, String message); static long fromHex(String string); static String toHex(long value); static String toHex(long value, int width); static byte[] getBytesUtf8(String input); static String toStringUtf8(byte[] input); static byte[] copyOf(byte[] original); static String get(Dictionary<?, ?> properties, String propertyName); static Integer getIntegerProperty(Dictionary<?, ?> properties,
                                             String propertyName); static int getIntegerProperty(Dictionary<?, ?> properties,
                                         String propertyName,
                                         int defaultValue); static Boolean isPropertyEnabled(Dictionary<?, ?> properties,
                                             String propertyName); static boolean isPropertyEnabled(Dictionary<?, ?> properties,
                                            String propertyName,
                                            boolean defaultValue); static void delay(int ms); static Function<U, V> retryable(Function<U, V> base,
            Class<? extends Throwable> exceptionClass,
            int maxRetries,
            int maxDelayBetweenRetries); static Supplier<V> retryable(Supplier<V> base,
            Class<? extends Throwable> exceptionClass,
            int maxRetries,
            int maxDelayBetweenRetries); static void randomDelay(int ms); static void delay(int ms, int nanos); static void removeDirectory(String path); static void removeDirectory(File dir); static String timeAgo(long unixTime); static void copyDirectory(String src, String dst); static void copyDirectory(File src, File dst); static T futureGetOrElse(Future<T> future, T defaultValue); static T futureGetOrElse(Future<T> future,
                                        long timeout,
                                        TimeUnit timeUnit,
                                        T defaultValue); static CompletableFuture<T> exceptionalFuture(Throwable t); static CompletableFuture<List<T>> allOf(List<CompletableFuture<T>> futures); static byte[] byteBuffertoArray(ByteBuffer buffer); static Stream<T> stream(Iterable<T> it); static Stream<T> stream(Optional<? extends T> optional);  }