/// <summary> /// Reset the object state. This method will be called by the pool manager just before the /// object is being returned to the pool. /// </summary> internal bool ResetState() { if (!ValidateObject(PooledObjectValidationContext.Inbound(this))) { return(false); } if (OnResetState != null) { try { OnResetState(); } catch (Exception ex) { #if !NET35 if (Log.IsWarnEnabled()) { Log.WarnException("[ObjectPool] An unexpected error occurred while resetting state", ex); } #else System.Diagnostics.Debug.Assert(ex != null); // Placeholder to avoid warnings #endif return(false); } } return(true); }
/// <summary> /// Reset the object state. This method will be called by the pool manager just before the /// object is being returned to the pool. /// </summary> internal bool ResetState() { if (!ValidateObject(PooledObjectValidationContext.Inbound(this))) { return(false); } if (OnResetState != null) { try { OnResetState(); } catch (Exception ex) { if (Log.IsWarnEnabled()) { Log.WarnException("[ObjectPool] An unexpected error occurred while resetting state", ex); } return(false); } } return(true); }