annotate src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java @ 966:2ac9e57ccae6

remove ByteArrayEndPoint
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 14 Oct 2016 02:26:05 -0600
parents 866f2e801618
children 8a8dc0b1742f
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.io.InterruptedIOException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
23 import java.nio.channels.ClosedChannelException;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
24 import java.nio.channels.SelectableChannel;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
25 import java.nio.channels.SelectionKey;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
26 import java.nio.channels.SocketChannel;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
27 import java.util.Locale;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
28 import java.util.concurrent.RejectedExecutionException;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
29
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
30 import org.eclipse.jetty.io.AsyncEndPoint;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
31 import org.eclipse.jetty.io.Buffer;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
32 import org.eclipse.jetty.io.ConnectedEndPoint;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
33 import org.eclipse.jetty.io.Connection;
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
34 import org.eclipse.jetty.io.EofException;
820
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
35 import org.slf4j.Logger;
8e9db0bbf4f9 remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents: 802
diff changeset
36 import org.slf4j.LoggerFactory;
940
b77d631b9e28 remove scheduleTimeout() and cancelTimeout()
Franklin Schmidt <fschmidt@gmail.com>
parents: 915
diff changeset
37
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
38
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 * An Endpoint that can be scheduled by {@link SelectorManager}.
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
42 */
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
43 public final class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPoint, ConnectedEndPoint
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
44 {
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
45 public static final Logger LOG=LoggerFactory.getLogger("org.eclipse.jetty.io.nio");
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
46
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
47 private final SelectorManager _manager;
961
790c01734386 make SelectChannelEndPoint._key final
Franklin Schmidt <fschmidt@gmail.com>
parents: 960
diff changeset
48 private final SelectionKey _key;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
49 private final Runnable _handler = new Runnable()
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
50 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
51 public void run() { handle(); }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
52 };
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
53
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
54 /**
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
55 * The connection instance is the handler for any IO activity on the endpoint.
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
56 * There is a different type of connection for HTTP, AJP, WebSocket and
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
57 * ProxyConnect. The connection may change for an SCEP as it is upgraded
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
58 * from HTTP to proxy connect or websocket.
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
59 */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
60 private volatile AsyncConnection _connection;
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
61 /*
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
62 private static final int STATE_NEEDS_DISPATCH = -1;
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
63 private static final int STATE_UNDISPATCHED = 0;
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
64 private static final int STATE_DISPATCHED = 1;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
65 private int _state;
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
66 */
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
67 private boolean isDispatched = false;
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
68
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
69 /** true if the last write operation succeed and wrote all offered bytes */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
70 private volatile boolean _writable = true;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
71
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
72 /** True if a thread has is blocked in {@link #blockReadable(long)} */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
73 private boolean _readBlocked;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
74
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
75 /** True if a thread has is blocked in {@link #blockWritable(long)} */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
76 private boolean _writeBlocked;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
77
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
78 private boolean _ishut = false;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
79
964
768414c16e10 remove SelectSet
Franklin Schmidt <fschmidt@gmail.com>
parents: 963
diff changeset
80 public SelectChannelEndPoint(SocketChannel channel, SelectorManager manager, SelectionKey key, int maxIdleTime)
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
81 throws IOException
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
82 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
83 super(channel, maxIdleTime);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
84
964
768414c16e10 remove SelectSet
Franklin Schmidt <fschmidt@gmail.com>
parents: 963
diff changeset
85 _manager = manager;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
86 _key = key;
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
87 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
88
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
89 @Override
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
90 public Connection getConnection()
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
91 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
92 return _connection;
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
93 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
94
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
95 @Override
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
96 public void setConnection(Connection connection)
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
97 {
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
98 _connection = (AsyncConnection)connection;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
99 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
100
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
101 /* ------------------------------------------------------------ */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
102 /** Called by selectSet to schedule handling
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
103 *
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
104 */
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
105 public synchronized void schedule()
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
106 {
961
790c01734386 make SelectChannelEndPoint._key final
Franklin Schmidt <fschmidt@gmail.com>
parents: 960
diff changeset
107 if (!_key.isValid())
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
108 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
109 /*
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
110 _readBlocked = false;
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
111 _writeBlocked = false;
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
112 this.notifyAll();
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
113 */
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
114 _key.cancel();
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
115 return;
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
116 }
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
117
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
118 // If there are threads dispatched reading and writing
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
119 if (_readBlocked || _writeBlocked)
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
120 {
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
121 // assert _dispatched;
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
122 if (_readBlocked && _key.isReadable())
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
123 _readBlocked = false;
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
124 if (_writeBlocked && _key.isWritable())
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
125 _writeBlocked = false;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
126
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
127 // wake them up is as good as a dispatched.
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
128 this.notifyAll();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
129
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
130 // we are not interested in further selecting
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
131 _key.interestOps(0);
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
132 if( !isDispatched )
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
133 updateKey();
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
134 return;
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
135 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
136
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
137 // Remove writeable op
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
138 if ((_key.readyOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE && (_key.interestOps() & SelectionKey.OP_WRITE) == SelectionKey.OP_WRITE)
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
139 {
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
140 // Remove writeable op
962
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
141 int interestOps = _key.interestOps() & ~SelectionKey.OP_WRITE;
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
142 _key.interestOps(interestOps);
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
143 _writable = true; // Once writable is in ops, only removed with dispatch.
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
144 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
145
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
146 // If dispatched, then deregister interest
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
147 if (isDispatched)
953
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
148 _key.interestOps(0);
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
149 else
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
150 {
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
151 // other wise do the dispatch
7db4a488fc82 simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents: 952
diff changeset
152 dispatch();
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
153 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
154 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
155
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
156 @Override
947
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
157 public synchronized void dispatch()
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
158 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
159 if( !isDispatched )
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
160 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
161 isDispatched = true;
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
162 try {
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
163 _manager.execute(_handler);
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
164 } catch(RejectedExecutionException e) {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
165 isDispatched = false;
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
166 LOG.warn("Dispatched Failed! "+this+" to "+_manager);
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
167 // updateKey();
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
168 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
169 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
170 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
171
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
172 @Override
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
173 public int fill(Buffer buffer) throws IOException
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
174 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
175 int fill=super.fill(buffer);
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
176 return fill;
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
177 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
178
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
179 @Override
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
180 public int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
181 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
182 int l = super.flush(header, buffer, trailer);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
183
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
184 // If there was something to write and it wasn't written, then we are not writable.
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
185 if (l==0 && ( header!=null && header.hasContent() || buffer!=null && buffer.hasContent() || trailer!=null && trailer.hasContent()))
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
186 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
187 synchronized (this)
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
188 {
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
189 _writable = false;
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
190 if( !isDispatched )
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
191 updateKey();
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
192 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
193 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
194 else if (l>0)
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
195 {
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
196 _writable = true;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
197 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
198 return l;
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
199 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
200
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
201 @Override
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
202 public int flush(Buffer buffer) throws IOException
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
203 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
204 int l = super.flush(buffer);
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
205
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
206 // If there was something to write and it wasn't written, then we are not writable.
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
207 if (l==0 && buffer!=null && buffer.hasContent())
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
208 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
209 synchronized (this)
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
210 {
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
211 _writable = false;
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
212 if( !isDispatched )
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
213 updateKey();
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
214 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
215 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
216 else if (l>0)
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
217 {
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
218 _writable = true;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
219 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
220
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
221 return l;
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
222 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
223
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
224 /* ------------------------------------------------------------ */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
225 /*
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
226 * Allows thread to block waiting for further events.
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
227 */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
228 @Override
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
229 public synchronized boolean blockReadable(long timeoutMs) throws IOException
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
230 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
231 if (isInputShutdown())
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
232 throw new EofException();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
233
964
768414c16e10 remove SelectSet
Franklin Schmidt <fschmidt@gmail.com>
parents: 963
diff changeset
234 long now = _manager.getNow();
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
235 long end = now+timeoutMs;
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
236 try
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
237 {
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
238 _readBlocked = true;
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
239 while (!isInputShutdown() && _readBlocked)
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
240 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
241 try
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
242 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
243 updateKey();
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
244 this.wait(timeoutMs>0?(end-now):10000);
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
245 }
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
246 catch (final InterruptedException e)
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
247 {
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
248 LOG.warn("",e);
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
249 }
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
250 finally
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
251 {
964
768414c16e10 remove SelectSet
Franklin Schmidt <fschmidt@gmail.com>
parents: 963
diff changeset
252 now = _manager.getNow();
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
253 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
254
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
255 if (_readBlocked && timeoutMs>0 && now>=end)
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
256 return false;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
257 }
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
258 }
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
259 finally
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
260 {
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
261 _readBlocked = false;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
262 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
263 return true;
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
264 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
265
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
266 /* ------------------------------------------------------------ */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
267 /*
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
268 * Allows thread to block waiting for further events.
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
269 */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
270 @Override
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
271 public synchronized boolean blockWritable(long timeoutMs) throws IOException
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
272 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
273 if (isOutputShutdown())
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
274 throw new EofException();
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
275
964
768414c16e10 remove SelectSet
Franklin Schmidt <fschmidt@gmail.com>
parents: 963
diff changeset
276 long now=_manager.getNow();
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
277 long end=now+timeoutMs;
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
278 try
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
279 {
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
280 _writeBlocked = true;
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
281 while (_writeBlocked && !isOutputShutdown())
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
282 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
283 try
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
284 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
285 updateKey();
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
286 this.wait(timeoutMs>0?(end-now):10000);
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
287 }
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
288 catch (final InterruptedException e)
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
289 {
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
290 LOG.warn("",e);
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
291 }
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
292 finally
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
293 {
964
768414c16e10 remove SelectSet
Franklin Schmidt <fschmidt@gmail.com>
parents: 963
diff changeset
294 now = _manager.getNow();
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
295 }
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
296 if (_writeBlocked && timeoutMs>0 && now>=end)
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
297 return false;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
298 }
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
299 }
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
300 finally
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
301 {
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
302 _writeBlocked = false;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
303 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
304 return true;
6b210bb66c63 remove ThreadPool
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
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
307 @Override
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
308 public boolean hasProgressed()
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
309 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
310 return false;
6b210bb66c63 remove ThreadPool
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
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
313 /* ------------------------------------------------------------ */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
314 /**
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
315 * Updates selection key. Adds operations types to the selection key as needed. No operations
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
316 * are removed as this is only done during dispatch. This method records the new key and
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
317 * schedules a call to doUpdateKey to do the keyChange
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
318 */
962
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
319 private synchronized void updateKey()
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
320 {
962
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
321 if( getChannel().isOpen() && _key.isValid())
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
322 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
323 boolean read_interest = _readBlocked || (!isDispatched && !_connection.isSuspended());
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
324 boolean write_interest = _writeBlocked || (!isDispatched && !_writable);
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
325 // boolean write_interest = _writeBlocked || !isDispatched;
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
326 // boolean write_interest = true;
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
327
962
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
328 int interestOps =
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
329 ((!_socket.isInputShutdown() && read_interest ) ? SelectionKey.OP_READ : 0)
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
330 | ((!_socket.isOutputShutdown()&& write_interest) ? SelectionKey.OP_WRITE : 0);
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
331 if( _key.interestOps() != interestOps ) {
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
332 _key.interestOps(interestOps);
964
768414c16e10 remove SelectSet
Franklin Schmidt <fschmidt@gmail.com>
parents: 963
diff changeset
333 _manager.getSelector().update();
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
334 }
962
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
335 } else {
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
336 _key.cancel();
94498d6daf5b remove SelectChannelEndPoint._interestOps
Franklin Schmidt <fschmidt@gmail.com>
parents: 961
diff changeset
337 // update needed?
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
338 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
339 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
340
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
341
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
342 private void handle()
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
343 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
344 try
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
345 {
947
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
346 try
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
347 {
965
866f2e801618 handle() returns void
Franklin Schmidt <fschmidt@gmail.com>
parents: 964
diff changeset
348 _connection.handle();
947
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
349 }
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
350 catch (ClosedChannelException e)
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
351 {
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
352 LOG.trace("",e);
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
353 }
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
354 catch (EofException e)
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
355 {
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
356 LOG.debug("EOF", e);
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
357 try{close();}
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
358 catch(IOException e2){LOG.trace("",e2);}
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
359 }
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
360 catch (IOException e)
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
361 {
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
362 LOG.warn(e.toString());
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
363 try{close();}
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
364 catch(IOException e2){LOG.trace("",e2);}
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
365 }
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
366 catch (Throwable e)
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
367 {
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
368 LOG.warn("handle failed", e);
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
369 try{close();}
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
370 catch(IOException e2){LOG.trace("",e2);}
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
371 }
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
372 finally
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
373 {
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
374 if (!_ishut && isInputShutdown() && isOpen())
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
375 {
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
376 _ishut = true;
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
377 try
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
378 {
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
379 _connection.onInputShutdown();
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
380 }
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
381 catch(Throwable x)
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
382 {
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
383 LOG.warn("onInputShutdown failed", x);
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
384 try{close();}
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
385 catch(IOException e2){LOG.trace("",e2);}
64f3d8dae31d simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 946
diff changeset
386 }
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
387 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
388 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
389 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
390 finally
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
391 {
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
392 isDispatched = false;
960
3cd4c706a61f simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 959
diff changeset
393 updateKey();
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
394 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
395 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
396
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
397 @Override
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
398 public void close() throws IOException
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
399 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
400 try
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
401 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
402 super.close();
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
403 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
404 catch (IOException e)
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
405 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
406 LOG.trace("",e);
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
407 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
408 finally
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
409 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
410 updateKey();
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
411 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
412 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
413
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
414 @Override
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
415 public String toString()
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
416 {
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
417 // Do NOT use synchronized (this)
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
418 // because it's very easy to deadlock when debugging is enabled.
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
419 // We do a best effort to print the right toString() and that's it.
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
420 SelectionKey key = _key;
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
421 String keyString = "";
961
790c01734386 make SelectChannelEndPoint._key final
Franklin Schmidt <fschmidt@gmail.com>
parents: 960
diff changeset
422 if (key.isValid())
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
423 {
961
790c01734386 make SelectChannelEndPoint._key final
Franklin Schmidt <fschmidt@gmail.com>
parents: 960
diff changeset
424 if (key.isReadable())
790c01734386 make SelectChannelEndPoint._key final
Franklin Schmidt <fschmidt@gmail.com>
parents: 960
diff changeset
425 keyString += "r";
790c01734386 make SelectChannelEndPoint._key final
Franklin Schmidt <fschmidt@gmail.com>
parents: 960
diff changeset
426 if (key.isWritable())
790c01734386 make SelectChannelEndPoint._key final
Franklin Schmidt <fschmidt@gmail.com>
parents: 960
diff changeset
427 keyString += "w";
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
428 }
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
429 else
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
430 {
961
790c01734386 make SelectChannelEndPoint._key final
Franklin Schmidt <fschmidt@gmail.com>
parents: 960
diff changeset
431 keyString += "!";
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
432 }
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
433 return String.format("SCEP@%x{l(%s)<->r(%s),dispatched=%b,open=%b,ishut=%b,oshut=%b,rb=%b,wb=%b,w=%b,i=%s}-{%s}",
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
434 hashCode(),
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
435 _socket.getRemoteSocketAddress(),
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
436 _socket.getLocalSocketAddress(),
963
4b6216fa9cec replace SelectChannelEndPoint._state with isDispatched
Franklin Schmidt <fschmidt@gmail.com>
parents: 962
diff changeset
437 isDispatched,
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
438 isOpen(),
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
439 isInputShutdown(),
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
440 isOutputShutdown(),
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
441 _readBlocked,
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
442 _writeBlocked,
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
443 _writable,
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
444 keyString,
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
445 _connection);
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
446 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
447
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
448 /* ------------------------------------------------------------ */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
449 /**
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
450 * Don't set the SoTimeout
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
451 * @see org.eclipse.jetty.io.nio.ChannelEndPoint#setMaxIdleTime(int)
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
452 */
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
453 @Override
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
454 public void setMaxIdleTime(int timeMs) throws IOException
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
455 {
955
6f49b8dfffe6 simplify SelectChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents: 953
diff changeset
456 _maxIdleTime = timeMs;
865
6b210bb66c63 remove ThreadPool
Franklin Schmidt <fschmidt@gmail.com>
parents: 820
diff changeset
457 }
802
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
458
3428c60d7cfc replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
459 }