Interface CheckAssetContext

  • All Known Implementing Classes:
    AssetLatchImpl

    public interface CheckAssetContext
    Context to check on the Asset.
    Author:
    Daniel Sagenschneider
    • Method Detail

      • getTime

        long getTime()

        Obtains the time that check is being made.

        As many Asset instances may be checked at the same time (or nanoseconds from each other) this provides optimisation to obtain the current time in milliseconds (equivalent to System.currentTimeMillis() for purpose of checking Asset timeouts).

        Returns:
        System.currentTimeMillis() equivalent for checking Asset timeouts.
      • releaseFunctions

        void releaseFunctions​(boolean isPermanent)
        Releases the FunctionState instances waiting on the Asset.
        Parameters:
        isPermanent - true indicates that all FunctionState instances added to the AssetLatch from now on are activated immediately. It is useful to flag an AssetLatch in this state when the Asset is no longer being used to stop a FunctionState from waiting forever.
      • failFunctions

        void failFunctions​(java.lang.Throwable failure,
                           boolean isPermanent)
        Fails the FunctionState instances waiting on this Asset.
        Parameters:
        failure - Failure to propagate to the ThreadState of the FunctionState instances waiting on the Asset.
        isPermanent - true indicates that all FunctionState instances added to the AssetLatch from now on are activated immediately with the input failure. It is useful to flag an AssetLatch in this state when the Asset is in a failed state that can not be recovered from.