Class VilExecutionThread
- java.lang.Object
-
- net.ssehub.easy.producer.core.mgmt.VilExecutionThread
-
- All Implemented Interfaces:
java.lang.Runnable
public class VilExecutionThread extends java.lang.Object implements java.lang.RunnableResponsible class for the execution of VIL scripts, i.e., instantiation of product line artifacts. Runs the VIL execution in an own thread. Usage:- Create new thread (one per
PLPInfoobject, should be called by the PLPInfo):
vilExecutor = new VilExecutionThread(this); - Register listener to get informed when the instantiation is finished/aborted:
vilExecutor.addListener(newListener); - Start the instantiation:
vilExecutor.startInstantiation(observer); - Abort the instantiation if necessary, e.g. in an endless loop:
vilExecutor.abortInstantiation(observer);
- Author:
- El-Sharkawy
-
-
Field Summary
Fields Modifier and Type Field Description private Executorexecutorprivate java.util.List<IVilExecutionListener>listenersprivate ProgressObserverobserverprivate PLPInfoplpprivate booleansuccessful
-
Constructor Summary
Constructors Constructor Description VilExecutionThread(PLPInfo plp)Creates a new VIL execution thread for the givenPLPInfo, but will not start the instantiation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortInstantiation()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).voidaddListener(IVilExecutionListener listener)Adds a newIVilExecutionListenerto get informed when the instantiation was finished/aborted.protected ExecutorcreateExecutor()Creates a VIL executor for the contained PLP.voidremoveListener(IVilExecutionListener listener)Removes anIVilExecutionListener.voidrun()voidstartInstantiation(ProgressObserver observer, boolean waitFor)Starts the execution of the underlying VIL script (PLPInfo.getBuildScript()) in an own thread.
-
-
-
Field Detail
-
executor
private Executor executor
-
plp
private PLPInfo plp
-
observer
private ProgressObserver observer
-
successful
private boolean successful
-
listeners
private java.util.List<IVilExecutionListener> listeners
-
-
Method Detail
-
createExecutor
protected Executor createExecutor()
Creates a VIL executor for the contained PLP.- Returns:
- the created executor
-
addListener
public void addListener(IVilExecutionListener listener)
Adds a newIVilExecutionListenerto get informed when the instantiation was finished/aborted.- Parameters:
listener- The listener to be informed.- See Also:
removeListener(IVilExecutionListener)
-
removeListener
public void removeListener(IVilExecutionListener listener)
Removes anIVilExecutionListener.- Parameters:
listener- The old listener, to be removed.- See Also:
addListener(IVilExecutionListener)
-
startInstantiation
public void startInstantiation(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 nullProgressObserver.NO_OBSERVERwill 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:
runin interfacejava.lang.Runnable
-
-