-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avm is initialized in a single place #1050
Conversation
@@ -82,6 +82,7 @@ public static void main(String args[]) { | |||
|
|||
ReturnType ret = new Cli().call(args, cfg); | |||
if (ret != ReturnType.RUN) { | |||
shutdownAvm(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can call System.exit
from other parts of the code. Perhaps a better place for the AVM shutdown would be in the ShutdownHook
thread defined below (around line 350).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shutdownAvm
call is in the ShutdownHook
, but that hook has not been registered at this point, so I had to include it also for a few of the early returns we make
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally we register the hook first thing and it just knows whether a component has been started/loaded and how to shut it down if so, but as it stands that's one of the last things we run in the main method because we wait for everything to be started up first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Looks good to me.
afad7dc
to
b4646d1
Compare
- We had a problem where the avm was being initialized in multiple places for different CLI arguments, and was even not being initialized at times it should be. This change fixes these issues by initializing the avm in a single place that all CLI variations have to pass through. - This required gaining control over when we want the avm initialized in the CLI call path so that tests could run against these changes and not trip up over trying to re-initialize the avm.
- We can get into legitimate situations where we try to shut down the avm but we do not actually own the lock. In that case an exception is thrown when we try to release this. This fix just ensures that we only release it if we are the owner of the lock.
for different CLI arguments, and was even not being initialized at times
it should be. This change fixes these issues by initializing the avm in
a single place that all CLI variations have to pass through.
lock before calling release on it first.
Description
Fixes Issue # .
Type of change
Testing