Comments (3)
Read the doc about dependent()
promise functionality -- you are cancelling only the the latest stage - exceptionally
For your specific case the best option is:
return CompletableTask.supplyAsync(() -> candidate, pool)
.dependent(PromiseOrigin.ALL) //Key point
.thenApplyAsync(CheckIp::doWork)
.thenApplyAsync(CheckType::doWork).thenApplyAsync(CheckExclusion::doWork)
.thenApplyAsync(AssignEntity::doWork).thenApplyAsync(DecideWmi::doWork)
.thenApplyAsync(ObtainWmiConnection::doWork).thenApplyAsync(ObtainRegistryWmiConnection::doWork)
.thenApplyAsync(RunCompliance::doWork).thenApplyAsync(DecideComplianceResult::doWork)
.thenApplyAsync(CreateAlert::doWork).thenApplyAsync(ApplyFailureManager::doWork)
.thenApplyAsync(ApplyDisconnectManager::doWork).thenApplyAsync(EnforceCompliance::doWork)
.exceptionally(ExceptionHandlerService::handle).orTimeout(Duration.ofSeconds(3), true);
Next item, your code should cooperate with the library -- either check Thread.currentThread().isInterrupted()
as in this issue or use libs that supports interruptions -- for ex., I/O streams created with Channels.newInputStream(FileChannel.open(...))
may be interrupted on read/write, but ones coming from FileInputStream
are not. Same is true for different Http Connection libs (see here).
from tascalate-concurrent.
Thank you. i tried with the dependent without args and it didnt work however when i tried using the PromiseOrigin.All i got the result that i wanted
from tascalate-concurrent.
Yes, I need to document this feature. Plus what unwrap
and raw
do in regard to the dependent
method and other decorators.
from tascalate-concurrent.
Related Issues (20)
- Issues with Callbacks HOT 11
- OnTimeout not working when computing intensive task HOT 5
- orTime and submit combination HOT 5
- How to wrap a Promise into Promise.retry HOT 5
- Typo in DelayPolicy#withMinDelay HOT 1
- Feature enhancement on cancel HOT 2
- A FutureLocal.java would be nice(like ThreadLocal.java but more) HOT 1
- MultitargetException swallows Exceptions HOT 7
- Include class names in the documentation when highlighting a method
- Unexpected cancellation behavior HOT 6
- Promise.onTimeout does not cancel the async call in original CompletableTask.supplyAsync? HOT 8
- Promises#all(CompletionStage<? extends T>...) cancellation does not seem to work correctly HOT 5
- Wait for Interrupted of CompletableTask.cancel HOT 4
- onTimeout behaviour confusing after 0.8.4 HOT 2
- Optimized Same Executor Runs HOT 1
- Mapped promise can't be interrupted HOT 1
- Exceptions in thenCompose() will not propagate HOT 3
- Promises.all - List type argument HOT 3
- whenCompleteAsync adds the failure exception as a suppressed exception to itself HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tascalate-concurrent.