A library of tools to assist with safe concurrent java development. Providing unique priority based thread pools, and ways to distrbute threaded work safely.
Enhancements:
Major API version change, breaking changes include:
Deprecation's removed:
ListenableFutureTask
no longer supports a recurring or repeating mode of operation. Because of that the boolean
to define the mode is no longer accepted. If you previously were passing a false
for this argument it can be simply removed. If recurring execution is needed this can be hacked in easily (and is done within the library in our compatibility layer).ConfigurableThreadFactory
's constructors has been removed, supplying an additional null
argument at the end will match 6.X's functionality.ThreadReferencingThreadFactory
. Supplying an additional null
argument at the end will match 6.X's functionality.SameThreadSubmitterExecutor
can no longer be constructed. Internal optimizations require the use of SameThreadSubmitterExecutor.instance()
Profiler
invocations of dump
where specifying if individual threads should be included have been removed. Now an additional argument must be specified for the minimum number of times a stack had to be witnessed before it was reported, allowing an even more concise output. Specifying an argument of 1
at the end will match 6.X's functionality.UnsafeAccess
was removed to comply with JDK 17 supportThe above is summarized in our migration guide: https://github.com/threadly/threadly/wiki/Major-version-migration-guide#6x---7x
Feel free to join our Zulip chat or file an issue if you need help with migration
6.7 Release is primarily focused around API changes in ListenableFutureTask
. In 7.0 the ability to have a recurring ListenableFutureTask
is removed. For that reason the constructor has been changed to no longer accept a boolean for this recurring state. Assuming a false
was previously provided this argument can now simply be removed.
Changes included in this release:
StatisticsUtils
getMax
and getMin
implementations in order to find the extreme values in a collection of Number
'sFutureUtils.makeFirstResultFuture
permutation added where errors are ignored.FutureUtils.makeResultListFuture
wont throw an IllegalStateException
if a dependent future is canceled. Because it needs the results (unless errors are ignored), this is still a fatal condition. However the resulting future will now indicate this state instead of having the Exception thrown.The constructor for SameThreadSubmitterExecutor
has been deprecated. This was meant to be done earlier, instead SameThreadSubmitterExecutor.instance()
should be used.
ReschedulingOperation
performance improvements by to looping instead of immediately executing if it was signaled while running. This provides a couple improvements:
ConfigurableThreadFactory
now has the ability to add a listener to be provided threads as they are created. This can be useful for debugging or other monitoring code which needs to know about threads related to specific pools. Within the threadly library ControlledThreadProfiler
is a perfect example of how this can be leveraged.
This release includes:
OrderedExecutorLimiter
where canceled ListenableFuture
's returned by it could result in a NullPointerException
when sorting the queue.Improvements included in this release:
Profiler
to control how the dump is produced for the ListenableFuture result in a timed start
. This can be useful when using the timed start and needing to produce large dumps or otherwise concerned about the performance impacts.OrderedExecutorLimiter
was extended to allow the limits to be adjusted at runtime just like the ExecutorLimiter
can. If you extend ExecutorLimiter
in your application please read the commit notes: https://github.com/threadly/threadly/commit/a21152e029d36343755e2acc0eca9c33ed261682
Improvements included in this release:
OrderedExecutorLimiter
. This limiter provides the first way to provide a task ordering besides FIFO.SingleThreadScheduler.prestartExecutionThread
not blocking for the thread to start when invoked concurrently and another thread initiated the start. This is a very small window with no likely noticeable impact, but was still a simple fix.Features and improvements in this release:
NullPointerException
state if the mapper returns a null
futureProfiler
the output can be configured to omit stacks which were seen less than X timesListenableFuture
now has the ability to check for an error state without needing an ExecutionException
: https://github.com/threadly/threadly/commit/e55ad5bb978038c1170488801124be250016abda#diff-43daa81fc2a0173f30f7eee9cd8ea2daR65
6.0 API update release:
org.threadly.test.concurrent
package has been moved to a new artifact at the maven coordinates org.threadly:threadly-test:1.0
.
BlockingQueueConsumer
was replaced with a potentially more performant Poller.consumeQueue
or a more direct replacement org.threadly.concurrent.processing.BlockingQueueConsumer
CentralThreadlyPool.lowPriorityPool(boolean)
was replaced with either CentralThreadlyPool.lowPrioritySingleThreadPool()
or CentralThreadlyPool.lowPriorityPool()
DoNothingRunnable
can not be constructed, instead DoNothingRunnable.instance()
should be used.
RunnableCallableAdapter
can not be constructed, instead the static function RunnableCallableAdapter.adapt
should be used.
RunnableChain
was moved to the package org.threadly.concurrent.wrapper
AbstractFutureCallbackFailureHandler
was removed, instead use ListenableFuture.failureCallback(Consumer)
AbstractFutureCallbackResultHandler
was removed, instead use ListenableFuture.resultCallback(Consumer)
FutureCallbackExceptionHandlerAdapter
was removed, instead use ListenableFuture.failureCallback(Consumer)
(which allows an ExceptionHandler
to be passed in)
FutureCallbackFailureHandler
was removed, instead use ListenableFuture.failureCallback(Consumer)
FutureCallbackResultHandler
was removed, instead use ListenableFuture.resultCallback(Consumer)
FutureUtils.scheduleWhileTaskResultNull
was removed, instead just implement a small Predicate with a null
check and use FutureUtils.scheduleWhile
Watchdog
was renamed and moved to org.threadly.concurrent.future.watchdog.ConstantTimeWatchdog
WatchdogCache
was renamed and moved to org.threadly.concurrent.future.watchdog.MixedTimeWatchdog
RunnableFutureCallbackAdapter
was removed without replacement (more precise and performant lambda options are used now)
ListenableScheduledFuture
interface was removed without replacement
ScheduledFutureDelegate
was removed without replacement
StripedLock
was removed without replacement
A variety of deprecated constructors were replaced, see 5.43 javadocs for details on how to migrate to a still supported constructor
We decided to keep this release smaller by limiting the scope to currently exclude:
A JVM upgrade will NOT be included, still allowing java 8 and newer.
Deeper API considerations previously planned for 6.0 are going to be pushed to potentially a 7.0 release.
This is the last release before the 6.0 major version bump. This release includes:
CompletableFutureAdapter
to allow the easy use threadly ListenableFuture
with java.util.concurrent.CompletableFuture
types.ConstantTimeWatchdog
was improved to reduce Clock
updates when there is no futures ready to expire (goes from two clock updates to one)KeyDistributedScheduler
has minor GC overhead improvements for recurring tasksorg.threadly.test.concurrent
package are marked as deprecated, now provided from the org.threadly:threadly-test:0.1
artifact: https://github.com/threadly/threadly-test