Giter Club home page Giter Club logo

Comments (3)

vsilaev avatar vsilaev commented on May 27, 2024

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.

unaor avatar unaor commented on May 27, 2024

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.

vsilaev avatar vsilaev commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.