View | Details | Raw Unified | Return to bug 60560
Collapse All | Expand All

(-)a/java/org/apache/coyote/http11/Http11NioProtocol.java (+8 lines)
Lines 70-75 Link Here
70
      return ((NioEndpoint)getEndpoint()).getPollerThreadPriority();
70
      return ((NioEndpoint)getEndpoint()).getPollerThreadPriority();
71
    }
71
    }
72
72
73
    public boolean getUseInheritedChannel() {
74
      return ((NioEndpoint)getEndpoint()).getUseInheritedChannel();
75
    }
76
77
    public void setUseInheritedChannel(boolean useInheritedChannel) {
78
        ((NioEndpoint)getEndpoint()).setUseInheritedChannel(useInheritedChannel);
79
    }
80
73
81
74
    // ----------------------------------------------------- JMX related methods
82
    // ----------------------------------------------------- JMX related methods
75
83
(-)a/java/org/apache/tomcat/util/net/NioEndpoint.java (-4 / +22 lines)
Lines 26-31 Link Here
26
import java.net.SocketTimeoutException;
26
import java.net.SocketTimeoutException;
27
import java.nio.ByteBuffer;
27
import java.nio.ByteBuffer;
28
import java.nio.channels.CancelledKeyException;
28
import java.nio.channels.CancelledKeyException;
29
import java.nio.channels.Channel;
29
import java.nio.channels.FileChannel;
30
import java.nio.channels.FileChannel;
30
import java.nio.channels.NetworkChannel;
31
import java.nio.channels.NetworkChannel;
31
import java.nio.channels.SelectionKey;
32
import java.nio.channels.SelectionKey;
Lines 36-42 Link Here
36
import java.util.ConcurrentModificationException;
37
import java.util.ConcurrentModificationException;
37
import java.util.Iterator;
38
import java.util.Iterator;
38
import java.util.concurrent.CountDownLatch;
39
import java.util.concurrent.CountDownLatch;
39
import java.util.concurrent.TimeUnit;
40
 import java.util.concurrent.TimeUnit;
40
import java.util.concurrent.atomic.AtomicInteger;
41
import java.util.concurrent.atomic.AtomicInteger;
41
import java.util.concurrent.atomic.AtomicLong;
42
import java.util.concurrent.atomic.AtomicLong;
42
43
Lines 125-130 Link Here
125
126
126
127
127
    /**
128
    /**
129
     * Use System.inheritableChannel to obtain channel from stdin/stdout
130
     */
131
    private boolean useInheritedChannel = false;
132
    public void setUseInheritedChannel(boolean useInheritedChannel) { this.useInheritedChannel = useInheritedChannel; }
133
    public boolean getUseInheritedChannel() { return useInheritedChannel; }
134
135
136
    /**
128
     * Priority of the poller threads.
137
     * Priority of the poller threads.
129
     */
138
     */
130
    private int pollerThreadPriority = Thread.NORM_PRIORITY;
139
    private int pollerThreadPriority = Thread.NORM_PRIORITY;
Lines 200-209 Link Here
200
    @Override
209
    @Override
201
    public void bind() throws Exception {
210
    public void bind() throws Exception {
202
211
203
        serverSock = ServerSocketChannel.open();
212
        if(getUseInheritedChannel()) {
213
            Channel ic = System.inheritedChannel();
214
            if(ic instanceof ServerSocketChannel) {
215
                serverSock = (ServerSocketChannel) ic;
216
            }
217
        }
218
219
        if(serverSock == null) {
220
            serverSock = ServerSocketChannel.open();
221
            InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
222
            serverSock.socket().bind(addr,getAcceptCount());
223
        }
204
        socketProperties.setProperties(serverSock.socket());
224
        socketProperties.setProperties(serverSock.socket());
205
        InetSocketAddress addr = (getAddress()!=null?new InetSocketAddress(getAddress(),getPort()):new InetSocketAddress(getPort()));
206
        serverSock.socket().bind(addr,getAcceptCount());
207
        serverSock.configureBlocking(true); //mimic APR behavior
225
        serverSock.configureBlocking(true); //mimic APR behavior
208
226
209
        // Initialize thread count defaults for acceptor, poller
227
        // Initialize thread count defaults for acceptor, poller
(-)a/webapps/docs/config/http.xml (+10 lines)
Lines 703-708 Link Here
703
        </p>
703
        </p>
704
      </attribute>
704
      </attribute>
705
705
706
      <attribute name="useInheritedChannel" required="false">
707
        <p>(boolean)Defines if this connector should inherit an inetd/systemd network socket.
708
        Only one connector can inherit a network socket. This can option can be
709
        used to automatcially start Tomcat once a connection request is made to
710
        the systemd super daemon's port.
711
        The default value is <code>false</code>. See the JavaDoc
712
        for the <code>java.nio.channels.spi.SelectorProvider</code> class for
713
        more details.</p>
714
      </attribute>
715
706
      <attribute name="pollerThreadPriority" required="false">
716
      <attribute name="pollerThreadPriority" required="false">
707
        <p>(int)The priority of the poller threads.
717
        <p>(int)The priority of the poller threads.
708
        The default value is <code>5</code> (the value of the
718
        The default value is <code>5</code> (the value of the

Return to bug 60560