Interface FaultToleranceMethodContext

    • Method Detail

      • getConcurrentExecutions

        BlockingQueue<Thread> getConcurrentExecutions()
        Get or create the BlockingQueue for bulkhead.
        Returns:
        the created or existing queue, or null if non existed and requestVolumeThreshold was null
      • getQueuingOrRunningPopulation

        AtomicInteger getQueuingOrRunningPopulation()
        Get the bulkhead thread count.
        Returns:
        This are number of threads that are either waiting or running in the bulkhead.
      • proceed

        Object proceed()
                throws Exception
        Proceeds execution to the annotated method body.
        Returns:
        result returned by the annotated method
        Throws:
        Exception - in case the annotated method threw an Exception.
      • delay

        void delay​(long delayMillis)
            throws InterruptedException
        Delays the current thread by the given duration. The delay is traced.
        Parameters:
        delayMillis - the time to sleep in milliseconds
        context - current context delayed
        Throws:
        InterruptedException - In case waiting is interrupted
      • runDelayed

        Future<?> runDelayed​(long delayMillis,
                             Runnable task)
                      throws Exception
        Runs a given task after a certain waiting time.
        Parameters:
        delayMillis - time to wait in milliseconds before running the given task
        task - operation to run
        Returns:
        A future that can be cancelled if the operation should no longer be run
        Throws:
        Exception
      • fallbackHandle

        Object fallbackHandle​(Class<? extends org.eclipse.microprofile.faulttolerance.FallbackHandler<?>> fallbackClass,
                              Throwable ex)
                       throws Exception
        Invokes the instance of the given FallbackHandler Class defined in the given context to handle the given Exception.
        Parameters:
        fallbackClass - the type of FallbackHandler to resolve or instantiate and use
        context - the currently processed context to use for arguments
        ex - the Exception thrown by the FT processing to handle by the FallbackHandler
        Returns:
        the result returned by the invoked FallbackHandler
        Throws:
        Exception - in case resolving, instantiating or invoking the handler method fails
      • fallbackInvoke

        Object fallbackInvoke​(Method fallbackMethod)
                       throws Exception
        Invokes the given fallback Method in the given context.
        Parameters:
        fallbackMethod - the Method to invoke
        context - the currently processed context to use for target instance and method arguments
        Returns:
        the result returned by the invoked fallback method
        Throws:
        Exception - in case invoking the method fails or the invoked method threw an Exception
      • trace

        void trace​(String method)
        Starts tracing the given context named with the given method label.
        Parameters:
        method - the label to use for the trace
        context - the currently processed context
      • endTrace

        void endTrace()
        Ends the innermost trace.