Re: [Ikvm-developers] Register a shutdown Hook in WCF
Brought to you by:
jfrijters
|
From: Volker B. <vb...@in...> - 2017-04-18 10:03:52
|
Hi Jeroen,
Your knowledge of .NET is an impressive one.
I have add the follow code and its work:
static Service1() {
AppDomain.CurrentDomain.DomainUnload += new
EventHandler(domain_DomainUnload);
}
static void domain_DomainUnload(object sender, EventArgs e)
{
java.lang.Class clazz =
java.lang.Class.forName("java.lang.Shutdown");
java.lang.reflect.Method shutdown =
clazz.getDeclaredMethod("shutdown");
shutdown.setAccessible(true);
shutdown.invoke(null);
}
The shutdown hook is needed to delete temp files that the Java VM has
created self. Else the temp directory will be filled more and more.
Can I add this hook to the IKVM or want you do it self?
Volker
Am 14.04.2017 um 06:59 schrieb Jeroen Frijters:
> Hi Volker,
>
> If at all possible, it would be better to avoid shutdown hooks, but calling Shutdown.shutdown() via reflection is a good workaround.
>
> It might be possible to improve this on the IKVM side by also trying to hook the AppDomain.DomainUnload event. My guess is that the WCF service runs in a secondary AppDomain.
>
> Regards,
> Jeroen
>
>> -----Original Message-----
>> From: Volker Berlin [mailto:vb...@in...]
>> Sent: Thursday, April 13, 2017 15:25
>> To: IKVM List <ikv...@li...>
>> Subject: [Ikvm-developers] Register a shutdown Hook in WCF
>>
>> Hi Jeroen,
>>
>> It look like that an exit of an WCF service does not call the shutdown
>> hooks. What is the best what I can call on shutdown? Should I call
>> java.lang.Shutdown.shutdown() via reflection or is there a simpler
>> solution?
>>
>> http://stackoverflow.com/questions/11769673/performing-action-before-
>> wcf-service-is-shutdown
>>
>> Volker
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>> ------
>> Check out the vibrant tech community on one of the world's most engaging
>> tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Ikvm-developers mailing list
>> Ikv...@li...
>> https://lists.sourceforge.net/lists/listinfo/ikvm-developers
|