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

Improvements to the Rest Whiteboard plugin model #11

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

timothyjward
Copy link
Contributor

These commits re-work the lifecycle of the whiteboard to simplify providing implementations, and to make more use of native Jersey plug points.

  • The lifecycle changes make updates fully asynchronous
  • The API changes allow for direct use of Jersey Container implementations
  • Provider implementations no longer need to track whiteboard services (this is handled by the core code)

There are numerous threading difficulties with maintaining a whiteboard. The existing model would often issue unnecessary change count updates, and sometimes send an update before a resource was ready. The cleanup lifecycle was also somewhat inconsistent. Rather than trying to find and fix the threading bugs this commit substantially rewrites the JerseyServiceRuntime to:

* Do the service tracking and management itself, simplifying the provider plugins
* Use an "update thread" which is responsible for triggering changes in the whiteboard separately from the service binding thread
* Providers now create Jersey Container objects for each application path which are then managed by the JerseyService runtime

The overall lifecycle is now substantially simpler. I believe that there is also more code that could be deleted in a subsequent cleanup commit.

N.B. One other significant change is that the whiteboard updates are now asynchronous. Where previously a thread registering a whiteboard service could get away with immediately calling it, that thread must now wait for the change count to be updated.

Signed-off-by: Tim Ward <timothyjward@apache.org>
The TCK project was only running using the Jetty integration project. This commit adds an additional run for the Servlet Whiteboard, and some fixes to the ServletContextHelper/Servlet registration paths to make the TCK pass with the Servlet Whiteboard

Signed-off-by: Tim Ward <timothyjward@apache.org>
@@ -65,7 +65,7 @@ public void lifeCycleStopping(LifeCycle lifeCycle) {

@Override
public void lifeCycleStopped(LifeCycle lifeCycle) {
state = JerseyServiceRuntime.State.STARTED;
state = JettyBackedWhiteboardComponent.State.STARTED;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is state STARTED really correct?
The method has the name lifeCycleStopped, so I would expect a similar State STOPPED

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good question. It's not something that I changed (other than the name of the enclosing type). I agree that it looks odd. I think it might be best to look at issue #12 to see if we can remove this completely and rely on the native Jersey implementation

@timothyjward timothyjward merged commit e4a530b into eclipse-osgi-technology:main Jul 11, 2023
5 checks passed
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