users@jsr311.java.net

Re: Singeltons

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 01 Jul 2008 14:18:12 -0400

On Jul 1, 2008, at 1:55 PM, Stephan Koops wrote:
>
> can you say, when this standard for singelton annotations (or
> whatever) is available in Java EE 6? Could it be integrated in JAX-
> RS 1.0?
>
Last I heard EE 6 is scheduled for mid 2009. JAX-RS 1.0 is scheduled
for end of Sept this year. We're planning a JAX-RS 1.1 to align with
EE 6 in the same timeframe as EE 6.

Marc.

>
> Marc Hadley schrieb:
>> I'm glad you brought this up because it reminded me of a change
>> that I missed in the 0.9 release:
>>
>> https://jsr311.dev.java.net/servlets/ReadMsg?list=dev&msgNo=1340
>>
>> I think that will address your requirement without our needing to
>> add a new annotation.
>>
>> I don't agree with your assertion that root resource classes are
>> likely to be singletons, personally I find the use of ctors that
>> per-request allows is very handy. Also, even if we added our own
>> annotation for singletons that would work in the absence of an IoC
>> framework, we can't expect every IoC framework out there to
>> understand our annotation so developers will have to add IoC
>> specific annotations or configuration as well as our annotation.
>> What's really needed here is a standard for IoC and I'm hopeful
>> we'll get there in EE 6 - for now I don't want to add anything to
>> the API that will complicate integration between JAX-RS and an IoC
>> standard.
>>
>> Marc.
>>
>> On Jul 1, 2008, at 12:38 PM, Sergey Beryozkin wrote:
>>
>>> Hi
>>>
>>> JAX-RS specification referes to singletons a number of time, that
>>> is, a singleton life cycle is given some prominent
>>> attention in the specification. Yet, there's no related annotation
>>> availbale in the API - different JAX-RS implementations use
>>> private techniques to mark a given root resource class as a
>>> singleton.
>>>
>>> My concern is that given that root resources are likely be
>>> singletons more often than not, it won't be possible to write even
>>> a basic resource implementation which will work reliably (as a
>>> singleton) across multiple implementations. As such I'd like to
>>> suggest that a common @Singleton annotation is introduced in the
>>> API. This way, the (singleton) resource class, injected as a
>>> singleton bean by a IOC framework, or instantiated by the runtime
>>> (in which case @Singleton will be noticed), will be a true
>>> singleton across multiple implementations...
>>>
>>> Cheers, Sergey
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
> For additional commands, e-mail: users-help_at_jsr311.dev.java.net
>

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.