Class Theater

    • Constructor Detail

      • Theater

        public Theater​(TheaterDef theaterDef)
      • Theater

        public Theater​(String name,
                       int parallelism,
                       Schedule schedule)
      • Theater

        public Theater​(String name,
                       int parallelism)
      • Theater

        public Theater​(String name)
      • Theater

        public Theater​(int parallelism,
                       Schedule schedule)
      • Theater

        public Theater​(int parallelism)
      • Theater

        public Theater​(Schedule schedule)
      • Theater

        public Theater()
    • Method Detail

      • name

        public final String name()
      • parallelism

        public final int parallelism()
      • schedule

        public final Schedule schedule()
      • setSchedule

        public void setSchedule​(Schedule schedule)
      • start

        public void start()
        Ensures that this Theater is up and running.
        Specified by:
        start in interface MainStage
        Throws:
        IllegalStateException - if this Theater has been stopped.
      • stop

        public void stop()
        Ensures that this Theater has been permanently stopped, shutting down the thread pool, if it's currently running. Upon return, this Theater is guaranteed to be in the stopped state.
        Specified by:
        stop in interface MainStage
      • execute

        public void execute​(Runnable runnable)
        Description copied from interface: Stage
        Schedules a runnable for concurrent execution.
        Specified by:
        execute in interface Executor
        Specified by:
        execute in interface Stage
      • task

        public TaskRef task​(TaskFunction task)
        Description copied from interface: Stage
        Returns an uncued TaskRef bound to the task, which can later be used to cue the task.
        Specified by:
        task in interface Stage
      • call

        public <T> Call<T> call​(Cont<T> cont)
        Description copied from interface: Stage
        Returns a Call that completes the continuation.
        Specified by:
        call in interface Stage
      • timer

        public TimerRef timer​(TimerFunction timer)
        Description copied from interface: Schedule
        Returns an unscheduled TimerRef bound to timer, which can later be used to schedule timer.
        Specified by:
        timer in interface Schedule
      • setTimer

        public TimerRef setTimer​(long millis,
                                 TimerFunction timer)
        Description copied from interface: Schedule
        Schedules timer to execute after millis milliseconds have elapsed. Returns a TimerRef that can be used to check the status of, reschedule, and cancel timer.
        Specified by:
        setTimer in interface Schedule
      • didStart

        protected void didStart()
        Lifecycle callback invoked before the thread pool starts up.
      • didStop

        protected void didStop()
        Lifecycle callback invoked after the thread pool shuts down.
      • didFail

        protected void didFail​(Throwable error)
        Lifecycle callback invoked if this Theater encounters an internal error.
      • taskWillCue

        protected void taskWillCue​(TaskFunction task)
        Introspection callback invoked before a task is cued for execution.
      • taskDidCancel

        protected void taskDidCancel​(TaskFunction task)
        Introspection callback invoked after a cued task is canceled.
      • taskWillRun

        protected void taskWillRun​(TaskFunction task)
        Introspection callback invoked immediately before task.runTask() is executed.
      • taskDidRun

        protected void taskDidRun​(TaskFunction task)
        Introspection callback invoked immediately after task.runTask() returns nominally.
      • taskDidFail

        protected void taskDidFail​(TaskFunction task,
                                   Throwable error)
        Introspection callback invoked immediately after task.runTask() fails by throwing an error.
      • callWillCue

        protected void callWillCue​(Cont<?> cont)
        Introspection callback invoked before a cont call is cued for execution.
      • callWillBind

        protected <T> void callWillBind​(Cont<T> cont,
                                        T value)
        Introspection callback invoked immediately before a call to cont.bind(value).
      • callDidBind

        protected <T> void callDidBind​(Cont<?> cont,
                                       T value)
        Introspection callback invoked immediately after a call to cont.bind(value) returns nominally.
      • callWillTrap

        protected void callWillTrap​(Cont<?> cont,
                                    Throwable error)
        Introspection callback invoked immediately before a call to cont.trap(error).
      • callDidTrap

        protected void callDidTrap​(Cont<?> cont,
                                   Throwable error)
        Introspection callback invoked immediately after a call to cont.trap(error) returns nominally.
      • callDidFail

        protected void callDidFail​(Cont<?> cont,
                                   Throwable error)
        Introspection callback invoked immediately after a call to cont.bind(T) fails by throwing an error.