Hi Michal,
Thank you for the answer. Is better hotswap support on Jersey's roadmap?
I don't mind a full reload of jersey components, because they are quick--
but the reconfiguration of the HK2 application binders are slow. Can you
think of any workaround that would not require a call to the configure() of
my applications AbstractBinder?
eg:
public MyApp() {
register(new MyAppBinder());
property(ServerProperties.METAINF_SERVICES_LOOKUP_DISABLE, true);
packages(true, "com.myproj.api");
}
// how do I make it so that a new "MyAppBuilder" is not needed during
reload()?
public class MyAppBinder extends AbstractBinder {
@Override
protected void configure() {
// there are time consuming bindings here that I would like to
avoid
}
}
Thanks,
Bob
On Tue, Jul 29, 2014 at 8:32 AM, Michal Gajdos <michal.gajdos_at_oracle.com>
wrote:
> 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
>
>
>