Mercurial Hosting > luan
annotate src/org/eclipse/jetty/io/EndPoint.java @ 1019:f126d30e04a4
start replacing BufferCache with StringCache
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 31 Oct 2016 03:33:42 -0600 |
parents | bdb6eb0fbf93 |
children | 2b769da7f67d |
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; |
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; |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
22 import java.nio.channels.SocketChannel; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
23 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
24 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
25 /** |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
26 * |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
27 * A transport EndPoint |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
28 */ |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
29 public interface EndPoint |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
30 { |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
31 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
32 * Shutdown any backing output stream associated with the endpoint |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
33 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
34 void shutdownOutput() throws IOException; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
35 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
36 boolean isOutputShutdown(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
37 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
38 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
39 * Shutdown any backing input stream associated with the endpoint |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
40 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
41 void shutdownInput() throws IOException; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
42 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
43 boolean isInputShutdown(); |
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:
802
diff
changeset
|
45 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
46 * Close any backing stream associated with the endpoint |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
47 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
48 void close() throws IOException; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
49 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
50 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
51 * Fill the buffer from the current putIndex to it's capacity from whatever |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
52 * byte source is backing the buffer. The putIndex is increased if bytes filled. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
53 * The buffer may chose to do a compact before filling. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
54 * @return an <code>int</code> value indicating the number of bytes |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
55 * filled or -1 if EOF is reached. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
56 * @throws EofException If input is shutdown or the endpoint is closed. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
57 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
58 int fill(Buffer buffer) throws IOException; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
59 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
60 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
61 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
62 * Flush the buffer from the current getIndex to it's putIndex using whatever byte |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
63 * sink is backing the buffer. The getIndex is updated with the number of bytes flushed. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
64 * Any mark set is cleared. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
65 * If the entire contents of the buffer are flushed, then an implicit empty() is done. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
66 * |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
67 * @param buffer The buffer to flush. This buffers getIndex is updated. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
68 * @return the number of bytes written |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
69 * @throws EofException If the endpoint is closed or output is shutdown. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
70 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
71 int flush(Buffer buffer) throws IOException; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
72 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
73 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
74 * Flush the buffer from the current getIndex to it's putIndex using whatever byte |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
75 * sink is backing the buffer. The getIndex is updated with the number of bytes flushed. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
76 * Any mark set is cleared. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
77 * If the entire contents of the buffer are flushed, then an implicit empty() is done. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
78 * The passed header/trailer buffers are written before/after the contents of this buffer. This may be done |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
79 * either as gather writes, as a poke into this buffer or as several writes. The implementation is free to |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
80 * select the optimal mechanism. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
81 * @param header A buffer to write before flushing this buffer. This buffers getIndex is updated. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
82 * @param buffer The buffer to flush. This buffers getIndex is updated. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
83 * @param trailer A buffer to write after flushing this buffer. This buffers getIndex is updated. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
84 * @return the total number of bytes written. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
85 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
86 int flush(Buffer header, Buffer buffer, Buffer trailer) throws IOException; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
87 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
88 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
89 /* ------------------------------------------------------------ */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
90 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
91 * @return The local IP address to which this <code>EndPoint</code> is bound, or <code>null</code> |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
92 * if this <code>EndPoint</code> does not represent a network connection. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
93 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
94 public String getLocalAddr(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
95 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
96 /* ------------------------------------------------------------ */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
97 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
98 * @return The local host name to which this <code>EndPoint</code> is bound, or <code>null</code> |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
99 * if this <code>EndPoint</code> does not represent a network connection. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
100 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
101 public String getLocalHost(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
102 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
103 /* ------------------------------------------------------------ */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
104 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
105 * @return The local port number on which this <code>EndPoint</code> is listening, or <code>0</code> |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
106 * if this <code>EndPoint</code> does not represent a network connection. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
107 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
108 public int getLocalPort(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
109 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
110 /* ------------------------------------------------------------ */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
111 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
112 * @return The remote IP address to which this <code>EndPoint</code> is connected, or <code>null</code> |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
113 * if this <code>EndPoint</code> does not represent a network connection. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
114 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
115 public String getRemoteAddr(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
116 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
117 /* ------------------------------------------------------------ */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
118 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
119 * @return The host name of the remote machine to which this <code>EndPoint</code> is connected, or <code>null</code> |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
120 * if this <code>EndPoint</code> does not represent a network connection. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
121 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
122 public String getRemoteHost(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
123 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
124 /* ------------------------------------------------------------ */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
125 /** |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
126 * @return The remote port number to which this <code>EndPoint</code> is connected, or <code>0</code> |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
127 * if this <code>EndPoint</code> does not represent a network connection. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
128 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
129 public int getRemotePort(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
130 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
131 public boolean isBlocking(); |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
132 |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
133 public boolean blockReadable(long millisecs) throws IOException; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
134 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
135 public boolean blockWritable(long millisecs) throws IOException; |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
136 |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
137 public boolean isOpen(); |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
138 |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
139 public SocketChannel getChannel(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
140 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
141 /* ------------------------------------------------------------ */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
142 /** Flush any buffered output. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
143 * May fail to write all data if endpoint is non-blocking |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
144 * @throws EofException If the endpoint is closed or output is shutdown. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
145 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
146 public void flush() throws IOException; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
147 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
148 /* ------------------------------------------------------------ */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
149 /** Get the max idle time in ms. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
150 * <p>The max idle time is the time the endpoint can be idle before |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
151 * extraordinary handling takes place. This loosely corresponds to |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
152 * the {@link java.net.Socket#getSoTimeout()} for blocking connections, |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
153 * but {@link AsyncEndPoint} implementations must use other mechanisms |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
154 * to implement the max idle time. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
155 * @return the max idle time in ms or if ms <= 0 implies an infinite timeout |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
156 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
157 public int getMaxIdleTime(); |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
158 |
978
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
159 /* ------------------------------------------------------------ */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
160 /** Set the max idle time. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
161 * @param timeMs the max idle time in MS. Timeout <= 0 implies an infinite timeout |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
162 * @throws IOException if the timeout cannot be set. |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
163 */ |
bdb6eb0fbf93
simplify ChannelEndPoint
Franklin Schmidt <fschmidt@gmail.com>
parents:
802
diff
changeset
|
164 public void setMaxIdleTime(int timeMs) throws IOException; |
802
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
165 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
166 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
167 |
3428c60d7cfc
replace jetty jars with source
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff
changeset
|
168 } |