滑轨的关闭钩

编程入门 行业动态 更新时间:2024-10-28 09:22:58
本文介绍了滑轨的关闭钩的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在Rails关闭时运行一些清理代码-可能吗?我的情况是,我在后台有一些线程(我正在使用jruby并调用java)在整个进程的生命周期中都存在,我需要让他们知道关闭自己的线程

I'd like to have some cleanup code run when Rails is shutting down - is that possible? My situation is that I have a few threads in the background (I'm using jruby and calling into java) that live for the life of the process and I need to let them know to shut themselves down

谢谢!

推荐答案

可能应该只使用Ruby退出处理程序,这是一个内核方法:

Probably should just use the Ruby exit handler, which is a Kernel method:

$ irb >> at_exit do ?> puts 'bye...' >> end => #<Proc:0xb79a87e4@(irb):1> >> exit bye... $

更多推荐

滑轨的关闭钩

本文发布于:2023-08-07 14:59:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1319746.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:滑轨

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!