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

Fixes #5498 ServletHolder cleanup #5514

Merged
merged 8 commits into from
Oct 28, 2020

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Oct 26, 2020

Various cleanups for #5498 including:

  • renaming multiple _servlet fields in inner classes to avoid confusion
  • better comments in prepare method to describe why it is needed
  • call prepare from Invoker servlet
  • The _servlet field is not set until after the servlet is initialized
  • Consistent wrapping of SingleThreadedWrapper now in initServlet
  • The getServlet method now looks the volatile _servlet to avoid locking if possible
  • The handle method now calls getServletInstance as servlet will have been initialized in prepare

Various cleanups including:
 + renaming multiple `_servlet` fields in inner classes to avoid confusion
 + better comments in prepare method to describe why it is needed
 + call prepare from Invoker servlet
 + The `_servlet` field is not set until after the servlet is initialized
 + Consistent wrapping of `SingleThreadedWrapper` now in `initServlet`
 + The `getServlet` method now looks the volatile `_servlet` to avoid locking if possible
 + The `handle` method now calls `getServletInstance` as servlet will have been initialized in `prepare`
@gregw gregw requested review from joakime and janbartel and removed request for joakime October 26, 2020 13:39
Various cleanups including:
 + renaming multiple `_servlet` fields in inner classes to avoid confusion
 + better comments in prepare method to describe why it is needed
 + call prepare from Invoker servlet
 + The `_servlet` field is not set until after the servlet is initialized
 + Consistent wrapping of `SingleThreadedWrapper` now in `initServlet`
 + The `getServlet` method now looks the volatile `_servlet` to avoid locking if possible
 + The `handle` method now calls `getServletInstance` as servlet will have been initialized in `prepare`
 + Found and fixed race with making unavaiable servlet available again
@gregw gregw requested review from joakime and lorban October 26, 2020 14:38
@gregw
Copy link
Contributor Author

gregw commented Oct 27, 2020

@joakime @janbartel @lorban nudge

Copy link
Contributor

@lorban lorban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your changes look alright, but I found an unrelated bug caused by a mis-use of System.nanoTime().

 + fixed nanotime overflow
 + fixed several compiler warnings/suggestions
 + removed while true from unavailable servlet
@gregw gregw requested a review from janbartel October 27, 2020 17:04
Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm gonna have to retract my LGTM.

 + Do not destroy servlets unless init has been called.
 + Added TODOs about calling predestroy on instances not created by the holder.
 + Do not destroy servlets unless init has been called.
 + Added TODOs about calling predestroy on instances not created by the holder.
 + improved dump and toString
@gregw gregw requested a review from janbartel October 28, 2020 09:08
Copy link
Contributor

@janbartel janbartel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joakime
Copy link
Contributor

joakime commented Oct 28, 2020

Why are we even letting people pull the Servlet instance out of the ServletHolder?

I question this entirely.
I'm of the opinion that we should just eliminate ServletHolder.getServlet().

@gregw
Copy link
Contributor Author

gregw commented Oct 28, 2020

I'm of the opinion that we should just eliminate ServletHolder.getServlet().

Well perhaps make it private rather than public, but we still need the basic logic..... but making it private is a bridge too far for 9 I think.

@gregw gregw merged commit 7a0de6a into jetty-9.4.x Oct 28, 2020
@gregw gregw deleted the jetty-9.4.x-5498-ServletHolder-cleanup branch October 28, 2020 16:46
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.

4 participants