You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe="false" %> within your JSP page. With this, instead of a single instance of the servlet generated for your JSP page loaded in memory, you will have N instances of the servlet loaded and initialized, with the service method of each instance effectively synchronized. You can typically control the number of instances (N) that are instantiated for all servlets implementing SingleThreadModel through the admin screen for your JSP engine. More importantly, avoid using the tag for variables. If you do use this tag, then you should set isThreadSafe to true, as mentioned above. Otherwise, all requests to that page will access those variables, causing a nasty race condition. SingleThreadModel is not recommended for normal use. There are many pitfalls, including the example above of not being able to use <%! %>. You should try really hard to make them thread-safe the old fashioned way: by making them thread-safe .
My Blog List
Sponser Link
know more info pls click here
Subscribe to:
Post Comments (Atom)
Popular Posts
-
<div id="editable" contenteditable="true"> text text text<br> text text text<br> text text...
-
1. Use exception-handling structures to deal with exceptions within the scope of a procedure. This technique is called structured exception ...
-
There is a little tool called JSPExecutor that allows you to do just that. The developers (Hendrik Schreiber <hs@webapp.de> & Pet...
-
The Trace object provides the Write and Warn methods to allow you to write messages to a request’s trace information. The two methods are id...
-
Let me explain the process; 1. First you should go to your adsense account and grab the code for your adsense ads. 2. For this you sh...
-
Few know that those who have web hosting are at the same time endowed with a free VPN (Virtual Private Network, a very safe connection to t...
-
There are a number of ways to get information about a particular Linux command. Chances are you are using bash shell which is currently the...
-
To check if a URL or an email address is valid, the common solution is regular expressions. For instance, to validate an email address in P...
-
we are running a classified site and the latest ads which are coming to the system is indexed in solr write server in every three minutes. T...
-
open source Apache webserver is well-proven, but can still offer an administrator headaches from timeto time when things don't go quite ...
0 comments:
Post a Comment