Mercurial Hosting > luan
annotate src/org/eclipse/jetty/io/nio/SelectorManager.java @ 964:768414c16e10
remove SelectSet
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 14 Oct 2016 01:03:47 -0600 |
parents | 94498d6daf5b |
children | 0d20943cfea2 |
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.nio.channels.CancelledKeyException; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
23 import java.nio.channels.Channel; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
24 import java.nio.channels.ClosedSelectorException; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
25 import java.nio.channels.SelectableChannel; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
26 import java.nio.channels.SelectionKey; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
27 import java.nio.channels.ServerSocketChannel; |
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 import java.util.ArrayList; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
30 import java.util.List; |
944
1d24b6e422fa
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
943
diff
changeset
|
31 import java.util.Collections; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
32 import java.util.Set; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
33 import java.util.concurrent.ConcurrentHashMap; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
34 import java.util.concurrent.ConcurrentLinkedQueue; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
35 import java.util.concurrent.ConcurrentMap; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
36 import java.util.concurrent.CountDownLatch; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
37 import java.util.concurrent.TimeUnit; |
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 import org.eclipse.jetty.io.AsyncEndPoint; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
40 import org.eclipse.jetty.io.ConnectedEndPoint; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
41 import org.eclipse.jetty.io.Connection; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
42 import org.eclipse.jetty.io.EndPoint; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
43 import org.eclipse.jetty.util.TypeUtil; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
44 import org.eclipse.jetty.util.component.AbstractLifeCycle; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
45 import org.eclipse.jetty.util.component.AggregateLifeCycle; |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
46 import org.eclipse.jetty.util.component.Dumpable; |
820
8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
47 import org.slf4j.Logger; |
8e9db0bbf4f9
remove org.eclipse.jetty.util.log and upgrade slf4j
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
48 import org.slf4j.LoggerFactory; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
49 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
50 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
51 /* ------------------------------------------------------------ */ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
52 /** |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
53 * The Selector Manager manages and number of SelectSets to allow |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
54 * NIO scheduling to scale to large numbers of connections. |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
55 * <p> |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
56 */ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
57 public abstract class SelectorManager extends AbstractLifeCycle implements Dumpable |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
58 { |
964 | 59 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
|
60 |
964 | 61 private final int _maxIdleTime; |
62 private volatile long _now = System.currentTimeMillis(); | |
63 private SaneSelector _selector; | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
64 |
865 | 65 /* ------------------------------------------------------------ */ |
66 /** | |
67 * @param maxIdleTime The maximum period in milli seconds that a connection may be idle before it is closed. | |
68 * @see #setLowResourcesMaxIdleTime(long) | |
69 */ | |
964 | 70 public SelectorManager(int maxIdleTime) |
865 | 71 { |
951
e542a9cc75ef
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
950
diff
changeset
|
72 _maxIdleTime = maxIdleTime; |
865 | 73 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
74 |
865 | 75 /* ------------------------------------------------------------ */ |
76 /** Register a channel | |
77 * @param channel | |
78 */ | |
964 | 79 public final void register(SocketChannel channel) |
865 | 80 { |
964 | 81 /* |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
82 SelectSet set = _selectSet; |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
83 if (set!=null) |
865 | 84 { |
85 set.addChange(channel); | |
86 } | |
964 | 87 */ |
88 try { | |
89 SelectionKey key = _selector.register(channel,0,null); | |
90 SelectChannelEndPoint endpoint = new SelectChannelEndPoint(channel,this,key, _maxIdleTime); | |
91 endpoint.setConnection(newConnection(channel,endpoint)); | |
92 key.attach(endpoint); | |
93 _selector.update(); | |
94 //System.out.println("qqqqqqqqqqqqqqqqqqqqqqqqqqqqq b"); | |
95 endpoint.schedule(); | |
96 } catch(IOException e) { | |
97 LOG.warn("",e); | |
98 try { | |
99 channel.close(); | |
100 } catch(IOException e2) { | |
101 LOG.warn("",e2); | |
102 } | |
103 } | |
865 | 104 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
105 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
106 |
865 | 107 public abstract void execute(Runnable task); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
108 |
964 | 109 |
865 | 110 @Override |
111 protected void doStart() throws Exception | |
112 { | |
964 | 113 _selector = new SaneSelector(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
114 |
865 | 115 super.doStart(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
116 |
865 | 117 // start a thread to Select |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
118 execute(new Runnable() |
865 | 119 { |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
120 public void run() |
865 | 121 { |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
122 String name=Thread.currentThread().getName(); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
123 try |
865 | 124 { |
964 | 125 if (_selector==null) |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
126 return; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
127 |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
128 Thread.currentThread().setName(name+" Selector"); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
129 LOG.debug("Starting {} on {}",Thread.currentThread(),this); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
130 while (isRunning()) |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
131 { |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
132 try |
865 | 133 { |
964 | 134 doSelect(); |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
135 } |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
136 catch(IOException e) |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
137 { |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
138 LOG.trace("",e); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
139 } |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
140 catch(Exception e) |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
141 { |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
142 LOG.warn("",e); |
865 | 143 } |
144 } | |
145 } | |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
146 finally |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
147 { |
964 | 148 _selector = null; |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
149 LOG.debug("Stopped {} on {}",Thread.currentThread(),this); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
150 Thread.currentThread().setName(name); |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
151 } |
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
152 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
153 |
954
a021c4c9c244
use just one SelectSet per SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
953
diff
changeset
|
154 }); |
865 | 155 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
156 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
157 |
865 | 158 @Override |
964 | 159 protected synchronized void doStop() throws Exception |
865 | 160 { |
964 | 161 if (_selector!=null) |
865 | 162 { |
964 | 163 // close endpoints and selector |
164 for (SelectionKey key : _selector.keys()) | |
165 { | |
166 EndPoint endpoint = (EndPoint)key.attachment(); | |
167 try | |
168 { | |
169 endpoint.close(); | |
170 } | |
171 catch(IOException e) | |
172 { | |
173 LOG.trace("",e); | |
174 } | |
175 } | |
176 | |
177 try | |
178 { | |
179 _selector.close(); | |
180 } | |
181 catch (IOException e) | |
182 { | |
183 LOG.trace("",e); | |
184 } | |
865 | 185 } |
186 super.doStop(); | |
187 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
188 |
958
fc521d2f098e
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
957
diff
changeset
|
189 public abstract AsyncConnection newConnection(SocketChannel channel, SelectChannelEndPoint endpoint); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
190 |
960
3cd4c706a61f
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
959
diff
changeset
|
191 @Override |
865 | 192 public String dump() |
193 { | |
194 return AggregateLifeCycle.dump(this); | |
195 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
196 |
960
3cd4c706a61f
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
959
diff
changeset
|
197 @Override |
865 | 198 public void dump(Appendable out, String indent) throws IOException |
199 { | |
200 AggregateLifeCycle.dumpObject(out,this); | |
964 | 201 // AggregateLifeCycle.dump(out,indent,Collections.emptyList()); |
865 | 202 } |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
203 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
204 |
964 | 205 // from SelectSet |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
206 |
964 | 207 private void doSelect() throws IOException |
208 { | |
209 try | |
865 | 210 { |
964 | 211 _selector.select(); |
958
fc521d2f098e
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
957
diff
changeset
|
212 |
964 | 213 // Look for things to do |
214 for (SelectionKey key: _selector.selectedKeys()) | |
865 | 215 { |
964 | 216 try |
217 { | |
218 if (!key.isValid()) | |
219 { | |
220 key.cancel(); | |
221 continue; | |
222 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
223 |
964 | 224 if (key.isReadable()||key.isWritable()) { |
225 SelectChannelEndPoint endpoint = (SelectChannelEndPoint)key.attachment(); | |
226 endpoint.schedule(); | |
865 | 227 } |
228 } | |
964 | 229 catch (CancelledKeyException e) |
230 { | |
231 // LOG.trace("",e); | |
865 | 232 LOG.warn("",e); |
964 | 233 } |
234 catch (Exception e) | |
865 | 235 { |
964 | 236 LOG.warn("",e); |
865 | 237 } |
238 } | |
953
7db4a488fc82
simplify SelectorManager
Franklin Schmidt <fschmidt@gmail.com>
parents:
952
diff
changeset
|
239 |
964 | 240 // Everything always handled |
241 _selector.selectedKeys().clear(); | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
242 |
964 | 243 _now = System.currentTimeMillis(); |
865 | 244 } |
964 | 245 catch (ClosedSelectorException e) |
865 | 246 { |
964 | 247 if (isRunning()) |
248 LOG.warn("",e); | |
249 else | |
250 LOG.trace("",e); | |
251 } | |
252 catch (CancelledKeyException e) | |
253 { | |
254 LOG.trace("",e); | |
865 | 255 } |
256 } | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
257 |
964 | 258 public final long getNow() |
259 { | |
260 return _now; | |
261 } | |
262 | |
263 final SaneSelector getSelector() | |
264 { | |
265 return _selector; | |
266 } | |
267 | |
268 @Override | |
269 public final String toString() | |
270 { | |
271 SaneSelector selector=_selector; | |
272 return String.format("%s keys=%d selected=%d", | |
273 super.toString(), | |
274 selector != null && selector.isOpen() ? selector.keys().size() : -1, | |
275 selector != null && selector.isOpen() ? selector.selectedKeys().size() : -1); | |
276 } | |
277 | |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
278 } |