Class VilExecutionThread

  • All Implemented Interfaces:
    java.lang.Runnable

    public class VilExecutionThread
    extends java.lang.Object
    implements java.lang.Runnable
    Responsible class for the execution of VIL scripts, i.e., instantiation of product line artifacts. Runs the VIL execution in an own thread. Usage:
    1. Create new thread (one per PLPInfo object, should be called by the PLPInfo):
      vilExecutor = new VilExecutionThread(this);
    2. Register listener to get informed when the instantiation is finished/aborted:
      vilExecutor.addListener(newListener);
    3. Start the instantiation:
      vilExecutor.startInstantiation(observer);
    4. Abort the instantiation if necessary, e.g. in an endless loop:
      vilExecutor.abortInstantiation(observer);
    Author:
    El-Sharkawy
    • Field Detail

      • executor

        private net.ssehub.easy.instantiation.core.model.execution.Executor executor
      • observer

        private net.ssehub.easy.basics.progress.ProgressObserver observer
      • successful

        private boolean successful
    • Constructor Detail

      • VilExecutionThread

        public VilExecutionThread​(PLPInfo plp)
        Creates a new VIL execution thread for the given PLPInfo, but will not start the instantiation.
        Parameters:
        plp - The PLPInfo, which may be instantiated (must not be null).
    • Method Detail

      • createExecutor

        protected net.ssehub.easy.instantiation.core.model.execution.Executor createExecutor()
        Creates a VIL executor for the contained PLP.
        Returns:
        the created executor
      • startInstantiation

        public void startInstantiation​(net.ssehub.easy.basics.progress.ProgressObserver observer,
                                       boolean waitFor)
        Starts the execution of the underlying VIL script (PLPInfo.getBuildScript()) in an own thread.
        Parameters:
        observer - The observer to inform about the current progress (in case of null ProgressObserver.NO_OBSERVER will be used).
        waitFor - true This method will wait until the script was processed completely (blocking method), false script will be processed in an asynchronous manner (usually used in an GUI environment).
        See Also:
        abortInstantiation()
      • abortInstantiation

        public void abortInstantiation()
        Aborts the current execution of the VIL script at the next possible point (that is not any time possible, e.g., during the execution of third party tools like embedded maven scripts).
        See Also:
        #startInstantiation(ProgressObserver)
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable