Object finalizer invoked only after shutdown

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Object finalizer invoked only after shutdown

Bruno Salzano
Hello,
i want to use the ObjectSpace.define_finalizer in a Class to do cleanup on object destruction.


Don't know if it's normal, but if in a CallController I use an istance of that class, the finalizer routine is invoked only after that AHN is shutdown.

Can someone explain me if it's normal?

Attached here the sample code and the log.

Bruno

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

test.rb (322 bytes) Download Attachment
log.txt (14K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Object finalizer invoked only after shutdown

Ben Langfeld-2
On 22 October 2015 at 16:27, Bruno Salzano <[hidden email]> wrote:
Hello,
i want to use the ObjectSpace.define_finalizer in a Class to do cleanup on object destruction.

Would you mind explaining why?
 
Don't know if it's normal, but if in a CallController I use an istance of that class, the finalizer routine is invoked only after that AHN is shutdown.

 
Can someone explain me if it's normal?

Attached here the sample code and the log.

Bruno

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Object finalizer invoked only after shutdown

Bruno Salzano
Hello Ben,
thankyou for your reply.

Il giorno giovedì 22 ottobre 2015 20:36:47 UTC+2, Ben Langfeld ha scritto:
On 22 October 2015 at 16:27, Bruno Salzano <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="oPz-NKREAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">d4rk...@...> wrote:
Hello,
i want to use the ObjectSpace.define_finalizer in a Class to do cleanup on object destruction.

Would you mind explaining why?

As said, to do cleanup. I've an object that do a connection to an external resource and i need to do cleanup when the object is disposed.
 
Don't know if it's normal, but if in a CallController I use an istance of that class, the finalizer routine is invoked only after that AHN is shutdown.

The reason is most likely this: <a href="http://www.mikeperham.com/2010/02/24/the-trouble-with-ruby-finalizers/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fwww.mikeperham.com%2F2010%2F02%2F24%2Fthe-trouble-with-ruby-finalizers%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFCmhu2igrNPi8cPp5gj1lrN3AqVw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\75http%3A%2F%2Fwww.mikeperham.com%2F2010%2F02%2F24%2Fthe-trouble-with-ruby-finalizers%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNFCmhu2igrNPi8cPp5gj1lrN3AqVw&#39;;return true;">http://www.mikeperham.com/2010/02/24/the-trouble-with-ruby-finalizers/

Oh, so "The problem is that Ruby finalizers are notoriously difficult to use properly so often times they aren’t actually run." :S

Many thankyou,
Bruno
 
Can someone explain me if it's normal?

Attached here the sample code and the log.

Bruno

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="oPz-NKREAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">adhearsion+...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.