my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes How many instances of a Servlet filter will there be within the container Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How many instances of a Servlet filter will there be within the container" Watch "How many instances of a Servlet filter will there be within the container" New topic
Author

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

Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4646
    
    5

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

Joined: Oct 21, 2008
Posts: 180
the default is one instance per jvm


SCJP 5 , SCWCD 5, SCEA 5
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How many instances of a Servlet filter will there be within the container
 
Similar Threads
Filter to check if user is logged in
Servlet Filter problems
Doubt in running Filters
[Solved][HFSJ] Filter Preferences
Problem invoking filter