001 /* 002 * Copyright 2004 The Apache Software Foundation 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package javax.servlet; 017 018 /** 019 * Ensures that servlets handle 020 * only one request at a time. This interface has no methods. 021 * 022 * <p>If a servlet implements this interface, you are <i>guaranteed</i> 023 * that no two threads will execute concurrently in the 024 * servlet's <code>service</code> method. The servlet container 025 * can make this guarantee by synchronizing access to a single 026 * instance of the servlet, or by maintaining a pool of servlet 027 * instances and dispatching each new request to a free servlet. 028 * 029 * <p>Note that SingleThreadModel does not solve all thread safety 030 * issues. For example, session attributes and static variables can 031 * still be accessed by multiple requests on multiple threads 032 * at the same time, even when SingleThreadModel servlets are used. 033 * It is recommended that a developer take other means to resolve 034 * those issues instead of implementing this interface, such as 035 * avoiding the usage of an instance variable or synchronizing 036 * the block of the code accessing those resources. 037 * This interface is deprecated in Servlet API version 2.4. 038 * 039 * 040 * @author Various 041 * @version $Version$ 042 * 043 * @deprecated As of Java Servlet API 2.4, with no direct 044 * replacement. 045 */ 046 047 public interface SingleThreadModel { 048 }