annotate src/org/eclipse/jetty/io/nio/ChannelEndPoint.java @ 1070:a44fc6b53757

fix use of HttpGenerator._buffer
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 10 Nov 2016 01:23:37 -0700
parents 4a50422596b6
children ebb0f1343ef6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 // ------------------------------------------------------------------------
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 // All rights reserved. This program and the accompanying materials
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 // are made available under the terms of the Eclipse Public License v1.0
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
7 // and Apache License v2.0 which accompanies this distribution.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
8 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
9 // The Eclipse Public License is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
10 // http://www.eclipse.org/legal/epl-v10.html
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
11 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
12 // The Apache License v2.0 is available at
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 // http://www.opensource.org/licenses/apache2.0.php
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 // You may elect to redistribute this code under either of these licenses.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 // ========================================================================
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 //
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
19 package org.eclipse.jetty.io.nio;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
20
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
21 import java.io.IOException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
22 import java.net.InetSocketAddress;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 import java.net.Socket;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 import java.net.SocketException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 import java.nio.ByteBuffer;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 import java.nio.channels.ByteChannel;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 import java.nio.channels.GatheringByteChannel;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
28 import java.nio.channels.SocketChannel;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
30 import org.eclipse.jetty.io.JBuffer;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 import org.eclipse.jetty.io.EndPoint;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 import org.eclipse.jetty.util.StringUtil;
820
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
33 import org.slf4j.Logger;
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
34 import org.slf4j.LoggerFactory;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
35
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
36 /**
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
37 * Channel End Point.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38 * <p>Holds the channel and socket for an NIO endpoint.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
39 *
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
40 */
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
41 public class ChannelEndPoint implements EndPoint
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 {
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
43 private static final Logger LOG = LoggerFactory.getLogger(ChannelEndPoint.class);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
45 private final SocketChannel _channel;
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
46 protected final Socket _socket;
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
47 private final InetSocketAddress _local;
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
48 private final InetSocketAddress _remote;
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
49 protected volatile int _maxIdleTime;
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
50 private volatile boolean _ishut = false;
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
51 private volatile boolean _oshut = false;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
52
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
53 protected ChannelEndPoint(SocketChannel channel, int maxIdleTime) throws IOException
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
54 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
55 this._channel = channel;
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
56 _maxIdleTime = maxIdleTime;
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
57 _socket = channel.socket();
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
58 _local = (InetSocketAddress)_socket.getLocalSocketAddress();
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
59 _remote = (InetSocketAddress)_socket.getRemoteSocketAddress();
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
60 _socket.setSoTimeout(_maxIdleTime);
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
61 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
62
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
63 @Override
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
64 public final boolean isBlocking()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
65 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
66 return _channel.isBlocking();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
67 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
68
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
69 @Override
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
70 public boolean blockReadable(long millisecs) throws IOException
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
71 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
72 return true;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
73 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
74
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
75 @Override
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
76 public boolean blockWritable(long millisecs) throws IOException
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
77 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
78 return true;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
79 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
80
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
81 @Override
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
82 public final boolean isOpen()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
83 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
84 return _channel.isOpen();
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
85 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
86
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
87 @Override
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
88 public final void shutdownInput() throws IOException
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
89 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
90 LOG.debug("ishut {}", this);
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
91 _ishut = true;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
92 if (_channel.isOpen())
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
93 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
94 try
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
95 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
96 if (!_socket.isInputShutdown())
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
97 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
98 _socket.shutdownInput();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
99 }
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
100 }
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
101 catch (SocketException e)
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
102 {
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
103 LOG.debug(e.toString());
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
104 LOG.trace("",e);
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
105 }
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
106 finally
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
107 {
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
108 if (_oshut)
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
109 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
110 close();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
111 }
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
112 }
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
113 }
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
114 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
115
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
116 @Override
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
117 public final void shutdownOutput() throws IOException
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
118 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
119 LOG.debug("oshut {}",this);
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
120 _oshut = true;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
121 if (_channel.isOpen())
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
122 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
123 try
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
124 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
125 if (!_socket.isOutputShutdown())
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
126 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
127 _socket.shutdownOutput();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
128 }
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
129 }
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
130 catch (SocketException e)
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
131 {
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
132 LOG.debug(e.toString());
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
133 LOG.trace("",e);
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
134 }
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
135 finally
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
136 {
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
137 if (_ishut)
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
138 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
139 close();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
140 }
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
141 }
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
142 }
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
143 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
144
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
145 @Override
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
146 public final boolean isOutputShutdown()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
147 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
148 return _oshut || !_channel.isOpen() || _socket.isOutputShutdown();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
149 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
150
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
151 @Override
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
152 public final boolean isInputShutdown()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
153 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
154 return _ishut || !_channel.isOpen() || _socket.isInputShutdown();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
155 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
156
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 958
diff changeset
157 @Override
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
158 public void close() throws IOException
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
159 {
1005
0e96ce3db20a remove HttpBuffers
Franklin Schmidt <fschmidt@gmail.com>
parents: 986
diff changeset
160 //Thread.dumpStack();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
161 LOG.debug("close {}",this);
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
162 _channel.close();
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
163 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
164
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
165 @Override
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
166 public int fill(JBuffer buffer) throws IOException
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
167 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
168 if (_ishut)
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
169 return -1;
1005
0e96ce3db20a remove HttpBuffers
Franklin Schmidt <fschmidt@gmail.com>
parents: 986
diff changeset
170 int len = 0;
1062
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
171 final ByteBuffer bbuf = buffer.getByteBuffer().duplicate();
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
172
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
173 //noinspection SynchronizationOnLocalVariableOrMethodParameter
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
174 try
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
175 {
1062
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
176 bbuf.limit(bbuf.capacity());
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
177 bbuf.position(buffer.limit());
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
178 len = _channel.read(bbuf);
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
179 buffer.limit(bbuf.position());
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
180
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
181 if (len<0 && isOpen())
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
182 {
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
183 if (!isInputShutdown())
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
184 shutdownInput();
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
185 if (isOutputShutdown())
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
186 _channel.close();
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
187 }
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
188 }
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
189 catch (IOException x)
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
190 {
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
191 LOG.debug("Exception while filling", x);
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
192 try
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
193 {
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
194 if (_channel.isOpen())
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
195 _channel.close();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
196 }
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
197 catch (Exception xx)
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
198 {
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
199 LOG.trace("",xx);
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
200 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
201
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
202 if (len>0)
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
203 throw x;
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
204 len = -1;
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
205 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
206
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
207 return len;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
208 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
209
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
210 @Override
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
211 public int flush(JBuffer buffer) throws IOException
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
212 {
1062
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
213 final ByteBuffer bbuf = buffer.getByteBuffer();
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
214 return _channel.write(bbuf);
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
215 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
216
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
217 @Override
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
218 public int flush(JBuffer header, JBuffer buffer, JBuffer trailer) throws IOException
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
219 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
220 int length=0;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
221
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
222 if (_channel instanceof GatheringByteChannel &&
1048
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
223 header!=null && header.remaining()!=0 &&
2b769da7f67d remove Buffer
Franklin Schmidt <fschmidt@gmail.com>
parents: 1046
diff changeset
224 buffer!=null && buffer.remaining()!=0)
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
225 {
1062
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
226 length = gatheringFlush(header,buffer);
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
227 }
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
228 else
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
229 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
230 // flush header
1038
b71ad168fe34 rename Buffer.length() to remaining()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1031
diff changeset
231 if (header!=null && header.remaining()>0)
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
232 length=flush(header);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
233
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
234 // flush buffer
1038
b71ad168fe34 rename Buffer.length() to remaining()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1031
diff changeset
235 if ((header==null || header.remaining()==0) &&
b71ad168fe34 rename Buffer.length() to remaining()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1031
diff changeset
236 buffer!=null && buffer.remaining()>0)
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
237 length+=flush(buffer);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
238
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
239 // flush trailer
1038
b71ad168fe34 rename Buffer.length() to remaining()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1031
diff changeset
240 if ((header==null || header.remaining()==0) &&
b71ad168fe34 rename Buffer.length() to remaining()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1031
diff changeset
241 (buffer==null || buffer.remaining()==0) &&
b71ad168fe34 rename Buffer.length() to remaining()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1031
diff changeset
242 trailer!=null && trailer.remaining()>0)
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
243 length+=flush(trailer);
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
244 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
245
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
246 return length;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
247 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
248
1062
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
249 private synchronized int gatheringFlush(JBuffer header, JBuffer buffer) throws IOException
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
250 {
1062
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
251 ByteBuffer bbuf0 = header.getByteBuffer();
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
252 ByteBuffer bbuf1 = buffer.getByteBuffer();
4a50422596b6 fix JBuffer.getByteBuffer()
Franklin Schmidt <fschmidt@gmail.com>
parents: 1049
diff changeset
253 return (int)_channel.write(new ByteBuffer[]{bbuf0,bbuf1});
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
254 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
255
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
256 public final SocketChannel getChannel()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
257 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
258 return _channel;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
259 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
260
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
261 @Override
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
262 public final String getLocalAddr()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
263 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
264 if (_local.getAddress()==null || _local.getAddress().isAnyLocalAddress())
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
265 return StringUtil.ALL_INTERFACES;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
266 return _local.getAddress().getHostAddress();
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
267 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
268
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
269 @Override
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
270 public final String getLocalHost()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
271 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
272 if (_local.getAddress()==null || _local.getAddress().isAnyLocalAddress())
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
273 return StringUtil.ALL_INTERFACES;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
274 return _local.getAddress().getCanonicalHostName();
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
275 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
276
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
277 @Override
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
278 public final int getLocalPort()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
279 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
280 return _local.getPort();
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
281 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
282
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
283 @Override
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
284 public final String getRemoteAddr()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
285 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
286 return _remote.getAddress().getHostAddress();
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
287 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
288
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
289 @Override
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
290 public final String getRemoteHost()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
291 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
292 return _remote.getAddress().getCanonicalHostName();
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
293 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
294
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
295 @Override
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
296 public final int getRemotePort()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
297 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
298 return _remote.getPort();
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
299 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
300
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
301 @Override
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
302 public void flush()
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
303 throws IOException
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
304 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
305 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
306
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
307 @Override
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
308 public final int getMaxIdleTime()
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
309 {
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
310 return _maxIdleTime;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
311 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
312
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
313 @Override
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
314 public void setMaxIdleTime(int timeMs) throws IOException
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
315 {
978
bdb6eb0fbf93 simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 965
diff changeset
316 if (timeMs!=_maxIdleTime)
873
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
317 _socket.setSoTimeout(timeMs>0?timeMs:0);
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
318 _maxIdleTime=timeMs;
220ad4853cda remove StreamEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
319 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
320 }