ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

How can a thread safe JSP page be implemented?

user-image
تم إضافة السؤال من قبل Mohd Nadeem Mohd Rehman Mohammed , Software Engineer , Softworx Technologies
تاريخ النشر: 2016/10/05
sultan hatami
من قبل sultan hatami

To make your JSPs thread-safe, you can implement the SingleThreadModel interface that prevents two threads from accessing the service method at the same time.

HAALIN IMRAN
من قبل HAALIN IMRAN , System Administrator , SUPREME AUTO GROUP

A Java Server pages can be indicated as threadsafe through the isThreadSafe page directive attribute. Setting a value of false, will get the container to synchronize access to page level objects (and not to session and application scoped objects or objects of any other variety). Sometimes, it is still the responsibility of the developer to ensure that synchronous access to thread unsafe regions of code.

Evermore, the SingleThreadModel interface has also been deprecated in the Servlet Specification release 2.4. The SingleThreadModel interface is used to implement the supposed thread safety in JSPs as well - generated servlet classes will implement the SingleThreadModel for JSPs that use the threadsafe attribute. The specification itself outlines why the interface is deprecated.

Sherif Sayed
من قبل Sherif Sayed , Software Engineer , Digital Processing Systems

By implementing the following directive in the JSP page

 

<% "page isThreadSafe="false @%>

المزيد من الأسئلة المماثلة

هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