Class AsyncExecutor


  • public class AsyncExecutor
    extends Object
    The AsyncExecutor class is the singleton class that executes the controllers. It contains the execute method.
    • Field Detail

      • ANIMATION

        private static final String[] ANIMATION
        The ANIMATION field is the animation of the loading thread.
      • ANIMATION_INTERVAL

        private static final int ANIMATION_INTERVAL
        The ANIMATION_INTERVAL field is the interval between two frames of the animation.
        See Also:
        Constant Field Values
      • instance

        private static AsyncExecutor instance
        The instance field is the instance of the AsyncExecutor class.
      • loadingThread

        private Thread loadingThread
        The loadingThread field is the thread that prints the animation of the loading.
      • startTime

        private long startTime
        The startTime field is the start time of the loading thread.
    • Constructor Detail

      • AsyncExecutor

        private AsyncExecutor()
        The AsyncExecutor constructor. It sets the animation of the loading thread.
    • Method Detail

      • getInstance

        public static AsyncExecutor getInstance()
        The getInstance method returns the instance of the AsyncExecutor class.
        Returns:
        the instance of the AsyncExecutor class
      • abort

        private void abort​(Exception e)
        The abort method aborts the loading thread. Find the cause of the exception and throw a RuntimeException.
        Parameters:
        e - the exception
      • execute

        public void execute​(Supplier<Either<Failure,​Success>> supplier,
                            String name)
        The execute method executes a function.
        Parameters:
        supplier - the function to be executed
        name - the name of the function
      • getLoadingThread

        private Thread getLoadingThread()
        The getLoadingThread method returns the loading thread.
        Returns:
        the loading thread
      • getLoadingTime

        private String getLoadingTime()
        The getLoadingTime method returns the loading time as string.
        Returns:
        the loading time