I am executing parallel workflow actions(Any one task as one action) via windows service created using .NET 4.5 C# and QUARTZ 2.3.3.When end user pause workflow execution then trying to kill that current running workflow using Quartz Interrupt method which has below implementation but thread not killing.Even not getting any exception.Simply Interrupt fails here.
private void KillTheThread()
{
try
{
_logger.Info(" Error : Thread is going to Abort"+ _currentThread.ManagedThreadId + " at:"+DateTime.Now);
if(_CancellationTokenSource != null)
{
_CancellationTokenSource.Cancel();
}
_currentThread.Abort();
Thread.Sleep(500);
_logger.Info(" Error : Workflow is aborted:"+ _workflowName+" at:"+DateTime.Now);
_logger.Info(" Error : Thread current state is "+ _currentThread.ThreadState.ToString()+" at:"+DateTime.Now);
_currentThread = null;
return;
}
catch (ThreadAbortException exc)
{
if (exc.InnerException!=null)
_logger.Info(" ************Error : InnerException occured in KillTheThread: " + exc.InnerException);
else
_logger.Info(" ************Error : Exception occured in KillTheThread: " + exc.Message);
}
}
I tried to reattempt killing thread for minimum 3 times but still no success.
Any help/clue will be appreciated….
user3201546 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1