admin@glassfish.java.net

Re: CODE REVIEW: changes to HK2 and V3 to support "restart required"

From: Lloyd Chambers <Lloyd.Chambers_at_Sun.COM>
Date: Mon, 11 Aug 2008 11:24:19 -0700

Anissa,

For V3, the situation is ambiguous at present, and probably will
remain so, because the determination of "required" is wholly dependent
on perfect back-end support.

So I think we should generalize the term "Restart Required" to
something else that doesn't apply that level of certainty. Perhaps
"Config Changes: 10 [details]" or similar.

This is so because there are some "wrinkles" in V3—

- In V2, we had dedicated code (hard-coded) logic to determine very
precisely whether a restart was required. We controlled what code ran
and what its config was and we "knew" what changes affected remote
instances, etc. Of course, it probably had flaws, but basically it
covered the important stuff.

- In V3, it is up to the consumer(s) of each @Configured to implement
ConfigListener. In some cases, more than on consumer exists for the
same @Configured, making the situation even more "interesting" for
correct behavior. In other cases (eg Grizzly config), config is
several levels deep and unless listeners exist at every level, things
will be missed (events are delivered only for the @Configured itself
eg for attributes and added/removed children).

- In V3, there are ample numbers of @Configured elements which have no
ConfigListener. That alone means any change to those @Configured will
result in every change being recorded as "unprocessed" (which is
axiomatically true, since nothing is listening. A simple example:
domainRoot.setLocale("FOO").

There also currently seems to be an issue (bug) where <property>
changes are not passed to ConfigListeners.

Lloyd

On Aug 11, 2008, at 10:19 AM, Anissa Lam wrote:

> Hi Lloyd,
>
> I am ready to show 'restart required' in GUI. Is the code below
> what i should be doing, which means if changes.size() != 0, I
> should let user know restart is required ? As in V2, this will
> be called upon every page refresh so i can put in the header, is
> this fine ?
>
> btw, if you want to see/use the latest GUI, just do
> asadmin deploy v3/admingui/war/target/admingui.war and then access
> localhost:8080/admingui
> assuming your build succeed :)
>
> thanks
> Anissa
>
> Lloyd Chambers wrote:
>>
>> Anissa,
>>
>> Relevant part for you:
>>
>> final SystemStatus ss = domainRoot.getSystemStatus();
>> final List<Object[]> temp = ss.getUnprocessedConfigChanges();
>> final List<UnprocessedConfigChange> changes =
>> ss.Helper.toUnprocessedConfigChange(temp);
>>
>> if ( changes.size() != 0 ) {
>> for( final UnprocessedConfigChange change : changes ) {
>> System.out.println( change.toString() );
>> }
>> }
>> else {
>> // no changes, or all changes were processed and system is using
>> them
>> }
>>
>> Lloyd
>>
>