This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How many instances of a Servlet filter will there be within the container

 
Pat Farrell
Rancher
Posts: 4678
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Supposed I have a LoginFilter, defined the usual way:

public class LoginFilter implements Filter, Servlet {


Its executed for every URL that goes through the container (tomcat, glassfish, etc.)

How many "LoginFilter" objects are in the VM? Just one? one per thread? perhaps a pool is kept by the container and managed by it?

Related: does the LoginFilter have to be thread safe?
 
ntumba lobo
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the default is one instance per jvm
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic