private void AbortRequest( object state ) { long? lrid = null; try { LocationRequest locReq = ( LocationRequest ) state; lrid = locReq.Lrid; LocationRequest.ErrorHandlingLog.InfoFormat( "Starting AbortRequest for lrid {0}...", lrid ); Statistics.AddTimedOutEvent( locReq.ForeignId.Type ); Statistics.AddRequestErrorEvent( locReq.ForeignId.Type ); // SafelyAbortRequest can hang up, this happened before. Looks like nothing can be done with that, // but at least it should be detected. For this, use QueuedAborts and check it periodically. AbortStat abortStat; lock ( this.queuedAborts ) { abortStat = new AbortStat( ); this.queuedAborts.Add( lrid.Value, abortStat ); } locReq.SafelyAbortRequest( abortStat ); LocationRequest.ErrorHandlingLog.InfoFormat( "AbortRequest finished for lrid {0}", lrid ); } catch ( Exception exc ) { LocationRequest.ErrorHandlingLog.ErrorFormat( "AbortRequest error for lrid {0}: {1}", lrid, exc ); } finally { if ( lrid.HasValue ) { lock ( this.queuedAborts ) { this.queuedAborts.Remove( lrid.Value ); } } } }
public override void SafelyAbortRequest( AbortStat abortStat ) { throw new NotImplementedException( ); }
/// <summary>Implementation should not throw an error, just /// fill <see cref="AbortStat"/> fields if needed.</summary> /// <param name="abortStat"></param> public abstract void SafelyAbortRequest( AbortStat abortStat );