users@jersey.java.net

[Jersey] Re: How to reload jersey on hotswap?

From: Michal Gajdos <michal.gajdos_at_oracle.com>
Date: Tue, 29 Jul 2014 14:32:58 +0200

Hi Bob,

at the moment using the reload mechanism is the only way how to tell Jersey that JAX-RS Resources/Providers (e.g. added resource method) have been modified. Otherwise the Jersey internal model can become inconsistent (for example if someone changes value in @Path).

AFAIK JRebel is also using reload mechanism to when an JAX-RS Resource/Provider is changed.

Michal

> On 29 Jul, 2014, at 04:28 , Bob Thule <bobthule_at_gmail.com> wrote:
>
> I am working on jersey plugin for HotswapAgent, an open source alternative to jrebel. I have a working plugin, but I don't feel it is optimal, and I am hoping I can find help here on how to improve it.
>
> Currently, any time the plugin detects a relevant class change for Jersey, it calls reload() on the ServletContainer. Which isn't terrible, but that does end up calling configure() on registered HK2 binders, which calls provide() on any Factorys-- and that can take a lot of time.
>
> Is there a way to do this by invalidating the ResourceConfig cache and reloading the ResourceConfig State?
>
> Here is the code for the Jersey2 plugin so far:
> https://github.com/HotswapProjects/HotswapAgent/blob/master/plugin/hotswap-agent-jersey2-plugin/src/main/java/org/hotswap/agent/plugin/jersey/Jersey2Plugin.java
>