In perfect world, I would imagine that there is an annotation like @QoS(10, CONSTANT_RETURN_OBJECT)
which can be placed around java methods and if they take longer than the specified time (10 seconds in this example) to execute then the method execution is essentially considered timed out and we return a pre-packaged CONSTANT_RETURN_OBJECT defined by the developer to indicate empty results.
But realistically, what is a good approach supported by or recommended for enforcing how long a jersey-server method can run for before we say its too darn long and just return and go on our merry way?
And its a given (for my question here) that you have no control over the client side that is calling jersey-server so you can NOT go set a timeout there ... which is why you are enforcing some reasonable ones on the server side.
UPDATE:
I guess what I am asking to some degree is if there is an annotation that would essentially wrap a method call as an Executor driven task and run it with a timeout? Sort of like what the code written in the answers for these two posts does: