jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: [jax-rs-spec users] Issues with ExecutionContext

From: Bill Burke <bburke_at_redhat.com>
Date: Wed, 27 Jun 2012 12:21:01 -0400

Yes, please comment. Marek and I are butting heads again and we need a
moderator. Please remember the context though: Singleton field
injection + concurrency + thread switching. The specificaly in section
5.1 hints as these types of problems. ExecutionContext has the
additional problem of thread switching.

On 6/27/12 5:41 AM, Marek Potociar wrote:
> Exeprts,
> if you are interested in a follow-up discussion, check the comments on
> the issue that Bill opened:
> http://java.net/jira/browse/JAX_RS_SPEC-215
>
> Marek
>
> On Jun 22, 2012, at 6:49 PM, Bill Burke wrote:
>
>> I'll make a separate JIRA's for these.
>>
>> * Field injection *WILL NOT WORK* for ExecutionContext within
>> singletons because references will be proxied and you won't be able to
>> pass those proxied thread-specific references to other threads.
>>
>> You *could* have a method on ExecutionContext like:
>>
>> ExecutionContext getDelegate()
>>
>> But this is extremely ugly IMO. Instead, I suggest:
>>
>> - ExecutionContext cannot be injected via @Context
>> - Turn @Suspend into a parameter annotation only
>> - Inject ExecutionContext via a @Suspend:
>>
>> @GET
>> public void get(@Suspend ExecutionContext ctx);
>>
>> - since you can't have ExecutionContext without a @Suspend, remove
>> suspend() methods from ExecutionContext.
>>
>>
>> * JAX-RS 2.0 implementations should be able to run on top of the
>> Servlet API. This means these ExecutionContext methods needs to be
>> removed:
>>
>> cancel()
>> isCancelled()
>>
>> As there is no corresponding functionality in Servlet 3.0, you need to
>> either remove these methods.
>>
>> * You cannot add the async callbacks you want to add (like when a
>> socket is closed), again, because Servlet 3.0 does not have
>> corresponding functionality here. JAX-RS 1.0 was a standalone
>> specification that could run in existing servlet containers (2.5,
>> etc.). We don't want to move away from this, IMO.
>>
>> * I don't know if you can make methods optional or not and throw some
>> sort of NotSupported exception. Is this a legal spec thing?
>>
>>
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com