dev@glassfish.java.net

Re: Important Note about 3.1 -- using _at_Inject(name=ServerEnvironment.DEFAULT_INSTANCE_NAME)

From: Tim Quinn <tim.quinn_at_oracle.com>
Date: Wed, 5 May 2010 07:47:21 -0500

It seems that it would be very useful to have the default instance
name's Config or Server used without forcing each (or most) of the
declarations to explicitly specify
(name=ServerEnvironment.DEFAULT_INSTANCE_NAME).

If we really want most (all?) such declarations to use the default
instance name, then it seems much less error-prone for

@Inject Config config;

and

@Inject Server server;

to do the most commonly right thing.


- Tim

On May 4, 2010, at 9:42 PM, Byron Nevins wrote:

> The basic clustering code is now running. There are some changes:
>
> Previously DAS would only have one config element and it was called
> "server-config". Now DAS has 1 or more configs. The DAS config is
> still called "server-config". The other config elements are only
> needed by specialized Admin commands that support clustering. I.e.
> no existing V3.0 code needs to "see" these other config elements.
>
> Instances have only one config element -- the correct one. So they
> are like pre-3.1 DAS in this respect.
>
> Precautions
>
> Instances are having lots of problems because there is code around
> that can't handle having multiple configs around. The solution is
> easy -- injection comes to the rescue!
>
> Please replace any existing code and in all future code -- inject
> the server and config elements for the currently running server like
> so:
>
>
> @Inject(name=ServerEnvironment.DEFAULT_INSTANCE_NAME)
> Config config;
>
> @Inject(name=ServerEnvironment.DEFAULT_INSTANCE_NAME)
> Server server;
>
>
> Examples of "bad" code:
>
> get the list of configs and then use the zero'th one in the list
> Get the config by name -- "default-config"
>
>
>
>
> --
> Byron Nevins - Oracle Corporation
> Home: 650-359-1290
> Cell: 650-784-4123
> Sierra: 209-295-2188
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net For
> additional commands, e-mail: dev-help_at_glassfish.dev.java.net