Class ScriptLifeCycle


  • @Component
    public class ScriptLifeCycle
    extends java.lang.Object

    A Life cycle finite state machine for script execution.

    Its role is to maintain execution states of scripts and interrupt them.

    A script can be in one the following states :
    • UNREGISTERED : when the script is not registered, it can't be interrupted. It is the initial state
    • REGISTERED : when its execution ID has been created, but the script is not started yet. If interruption is asked, an InterruptedException will be thrown when trying to enter STARTED state
    • STARTED : when the script has started. If interruption is asked, the thread will be interrupted if possible
    • DONE : when the script has terminated, it can't be interrupted any more.
     
         Possible transitions :
    
                                start()
               REGISTERED ---------------- STARTED
                 ^ |                          |
                 | | unregister()             | end()
      register() | |                          |
                 | v                          v
              UNREGISTERED ---------------- DONE
                              unregister()
     
     
    • Constructor Summary

      Constructors 
      Constructor Description
      ScriptLifeCycle()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void end​(java.lang.String executionId)  
      void register​(java.lang.String executionId)  
      void reset​(java.lang.String executionId)  
      void start​(java.lang.String executionId)  
      void tryAborting​(java.lang.String executionId)  
      void unregister​(java.lang.String executionId)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScriptLifeCycle

        public ScriptLifeCycle()
    • Method Detail

      • tryAborting

        public void tryAborting​(java.lang.String executionId)
      • register

        public void register​(java.lang.String executionId)
      • start

        public void start​(java.lang.String executionId)
                   throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • reset

        public void reset​(java.lang.String executionId)
                   throws java.lang.InterruptedException
        Throws:
        java.lang.InterruptedException
      • end

        public void end​(java.lang.String executionId)
      • unregister

        public void unregister​(java.lang.String executionId)