Thanks to everyone for their comments.
I was thinking that a standard @Singleton annotation would not cause
problems for IoC containers as they would follow their own configuration to
decide if a given bean is a singleton or not.
That said, given that ApplicationConfig will have a corresponding retrieval
method, this is probably not an issue then...I suppose what I'm really after
is to be able to run the same (singleton) resource class on multiple
implementations. As long as each implementation can provide some ways to
treat a given resource class as a Singleton without requiring the source
code change then it would work fine...
Cheers, Sergey
-----Original Message-----
From: Marc.Hadley_at_Sun.COM [mailto:Marc.Hadley_at_Sun.COM]
Sent: 01 July 2008 19:18
To: users_at_jsr311.dev.java.net
Subject: Re: Singeltons
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.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jsr311.dev.java.net
For additional commands, e-mail: users-help_at_jsr311.dev.java.net
----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland