Skip to content

Enhanced exit blocks#6133

Merged
headius merged 3 commits intojruby:masterfrom
headius:enhanced_exit_blocks
Mar 24, 2020
Merged

Enhanced exit blocks#6133
headius merged 3 commits intojruby:masterfrom
headius:enhanced_exit_blocks

Conversation

@headius
Copy link
Member

@headius headius commented Mar 24, 2020

This adds the ability to register an exit hook from Java using a simple function object. It also switches the Timeout library from using at_exit to using this API for executor shutdown.

See #6127 which, due to the lack of such an API, was forced to dig around in JRuby internals from Ruby code.

There may be other places where this could be used but I did not audit other at_exit consumers.

headius added 2 commits March 23, 2020 21:31
See jruby#6127 for a case that needed to be able to add exit hooks from
Java, to shut down the executor associated with the Timeout
library.
Replaces Ruby-based internals tweaking from jruby#6127.
@kares
Copy link
Member

kares commented Mar 24, 2020

👍 somehow the name confused me pushExitFunction evoked a FIFO order assumption.
maybe addExitFunction sounds clearer but not strong feelings about naming ...

@headius
Copy link
Member Author

headius commented Mar 24, 2020

I went with that name mostly because we already had pushExitProc and it seemed to make sense that way. push fits FILO ordering to me as well because it implies a stack, no?

* Allow adding at_exit hooks while running at_exit hooks
* Adopt new exit error code from exit-within-at_exit
* Set exit code to 1 if errors during at_exit
* Split up catch block to use real exception types rather than
  type checks
@headius headius merged commit 1656176 into jruby:master Mar 24, 2020
@headius headius deleted the enhanced_exit_blocks branch March 24, 2020 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants