Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6748503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:34:22+00:00 2026-05-26T12:34:22+00:00

I’m writing a servlet, which is executed in Java servlet container (eg, JBoss, Jetty,

  • 0

I’m writing a servlet, which is executed in Java servlet container (eg, JBoss, Jetty, Tomcat, GlassFish).

What are the reasons for a servlet container to interrupt the thread running my HTTP request handler? Will it do that only when shutting down? Will it do that when the client is not responding?

Is it standardized, or is any container free to do what he wishes?

To clarify, I’m not talking about interrupting new threads that I create, only on the servlet container’s threads my requests are running on. (Although it’ll be interesting if you’ll mention what happens to new threads in the answer).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:34:23+00:00Added an answer on May 26, 2026 at 12:34 pm

    What are the reasons for a servlet container to interrupt the thread running my HTTP request handler?

    That depends on the container itself. It’s indeed not standardized in the servlet specification.

    Will it do that only when shutting down?

    Seems one of the most obvious reasons. Local tests taught me that at least Tomcat 7.0.22 and Glassfish 3.1.1 will abort all the servlet’s processing immediately without letting them to continue their task. No exceptions will be thrown at that point.

    Will it do that when the client is not responding?

    Only when the request headers are not fully arrived. There’s a container-specific timeout on the socket connection which is usually 60 seconds. But if the request headers are not fully arrived, then your servlet method won’t be entered anyway. Only if the request headers are fully arrived, then your servlet method will be entered.

    Then, inside the servlet method; if the client has supplied a request body (e.g. POST) and your servlet’s code starts reading the request body by for example request.getParameter() or request.getInputStream(), then it will throw IOException when the client has aborted sending the request body at that point. On the other hand, when you write to the response (and flush/commit it), then also an IOException will be thrown when the client aborts the connection at that point. You can if necessary put it in a try-catch, but you can’t do anything more with it than just logging. The usefulness of those loggings is highly quesitonable and will likely only clutter your server logs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
I am writing an app with both english and french support. The app requests
I have thousands of HTML files to process using Groovy/Java and I need to
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.