Skip to content

Instantly share code, notes, and snippets.

@john77eipe
Created August 24, 2016 09:09
Show Gist options
  • Save john77eipe/9d8958e743ec01d45aec367f3007677f to your computer and use it in GitHub Desktop.
Save john77eipe/9d8958e743ec01d45aec367f3007677f to your computer and use it in GitHub Desktop.
// tell the browser if connection
// fails to reopen it after 10 seconds
response.getWriter().println("retry: 10000\n");
// Start asynchronous context and add listeners to remove it in case
// of errors
final AsyncContext ac = request.startAsync();
log("Default timeout for this asyncContext: "+ac.getTimeout());
// The timeout will expire if neither the complete() method nor any of the dispatch methods are called on the
// asyncContext.
// this value times out the connection
ac.setTimeout(Integer.MAX_VALUE);
log("Changed timeout for this asyncContext: "+ac.getTimeout());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment