Refactor new Services for thread safety, plus unit tests. Not all services are updated to be correct, only the

ContentService, the rest need to be updated as well.
This commit is contained in:
Shannon Deminick
2012-12-11 12:03:36 +05:00
parent aeab577627
commit feff68ada8
49 changed files with 987 additions and 490 deletions

View File

@@ -421,13 +421,15 @@ namespace Umbraco.Web
app.EndRequest += (sender, args) =>
{
var httpContext = ((HttpApplication)sender).Context;
var httpContext = ((HttpApplication)sender).Context;
if (UmbracoContext.Current != null && UmbracoContext.Current.IsFrontEndUmbracoRequest)
{
//write the trace output for diagnostics at the end of the request
httpContext.Trace.Write("UmbracoModule", "Umbraco request completed");
LogHelper.Debug<UmbracoModule>("Total milliseconds for umbraco request to process: " + DateTime.Now.Subtract(UmbracoContext.Current.ObjectCreated).TotalMilliseconds);
}
}
DisposeHttpContextItems(httpContext);
};
}
@@ -438,5 +440,16 @@ namespace Umbraco.Web
#endregion
/// <summary>
/// Any object that is in the HttpContext.Items collection that is IDisposable will get disposed on the end of the request
/// </summary>
/// <param name="http"></param>
private static void DisposeHttpContextItems(HttpContext http)
{
foreach(var i in http.Items)
{
i.DisposeIfDisposable();
}
}
}
}