org.jruby.Ruby.tearDown()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(5.8k)|赞(0)|评价(0)|浏览(192)

本文整理了Java中org.jruby.Ruby.tearDown方法的一些代码示例,展示了Ruby.tearDown的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.tearDown方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:tearDown

Ruby.tearDown介绍

[英]Make sure Kernel#at_exit procs get invoked on runtime shutdown. This method needs to be explicitly called to work properly. I thought about using finalize(), but that did not work and I am not sure the runtime will be at a state to run procs by the time Ruby is going away. This method can contain any other things that need to be cleaned up at shutdown.
[中]确保在运行时关闭时调用内核#at_exit procs。需要显式调用此方法才能正常工作。我曾考虑过使用finalize(),但这不起作用,而且我不确定Ruby离开时运行时是否处于运行procs的状态。此方法可以包含在关机时需要清理的任何其他内容。

代码示例

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

  1. /**
  2. * Make sure Kernel#at_exit procs get invoked on runtime shutdown.
  3. * This method needs to be explicitly called to work properly.
  4. * I thought about using finalize(), but that did not work and I
  5. * am not sure the runtime will be at a state to run procs by the
  6. * time Ruby is going away. This method can contain any other
  7. * things that need to be cleaned up at shutdown.
  8. */
  9. public void tearDown() {
  10. tearDown(true);
  11. }

代码示例来源:origin: org.jruby/jruby-core

  1. /**
  2. * Dispose of the runtime you initialized.
  3. *
  4. * @param runtime to be disposed of
  5. */
  6. public static void terminate(Ruby runtime) {
  7. runtime.tearDown();
  8. }

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

  1. /**
  2. * Make sure Kernel#at_exit procs get invoked on runtime shutdown.
  3. * This method needs to be explicitly called to work properly.
  4. * I thought about using finalize(), but that did not work and I
  5. * am not sure the runtime will be at a state to run procs by the
  6. * time Ruby is going away. This method can contain any other
  7. * things that need to be cleaned up at shutdown.
  8. */
  9. public void tearDown() {
  10. tearDown(true);
  11. }

代码示例来源:origin: org.jruby/jruby-complete

  1. /**
  2. * Dispose of the runtime you initialized.
  3. *
  4. * @param runtime to be disposed of
  5. */
  6. public static void terminate(Ruby runtime) {
  7. runtime.tearDown();
  8. }

代码示例来源:origin: org.jruby/jruby-complete

  1. /**
  2. * Make sure Kernel#at_exit procs getService invoked on runtime shutdown.
  3. * This method needs to be explicitly called to work properly.
  4. * I thought about using finalize(), but that did not work and I
  5. * am not sure the runtime will be at a state to run procs by the
  6. * time Ruby is going away. This method can contain any other
  7. * things that need to be cleaned up at shutdown.
  8. */
  9. public void tearDown() {
  10. tearDown(true);
  11. }

代码示例来源:origin: asciidoctor/asciidoctorj

  1. @Override
  2. public void shutdown() {
  3. this.rubyRuntime.tearDown();
  4. }

代码示例来源:origin: org.jruby/jruby-core

  1. /**
  2. * Make sure Kernel#at_exit procs getService invoked on runtime shutdown.
  3. * This method needs to be explicitly called to work properly.
  4. * I thought about using finalize(), but that did not work and I
  5. * am not sure the runtime will be at a state to run procs by the
  6. * time Ruby is going away. This method can contain any other
  7. * things that need to be cleaned up at shutdown.
  8. */
  9. public void tearDown() {
  10. tearDown(true);
  11. }

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

  1. /**
  2. * Dispose of the runtime you initialized.
  3. *
  4. * @param runtime to be disposed of
  5. */
  6. public static void terminate(Ruby runtime) {
  7. runtime.tearDown();
  8. }

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

  1. /**
  2. * Dispose of the runtime you initialized.
  3. *
  4. * @param runtime to be disposed of
  5. */
  6. public static void terminate(Ruby runtime) {
  7. runtime.tearDown();
  8. }

