Some utility classes.
Copyright 2021 Piotr Morgwai Kotarbinski, Licensed under the Apache License, Version 2.0.
latest release: 5.2
(javadoc)
See CHANGES for the summary of changes between releases. If the major version of a subsequent release remains unchanged, it is supposed to be backwards compatible in terms of API and behaviour with previous ones with the same major version (meaning that it should be safe to just blindly update in dependent projects and things should not break under normal circumstances).
Note: from version 2.0, java.util.logging
utilities have been moved to a separate repo.
Buffers messages until all of those that should be written before to the underlying output stream are available, so that they all can be written in the desired order. Useful for processing input streams in several concurrent Threads when the order of the resulting outbound messages must reflect the order of inbound messages. See a usage example here.
Adapter for a Callable
that allows to pass it to Executor.execute(Runnable)
and access its results using CompletableFuture API.
ExecutorService
that allows to obtain a List of currently running tasks. Useful for monitoring or debugging which tasks got stuck and prevented clean termination. 2 implementations are provided: TaskTrackingThreadPoolExecutor extending ThreadPoolExecutor
and ScheduledTaskTrackingThreadPoolExecutor extending ScheduledThreadPoolExecutor
.
Utilities to await for multiple timed blocking operations, such as Thread.join(timeout)
, ExecutorService.awaitTermination(...)
etc. See a usage example here.
ThreadFactory
that names new Thread
s based on a constructor supplied generator/name.
ByteArrayOutputStream
that allows to directly access its underlying buffer (without copying) after the stream was closed.