Skip to content

morgwai/java-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1ff8e24 · Apr 14, 2025
Jan 19, 2024
Jan 19, 2024
Apr 8, 2025
Apr 21, 2021
Jan 19, 2024
Apr 8, 2025
May 12, 2021
Apr 14, 2025
Jan 19, 2024
Jan 19, 2024
Jan 19, 2024
Jun 17, 2023
Jun 17, 2023
Jun 17, 2023
Apr 8, 2025

Repository files navigation

Java utils

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.

MAIN USER CLASSES

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 Threads based on a constructor supplied generator/name.

ByteArrayOutputStream that allows to directly access its underlying buffer (without copying) after the stream was closed.