protected virtual void Stop(Exception ex)
{
if (ex != null)
{
Faulted(ex);
}
if (_notificationState != NotificationState.Disabled)
{
try
{
Trace.TraceVerbose("{0}Stopping SQL notification listener", TracePrefix);
SqlDependency.Stop(ConnectionString);
Trace.TraceVerbose("{0}SQL notification listener stopped", TracePrefix);
}
catch (Exception stopEx)
{
Trace.TraceError("{0}Error occurred while stopping SQL notification listener: {1}", TracePrefix, stopEx);
}
}
lock (_stopLocker)
{
if (_disposing)
{
_stopHandle.Set();
}
}
}