Skip to content

Commit

Permalink
Error handling when we can't unload the remote app domain
Browse files Browse the repository at this point in the history
  • Loading branch information
ayende committed Oct 21, 2009
1 parent 7171bb2 commit 1ad4c9c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Rhino.ServiceBus/Hosting/RemoteAppDomainHost.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
using log4net;

namespace Rhino.ServiceBus.Hosting
{
Expand Down Expand Up @@ -109,6 +110,7 @@ protected class HostedService
private readonly IApplicationHost hoster;
private readonly string assembly;
private readonly AppDomain appDomain;
private readonly ILog log = LogManager.GetLogger(typeof (HostedService));

public HostedService(IApplicationHost hoster, string assembly, AppDomain appDomain)
{
Expand All @@ -120,7 +122,15 @@ public HostedService(IApplicationHost hoster, string assembly, AppDomain appDoma
public void Stop()
{
hoster.Dispose();
AppDomain.Unload(appDomain);
try
{
AppDomain.Unload(appDomain);
}
catch (Exception e)
{
log.Error(
"Could not unload app domain, it is likely that there is a running thread that could not be aborted", e);
}
}

public void Start()
Expand Down

0 comments on commit 1ad4c9c

Please sign in to comment.