The isThreadSafe Attribute
Format
<%@ page isThreadSafe="true" %> <%   Default   %>
<%@ page isThreadSafe="false" %>
Purpose
To tell the system when your code is not threadsafe, so 
that the system can prevent concurrent access
Instructs servlet to implement SingleThreadModel
Notes
Default is true    system assumes you have synchronized 
updates to fields & other shared data
Supplying a value of false can degrade performance
43
JSP
www.corewebprogramming.com
Example of Non Threadsafe
Code (IDs Must Be Unique)
What s wrong with this code?
<%! private int idNum = 0; %>
<% 
String userID = "userID" + idNum;
out.println("Your ID is " + userID + ".");
idNum = idNum + 1; 
%>
44
JSP
www.corewebprogramming.com
22




  

Home

About Services Network Support FAQ Order Contact
 

Java Web Hosting

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved