1 /*
2  *  Licensed to the Apache Software Foundation (ASF) under one or more
3  *  contributor license agreements.  See the NOTICE file distributed with
4  *  this work for additional information regarding copyright ownership.
5  *  The ASF licenses this file to You under the Apache License, Version 2.0
6  *  (the "License"); you may not use this file except in compliance with
7  *  the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  */

17 package org.apache.coyote.http11;
18
19 import org.apache.juli.logging.Log;
20 import org.apache.juli.logging.LogFactory;
21 import org.apache.tomcat.util.net.NioChannel;
22 import org.apache.tomcat.util.net.NioEndpoint;
23
24
25 /**
26  * Abstract the protocol implementation, including threading, etc.
27  * Processor is single threaded and specific to stream-based protocols,
28  * will not fit Jk protocols like JNI.
29  *
30  * @author Remy Maucherat
31  * @author Costin Manolache
32  */

33 public class Http11NioProtocol extends AbstractHttp11JsseProtocol<NioChannel> {
34
35     private static final Log log = LogFactory.getLog(Http11NioProtocol.class);
36
37
38     public Http11NioProtocol() {
39         super(new NioEndpoint());
40     }
41
42
43     @Override
44     protected Log getLog() { return log; }
45
46
47     // -------------------- Pool setup --------------------
48
49     /**
50      * NO-OP.
51      *
52      * @param count Unused
53      *
54      * @deprecated This setter will be removed in Tomcat 10.
55      */

56     @Deprecated
57     public void setPollerThreadCount(int count) {
58     }
59
60     /**
61      * Always returns 1.
62      *
63      * @return 1
64      *
65      * @deprecated This getter will be removed in Tomcat 10.
66      */

67     @Deprecated
68     public int getPollerThreadCount() {
69         return 1;
70     }
71
72     public void setSelectorTimeout(long timeout) {
73         ((NioEndpoint)getEndpoint()).setSelectorTimeout(timeout);
74     }
75
76     public long getSelectorTimeout() {
77         return ((NioEndpoint)getEndpoint()).getSelectorTimeout();
78     }
79
80     public void setPollerThreadPriority(int threadPriority) {
81         ((NioEndpoint)getEndpoint()).setPollerThreadPriority(threadPriority);
82     }
83
84     public int getPollerThreadPriority() {
85       return ((NioEndpoint)getEndpoint()).getPollerThreadPriority();
86     }
87
88
89     // ----------------------------------------------------- JMX related methods
90
91     @Override
92     protected String getNamePrefix() {
93         if (isSSLEnabled()) {
94             return "https-" + getSslImplementationShortName()+ "-nio";
95         } else {
96             return "http-nio";
97         }
98     }
99 }
100