Обучение Java. Сервлеты

       

Interface javax.servlet.SingleThreadModel


public interface SingleThreadModel

Defines a "single" thread model for servlet execution. This empty interface allows servlet implementers to specify how the system should handle concurrent calls to the same servlet.

If the target servlet is flagged with this interface, the servlet programmer is guaranteed that no two threads will execute concurrently the service method of that servlet. This guarantee is ensured by maintaining a pool of servlet instances for each such servlet, and dispatching each service call to a free servlet.

In essence, if the servlet implements this interface, the servlet will be thread safe. Note that this will not prevent synchronization problems associated with accessing shared resources (such as static class variables or classes outside the scope of the servlet).



Содержание раздела