Class FailedFuture

java.lang.Object
com.tccc.kos.commons.util.concurrent.future.FutureWork
com.tccc.kos.commons.util.concurrent.future.FailedFuture
All Implemented Interfaces:
Abortable, Cancelable, Terminable, Runnable

public class FailedFuture extends FutureWork
A future that immediately fails when started. This is useful for methods that expect to return a future but the expected future cannot be returned as internal state will not allow it. This class allows that method to preserve the contract and return a future that will immediately fail with the specified reason code.
Since:
1.0
Version:
2022-05-05
  • Constructor Details

    • FailedFuture

      public FailedFuture(String name, String reason)
      Creates a future that will fail with the specified reason.
      Parameters:
      name - the name of this future (for diagnostics)
      reason - the reason for the failure
    • FailedFuture

      public FailedFuture(String name, String reason, ReasonData data)
      Creates a future that will fail with the specified reason and data.
      Parameters:
      name - the name of this future (for diagnostics)
      reason - the reason for the failure
      data - associated reason data