Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jaxrs-dev] Client Filter Question

Markus,

 Unless otherwise stated this type of method call should be synchronous. When a filter returns, its task is completed and the next filter runs, so this type of behavior is undefined and invalid.

 This use case should be tackled at a different level, using solutions like Hystrix, Failsafe or MicroProfile Fault Tolerance.

— Santiago

On Jul 24, 2018, at 3:47 PM, Markus KARG <markus@xxxxxxxxxxxxxxx> wrote:

I'd like to foward this question I received today. Opinions?
 
Is it possible and valid to abort a running request using the exposed ClientRequestContext after the filter() method already exited?
 
// aborts request when exceeding timeout of 10s
@Override public void filter(ClientRequestContext requestContext) throws Exception {
  new Timer().schedule(new TimerTask() {
    @Override public void run() {
      requestContext.abortWith(Response.noContent().build());
    }
  }, 10_000);
}
 
 
Regards
-Markus
 
_______________________________________________
jaxrs-dev mailing list
jaxrs-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jaxrs-dev


Back to the top