Skip to main content

[jax-rs-spec users] [jsr339-experts] Re: Don't see much use for @Suspend

  • From: Marek Potociar <marek.potociar@...>
  • To: jsr339-experts@...
  • Subject: [jax-rs-spec users] [jsr339-experts] Re: Don't see much use for @Suspend
  • Date: Mon, 18 Jun 2012 23:14:54 +0200
  • List-id: <jsr339-experts.jax-rs-spec.java.net>


On Jun 18, 2012, at 5:16 PM, Bill Burke wrote:

> @Suspend is currently a pretty useless annotation.
> 
> @Suspend(timeout=12345)
> public void get(@Context ExecutionContext ctx);
> 
> Really isn't much different than:
> 
> 
> public void get(@Context ExecutionContext ctx)
> {
>   ctx.suspend(12345);
> }
> 
> How about allowing @Suspend to inject an ExecutionContext?
> 
> public void get(@Suspend ExecutionContext ctx);
> 
> At least in this case, you're saving the typing of @Context.

Interesting idea. I wonder what would you do about field injection (typical 
for external event async scenarios)? I don't like mixing @Context and 
@Suspend for the two cases. Also, it is weird that I would not be able to 
suspend a method via annotation without injecting the context at the same 
time. Or would I? But in that case I would object that mixing concerns of 
"suspend" and "inject" is confusing.

On a related note, I plan to work on extending the async API a bit. I heard 
rants from external users on Tweeter that we are missing a concept of 
callback that would be able to handle events like "connection closed by 
client", "timeout" etc. Admittedly those rants are quite true. So the 
@Suspend annotation should be convenient for declarative method suspend 
configuration beyond current timeout capabilities.

Marek

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



[jax-rs-spec users] [jsr339-experts] Don't see much use for @Suspend

Bill Burke 06/18/2012

[jax-rs-spec users] [jsr339-experts] Re: Don't see much use for @Suspend

Marek Potociar 06/18/2012

[jax-rs-spec users] [jsr339-experts] Re: Don't see much use for @Suspend

Bill Burke 06/18/2012

[jax-rs-spec users] [jsr339-experts] Re: Re: Don't see much use for @Suspend

Marek Potociar 06/19/2012
 
 
Close
loading
Please Confirm
Close