代码示例来源:origin: org.jruby.rack/jruby-rack

  1. @Override
  2. public void destroy() {
  3. runtime.tearDown(false);
  4. }

代码示例来源:origin: org.asciidoctor/asciidoctorj

  1. @Override
  2. public void shutdown() {
  3. this.rubyRuntime.tearDown();
  4. }

代码示例来源:origin: org.jruby/jruby-complete

  1. public void run() {
  2. if (didTeardown.compareAndSet(false, true)) {
  3. runtime.tearDown();
  4. }
  5. }
  6. });

代码示例来源:origin: org.jruby/jruby-core

  1. public void run() {
  2. if (didTeardown.compareAndSet(false, true)) {
  3. runtime.tearDown();
  4. }
  5. }
  6. });

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

  1. public void run() {
  2. if (didTeardown.compareAndSet(false, true)) {
  3. runtime.tearDown();
  4. }
  5. }
  6. });

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

  1. public void run() {
  2. if (didTeardown.compareAndSet(false, true)) {
  3. runtime.tearDown();
  4. }
  5. }
  6. });

代码示例来源:origin: twineworks/ruby-for-pentaho-kettle

  1. private void forceStopRubyThreads() {
  2. // if the container is disposed already, bail out
  3. if (data.container == null) return;
  4. // try to kill all threads once
  5. if (!data.forcedHalt) {
  6. data.forcedHalt = true;
  7. } else {
  8. return;
  9. }
  10. if (data.runtime != null) {
  11. RubyThread[] threads = data.runtime.getThreadService().getActiveRubyThreads();
  12. for (int i = 0; i < threads.length; i++) {
  13. try {
  14. threads[i].kill();
  15. } catch (ThreadKill e) {
  16. }
  17. }
  18. data.runtime.tearDown();
  19. }
  20. }

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

  1. /**
  2. * Cleanly shut down this ScriptingContainer and any JRuby resources it holds.
  3. * All ScriptingContainer instances should be terminated when you are done with
  4. * them, rather then leaving them for GC to finalize.
  5. *
  6. * @since JRuby 1.5.0
  7. */
  8. public void terminate() {
  9. if (getProvider().isRuntimeInitialized()) getProvider().getRuntime().tearDown(false);
  10. getProvider().terminate();
  11. }

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

  1. /**
  2. * Cleanly shut down this ScriptingContainer and any JRuby resources it holds.
  3. * All ScriptingContainer instances should be terminated when you are done with
  4. * them, rather then leaving them for GC to finalize.
  5. *
  6. * @since JRuby 1.5.0
  7. */
  8. public void terminate() {
  9. if (getProvider().isRuntimeInitialized()) getProvider().getRuntime().tearDown(false);
  10. getProvider().terminate();
  11. }

代码示例来源:origin: org.jruby/jruby-complete

  1. /**
  2. * Cleanly shut down this ScriptingContainer and any JRuby resources it holds.
  3. * All ScriptingContainer instances should be terminated when you are done with
  4. * them, rather then leaving them for GC to finalize.
  5. *
  6. * @since JRuby 1.5.0
  7. */
  8. public void terminate() {
  9. LocalContextProvider provider = getProvider();
  10. if (provider.isRuntimeInitialized()) {
  11. provider.getRuntime().tearDown(false);
  12. provider.getRuntime().releaseClassLoader();
  13. }
  14. provider.terminate();
  15. }

代码示例来源:origin: org.jruby/jruby-core

  1. /**
  2. * Cleanly shut down this ScriptingContainer and any JRuby resources it holds.
  3. * All ScriptingContainer instances should be terminated when you are done with
  4. * them, rather then leaving them for GC to finalize.
  5. *
  6. * @since JRuby 1.5.0
  7. */
  8. public void terminate() {
  9. LocalContextProvider provider = getProvider();
  10. if (provider.isRuntimeInitialized()) {
  11. provider.getRuntime().tearDown(false);
  12. provider.getRuntime().releaseClassLoader();
  13. }
  14. provider.terminate();
  15. }

相关文章

Ruby类方法