All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jadex.bpmn.runtime.handler.EventEndTerminateActivityHandler Maven / Gradle / Ivy

Go to download

The Jadex BPMN kernel provides a workflow kernel for the standardized business process modeling notation. The kernel relies on annotated BPMN diagrams, which include detailed execution information.

There is a newer version: 4.0.267
Show newest version
package jadex.bpmn.runtime.handler;

import jadex.bpmn.model.MActivity;
import jadex.bpmn.runtime.ProcessThread;
import jadex.bridge.IInternalAccess;

/**
 *  On error end propagate an exception.
 */
public class EventEndTerminateActivityHandler extends DefaultActivityHandler
{
	/**
	 *  Execute the activity.
	 */
	protected void doExecute(MActivity activity, IInternalAccess instance, ProcessThread thread)
	{
		// Top level event -> kill the component.
		if(thread.getParent().getParent()==null)	// Check that parent thread is top thread.
		{
			instance.killComponent();
		}
		
		// Internal subprocess -> terminate all threads in context, except own thread (which is terminated after interpreter step).
		else
		{
//			for(ProcessThread pt: thread.getThreadContext().getThreads().toArray(new ProcessThread[thread.getThreadContext().getThreads().size()]))
			for(ProcessThread pt: thread.getParent().getSubthreads().toArray(new ProcessThread[thread.getParent().getSubthreads().size()]))
			{
				if(pt!=thread)
				{
					thread.getParent().removeThread(pt);
				}
			}
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy