/// <exception cref="System.IO.IOException"/> protected internal static bool DeletePath(CleanupQueue.PathDeletionContext context ) { context.EnablePathForCleanup(); if (Log.IsDebugEnabled()) { Log.Debug("Trying to delete " + context.fullPath); } if (context.fs.Exists(new Path(context.fullPath))) { return(context.fs.Delete(new Path(context.fullPath), true)); } return(true); }
public override void Run() { if (Log.IsDebugEnabled()) { Log.Debug(GetName() + " started."); } CleanupQueue.PathDeletionContext context = null; while (true) { try { context = queue.Take(); // delete the path. if (!DeletePath(context)) { Log.Warn("CleanupThread:Unable to delete path " + context.fullPath); } else { if (Log.IsDebugEnabled()) { Log.Debug("DELETED " + context.fullPath); } } } catch (Exception) { Log.Warn("Interrupted deletion of " + context.fullPath); return; } catch (Exception e) { Log.Warn("Error deleting path " + context.fullPath + ": " + e); } } }