This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
    Bookmark Topic Watch Topic
  • New Topic

Servlets  RSS feed

 
pavan jahagirdar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Report post to moderator
i want to keep the count of the times the service method (in Servlets) is invoked , without allowing the Servlet container to create seperate thread for each request ...
is that possible?

thanks in advance.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
What the servlet container does with respect to thread handling is (and should be) entirely out of your control. You can use an instance variable in the servlet class to keep track of the number of invocations (maybe using an AtomicInteger). You would do this in the doGet and/or doPost methods as appropriate (you should not override the service method).

In the future, please use more descriptive subjects than "servlets" - in a forum entirely devoted to servlets that has zero content.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
This now sounds like your other question (http://www.coderanch.com/t/625941/Servlets/java/Servlets); let's continue the discussion there. I'll close this topic.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!