Skip to content

Commit

Permalink
Race condition during shutdown of Quartz within JDBCJobStore's misfir…
Browse files Browse the repository at this point in the history
…e handling thread
  • Loading branch information
lahma committed May 16, 2011
1 parent 4fcec8a commit 22a250f
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/Quartz/Impl/AdoJobStore/JobStoreSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -591,14 +591,28 @@ public virtual void SchedulerStarted()
/// </summary>
public virtual void Shutdown()
{
if (clusterManagementThread != null)
if (misfireHandler != null)
{
clusterManagementThread.Shutdown();
misfireHandler.Shutdown();
try
{
misfireHandler.Join();
}
catch (ThreadInterruptedException)
{
}
}

if (misfireHandler != null)
if (clusterManagementThread != null)
{
misfireHandler.Shutdown();
clusterManagementThread.Shutdown();
try
{
clusterManagementThread.Join();
}
catch (ThreadInterruptedException)
{
}
}

try
Expand Down Expand Up @@ -3397,7 +3411,7 @@ protected object ExecuteInNonManagedTXLock(string lockName, Func<ConnectionAndTr
internal class ClusterManager : QuartzThread
{
private readonly JobStoreSupport jobStoreSupport;
private bool shutdown;
private volatile bool shutdown;
private int numFails;

internal ClusterManager(JobStoreSupport jobStoreSupport)
Expand Down Expand Up @@ -3487,7 +3501,7 @@ public override void Run()
internal class MisfireHandler : QuartzThread
{
private readonly JobStoreSupport jobStoreSupport;
private bool shutdown;
private volatile bool shutdown;
private int numFails;

internal MisfireHandler(JobStoreSupport jobStoreSupport)
Expand Down

0 comments on commit 22a250f

Please sign in to comment.