Skip to content
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

Payara Micro can't be stopped and restarted in the same process #588

Closed
smillidge opened this issue Jan 4, 2016 · 4 comments
Closed

Payara Micro can't be stopped and restarted in the same process #588

smillidge opened this issue Jan 4, 2016 · 4 comments

Comments

@smillidge
Copy link
Contributor

Bootstrapping Payara Micro, stopping it then boot strapping it again results in

java.lang.IllegalStateException: Payara Micro is already running, calling bootstrap now is meaningless
@abhirockzz
Copy link

There are 2 scenarios here

(1) Invoking PayaraMicro.getInstance().shutdown() - this would give you a BootstrapException with a ‘Already bootstrapped’ message. The actual source is the following - https://github.com/payara/Payara/blob/8a403bf75d3734e564a9fb95d60498987cc4287e/nucleus/common/simple-glassfish-api/src/main/java/org/glassfish/embeddable/GlassFishRuntime.java

Upon further examination, I found the that calling Glassfish.dispose (from shutdown method in PayaraMicroRuntime does not suffice). Calling GlassFishRuntime.shutdown() internally calls dispose on the GlassFish instance. Currently, the instance of GlassFishRuntime is encapsulated within the PayaraMicro class and is not available to PayaraMicroRuntime which hinders a clean shutdown.

(2) Calling a shutdown on PayaraMicroRuntime instance which is obtained using PayaraMicro.getInstance().bootStrap() [This prompts the exception which Stevel mentioned]

The GlassFish instance (‘runtime’ variable in the PayaraMicro) needs to be set to null after the completion of shutdown method. This will clear the exception mentioned in the issue

I think that the capability of being able to invoke shutdown in more than one way might cause issues. It should have been encapsulated within one class and exposed publicly. Thoughts ?

@smillidge
Copy link
Contributor Author

Thanks abhi for the analysis. Do you fancy putting together a pull request ;-)

@abhirockzz
Copy link

Sure. Let me try and look into this further

@smillidge
Copy link
Contributor Author

Thanks that would be awesome. You will need to sign a CLA though see https://github.com/payara/Payara/blob/master/Contributing.md

smillidge added a commit that referenced this issue Jan 13, 2016
Pandrex247 added a commit that referenced this issue Aug 30, 2022
FISH-6269 FISH-6195 FISH-6240 FISH-6254 Upgrade tool 1.4
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

No branches or pull requests

2 participants