users@jax-rs-spec.java.net

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

From: Bill Burke <bburke_at_redhat.com>
Date: Fri, 22 Jun 2012 12:49:32 -0400

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