java - Which page to make isThreadSafe=false in jsp -
i working database project developed using jsp,servlet. erp project having more 20 users. boss told me use multi-theading in project. please tell me how make decision of pages should muti-threaded , should not.
java multi-threading in jsp not valid argument such because @jbnizet said, web container handles multithreading you.
what can though use multi-threading in cases have code can run asynchronously.
lets assume have scenario :
obj1 = obj2.getvalfromdb(obj3.getsessionid(obj4.getid()));
in this, multi-threading cannot used because tasks have executed sequentially in order result. single thread need...
but in example below...
val = getvalfromdb()+getvalfromsrc1()+getvalfromsrc2();
the sub-results can calculated in separate threads.
so, have make evaluation of code , use multi-threading appropriately.
as isthreadsafe
directive in jsps, thing can disable multi-threading (which opposite looking for). specification says:
the use of singlethreadmodel interface guarantees 1 thread @ time execute in given servlet instance’s service method. important note guarantee applies each servlet instance, since container may choose pool such objects. objects accessible more 1 servlet instance @ time, such instances of httpsession, may available @ particular time multiple servlets, including implement singlethreadmodel.