@@ -123,34 +123,51 @@ public InputStream getInputStream() throws IOException {
123
123
throw new SocketException ("Socket input is shutdown" );
124
124
}
125
125
126
+ System .out .println ("=====start=====" );
127
+
126
128
Selector selector = Selector .open ();
129
+ System .out .println ("=====1=====" );
127
130
unixSocketChannel .configureBlocking (false );
131
+ System .out .println ("=====2=====" );
128
132
unixSocketChannel .register (selector , SelectionKey .OP_READ );
133
+ System .out .println ("=====3=====" );
129
134
ByteBuffer buffer = ByteBuffer .allocate (256 );
130
135
136
+ System .out .println ("=====4=====" );
137
+
131
138
try {
132
139
while (true ) {
133
140
if (selector .select (timeout ) == 0 ) {
134
141
System .out .println ("Timeout (" + timeout + "ms) while waiting for data." );
135
142
break ;
136
143
}
144
+ System .out .println ("=====5=====" );
137
145
Iterator <SelectionKey > keyIterator = selector .selectedKeys ().iterator ();
146
+ System .out .println ("=====6=====" );
138
147
while (keyIterator .hasNext ()) {
148
+ System .out .println ("=====7=====" );
139
149
SelectionKey key = keyIterator .next ();
150
+ System .out .println ("=====8=====" );
140
151
keyIterator .remove ();
152
+ System .out .println ("=====9=====" );
141
153
if (key .isReadable ()) {
154
+ System .out .println ("=====10=====" );
142
155
int r = unixSocketChannel .read (buffer );
156
+ System .out .println ("=====11=====" );
143
157
if (r == -1 ) {
158
+ System .out .println ("=====12=====" );
144
159
unixSocketChannel .close ();
145
160
System .out .println ("Not accepting client messages anymore." );
146
161
return InputStream .nullInputStream ();
147
162
}
148
163
}
149
164
}
165
+ System .out .println ("=====13=====" );
150
166
buffer .flip ();
151
167
break ;
152
168
}
153
169
} finally {
170
+ System .out .println ("=====14=====" );
154
171
selector .close ();
155
172
}
156
173
0 commit comments