Releases: vsilaev/tascalate-concurrent
Tascalate Concurrent 0.9.8
Tascalate Concurrent 0.9.7
Relax type restrictions in Promises.partitioned
and PromiseOperations.partitioned***
-- the source
entries' type and the spawner
-s return value type may be different.
Tascalate Concurrent 0.9.6
- Refactoring promise customizers for context vars and blocking io
- Fixing errors with NIO classes in
net.tascalate.concurrent.io
Tascalate Concurrent 0.9.5
Adding net.tascalate.concurrent.io
package with the following functionality:
- Drop-in replacement for
java.nio.channels.AsynchronousChannel
implementations likeAsynchronousFileChannel
,AsynchronousServerSocketChannel
,AsynchronousSocketChannel
. BlockingIO
class that helps create interruptible code that uses blockingjava.io.InputStream
,java.io.OutputStream
,java.net.HttpUrlConnection
and alike.
Tascalate Concurrent 0.9.4
Minor release with the following changes:
- Fix issue Unexpected cancellation behavior - now onTimeout / orTimeout methods with
cancelOnTimeout = true
correctly and timely cancelsPromise
even when used withExecutor
having limited number of free threads (even in case of single-thread executor). However, the behavior may still be surprising forcancelOnTimeout = false
case, while we always have to switch back to to the originalExecutor
after timeout (and if it has no free threads, then switching thread context is impossible). - Simplified
CallbackRegistry
and related code inAbstractCompletableTask
. - Fix error propagation in
CompletablePromise
, fix cancellation ofcompleteAsync
result (should not complete theCompletablePromise
).
Tascalate Concurrent 0.9.3
This minor update has the following changes:
- Simplified
Promise.onCancel
implementation (no need for internal extra classes, just std.whenComplete
handler is enough) MultitargetException
now behaves as a standard Java exception (causes are no stored asException.cause
andException.suppressedExceptions
;Exception.message
provides meaningful explanation; stack traces works correctly)- Fixed
currentStage
cancellation inAsyncLoop
- Other minor fixes and refactorings (
PromiseAdapterExtended
superclass; simplify dependencies betweenAbstractCompletableTask
and subclasses; move responsibilities betweenTimeouts
andPromiseHelper
etc)
Tascalate Concurrent 0.9.2
This release contains some code cleanup - separating responsibilities between classes, fixing minor issues, improving performance
ConfigurableDependentPromise
now contains only pure wrapper methods, no implementation for default methods (moved toPromise
andPromiseHelper
classes). It was logically incorrect to have anything but wrapping code inDependentPromise
implementation.ConfigurableDependentPromise
and promises originating fromonCancel
operator are true decorators now - it may be either directly completed/cancelled or via completion/cancellation of the wrapped promise (previously only direct version worked correctly).CompletableTask
is no longerRunnable
- separateRunnablePromise
interface is introduced andCompletableTask
internal subclass is used inThreadPoolTaskExecutor
and alike.AbstractCompletionStageDecorator
decorator now usesCompletionStage
as operators' return value, inheritedAbstractPromiseLikeDecorator
subclass is introduced with overloaded operators returningPromise
. This allowed to introduce concreteCompletionStageDecorator
andExecutorBoundCompletionStage
classes. The later exists previously, but in different package and copying a lot of code fromAbstractCompletionStageDecorator
.- JDK version-specific helpers are introduced to correctly delegate
CompletionStage
calls whenever possible (incl. delegation to the new JDK 12 API methods). WARNING: you need both JDK 12 and JDK 8 to build project locally (JDK 8 is used only for docs). - More efficient implementation of
exceptionallyAsync
andexceptionallyCompose[Async]
is created forPromise
implementations (both wrappers andAbstractCompletableTask
). Promises.isCompletedExceptionally
method added (as inCompletableFuture
).- All internal
Promise
usages are nowCompletableFutureWrapper
instead ofCompletablePromise
- so they never may be completed erroneously outside. CompletablePromise
is extended to be completeCompletableFuture
counterpart, incl. explicit completion and similar method from JDK 9 / 12 (complete
,completeExceptionally
,completeAsync
,minimalCompletionStage
,minimalCompletionPromise
).- Ad-hoc cancellation methods in custom
CompletionStage
implementations are better supported now (caching lookups, using MethodHandles instead of reflection, etc) - Standardize
CompletableFutureWrapper.toCompletableFuture(enlistOrigin)
behavior - when returnedCompletableFuture
cancels originalPromise
and when it doesn't. Previously this behavior was broken. - Adding non-blocking lock / semaphore / countDownLatch in
net.tascalate.concurrent.locks
package. DependentPromise.as_
is renamed toDependentPromise.asʹ
(a special char on end).
Tascalate Concurrent 0.9.1
This release REPLACES 0.9.0 - the previous one is broken due to severe error in Promises.retry
functionality as well as due to breaking changes in Promises.atLeast
that should be done in major (0.x
) release.
The changes are:
- Critical fix:
Promises.retry
functionality now restored (was endless loop if retry fails for the given attempts count) - Critical fix: wrappers of
CompletableFuture
now overridesthenCompose[Async](fn)
behavior for cancellation -- now the Promise returned from fn is cancelled as well (same as withCompletableTask
). - Critical incompatible change:
Promises.atLeast
andPromises.atLeastStrict
now returns only successfully completed promises, same asPromises.all
andPromises.any[Strict]
. If you need to check positions of successfully completed promises please use new methods:Promises.atLeastOrdered
andPromises.atLeastOrderedStrict
. Both returns list ofj.u.Optional
,null
at corresponding position means thatCompletionStage
was settled with an error, non-nullOptional
corresponds to result (emptyOptional
means that original result wasnull
). - Get rid of sneaky-throwing exceptions in timeouts handling and for
AsyncCompletions
. Generally,AsyncCompletions
now works likeCompletableFuture.join()
for theIterator / Stream
of promises. - Variants of
Promises.any[Strict]
andPromises.atLeast[Strict]
that acceptsj.u.Map
parameter now returns no more elements than it was requested. - Added
RetryCallable.of
/RetryRunnable.of
methods to simplify conversions ofCallable / Runnable
- Added
DelayPolicy.withCustomizer
to let insert custom implementations ofDelayPolicy
wrappers in chained fashion. - Added
DependentPromise.as_
with more specific function arg type; - Simplified
RetryContext
internals AggregatingPromise
now cancels remaining promises before firing events - to release resources before using results of theAggregatingPromise
itself; also this class is optimized for several usage scenarios.RetryPolicy.exceptionClassRetryable
is overridable now;
Tascalate Concurrent 0.9.0
This release adds several major features as long as refactorings of the existing API (so it has some breaking changes):
- Revisit and refactor
Promise.raw()
functionality and introducingPromise.unwrap()
(single-level undecoration) in addition toPromise.raw()
(full undecoration); fixing all related code to useunwrap
in favor ofraw
. - Adding new operators to
Promise
-thenFilter
andthenFilterAsync
- Adding missing
Thread
/Executor
-related stuff:TaskCompletionService
,TreadFactoryBuilder
,ThreadGroupBuilder
and alike. - Revisiting
ContextVar
and related context-aware functionality: shifting responsibilities, introducingContextTrampoline
, provide an option to create contex-awareExecutor
-s in addition to context-awarePromise
-s. - Adding asynchronous version of
try-with-resource
functionality toPromises
that supports both synchronously closeable resources (std.AutoClosable
) and asynchronously closeable resources (implementing library-specificAsyncCloseable
). - Adding
AsyncCompletions
class that provides an option to iterate / stream over completedPromise
-s results (loaded by batches). - Providing an option to partitioned collections processing with
Promises.partitioned
. - Introduce
PromiseOperations
class that exposes utility methods for convenient decoration ofPromise
-s viaPromise.as(decorator)
operation. - Adding
Promises.loop
to provide asynchronous function-style equivalent of Java loops (likefor
/while
/do-while
). - Refactor retry functionality (fix corner cases, simplifying code using asynchronous loop).
- Complement
all
/any[Strict]
/atLeast[Strict]
/ with overloaded methods that accepts and returns keyed collections (java.util.Map
) in addition to indexed collections.
Tascalate Concurrent 0.8.4
Minor release with the following changes:
- Fix bug in default
DelayPolicy.withMinDelay(...)
metod -- erroneously delegates towithMaxDelay
. - Remove rarely used internal helper classes to minimize library size.