Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement anySuccess/any(Complete) M* methods in CompletableFutureUtils/CffuFactory/Cffu #191

Closed
Tracked by #50
oldratlee opened this issue Jul 7, 2024 · 1 comment
Assignees

Comments

@oldratlee
Copy link
Member

oldratlee commented Jul 7, 2024

  • CompletableFutureUtils
    • Factory Methods
      • mSupplyAnySuccessAsync/mSupplyAnyAsync
      • mRunAnySuccessAsync/mRunAnyAsync
    • Instance Methods
      • thenMApplyAnySuccessAsync/thenMApplyAnyAsync
      • thenMAcceptAnySuccessAsync/thenMAcceptAnyAsync
      • thenMRunAnySuccessAsync/thenMRunAnyAsync
  • CffuFactory(Factory Methods)
    • mSupplyAnySuccessAsync/mSupplyAnyAsync
    • mRunAnySuccessAsync/mRunAnyAsync
  • Cffu(Instance Methods)
    • thenMApplyAnySuccessAsync/thenMApplyAnyAsync
    • thenMAcceptAnySuccessAsync/thenMAcceptAnyAsync
    • thenMRunAnySuccessAsync/thenMRunAnyAsync
@oldratlee oldratlee changed the title implment of in // implment anySuccessOf/anyOf of M* methods in CompletableFutureUtils/CffuFactory/Cffu Jul 7, 2024
@oldratlee oldratlee added the ✨ feature New feature label Jul 7, 2024
@oldratlee
Copy link
Member Author

oldratlee commented Jul 7, 2024

this feature introduced a new run strategy allSuccess.


当有结果(返回不是CF<Void>)时,6个执行策略一套:

  1. allFastFail
  2. allSuccess
  3. mostSuccess
  4. all(Complete)
  5. anySuccess
  6. any(Complete)

当无结果(返回是CF<Void>)时,4个执行策略一套:

  1. allFastFail
  2. all(Complete)
  3. anySuccess
  4. any(Complete)

mostSuccess对于不带回结果的方法,感觉是无意义的:

  • 因为无结果返回所以并不能进一步确定哪些输入是成功的。
  • 效果等同于:简单地超时等待且返回结果总是成功的。示意代码如下:
    mRunAsync(action1, action2, action3)
      .completeOnTimeout(null, 100, TimeUnit.MILLISECONDS)
      .exceptionally(ex -> null);

类似的,allSuccess对于不带回结果的方法,也是无意义的:

  • 因为无结果返回所以并不能进一步确定哪些输入是成功的。
  • 效果等同于:一直等待都运行且返回结果总是成功的。示意代码如下:
    mRunAsync(action1, action2, action3)
      .exceptionally(ex -> null);

@oldratlee oldratlee changed the title implment anySuccessOf/anyOf of M* methods in CompletableFutureUtils/CffuFactory/Cffu implment anySuccess/any(Complete) of M* methods in CompletableFutureUtils/CffuFactory/Cffu Jul 9, 2024
@oldratlee oldratlee changed the title implment anySuccess/any(Complete) of M* methods in CompletableFutureUtils/CffuFactory/Cffu implement anySuccess/any(Complete) of M* methods in CompletableFutureUtils/CffuFactory/Cffu Jul 10, 2024
oldratlee pushed a commit that referenced this issue Jul 10, 2024
@oldratlee oldratlee changed the title implement anySuccess/any(Complete) of M* methods in CompletableFutureUtils/CffuFactory/Cffu implement anySuccess/any(Complete) M* methods in CompletableFutureUtils/CffuFactory/Cffu Jul 11, 2024
oldratlee added a commit that referenced this issue Jul 11, 2024
…s`; reorder methods; improve format; cleanup test cases (#191)
oldratlee added a commit that referenced this issue Jul 11, 2024
…ds; reorder methods; improve format; cleanup test cases (#191)
oldratlee added a commit that referenced this issue Jul 11, 2024
…ds; reorder methods; improve format; cleanup test cases (#191)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants