Lines 26-31
Link Here
|
26 |
import java.util.concurrent.TimeUnit; |
26 |
import java.util.concurrent.TimeUnit; |
27 |
import java.util.concurrent.TimeoutException; |
27 |
import java.util.concurrent.TimeoutException; |
28 |
|
28 |
|
|
|
29 |
import org.apache.juli.logging.Log; |
30 |
import org.apache.juli.logging.LogFactory; |
31 |
|
29 |
/** |
32 |
/** |
30 |
* Base class for a SocketChannel wrapper used by the endpoint. |
33 |
* Base class for a SocketChannel wrapper used by the endpoint. |
31 |
* This way, logic for a SSL socket channel remains the same as for |
34 |
* This way, logic for a SSL socket channel remains the same as for |
Lines 33-38
Link Here
|
33 |
*/ |
36 |
*/ |
34 |
public class Nio2Channel implements AsynchronousByteChannel { |
37 |
public class Nio2Channel implements AsynchronousByteChannel { |
35 |
|
38 |
|
|
|
39 |
private static final Log log = LogFactory.getLog(Nio2Channel.class); |
36 |
protected static ByteBuffer emptyBuf = ByteBuffer.allocate(0); |
40 |
protected static ByteBuffer emptyBuf = ByteBuffer.allocate(0); |
37 |
|
41 |
|
38 |
protected AsynchronousSocketChannel sc = null; |
42 |
protected AsynchronousSocketChannel sc = null; |
Lines 134-142
Link Here
|
134 |
return super.toString()+":"+this.sc.toString(); |
138 |
return super.toString()+":"+this.sc.toString(); |
135 |
} |
139 |
} |
136 |
|
140 |
|
|
|
141 |
private volatile Exception stack = null; |
137 |
@Override |
142 |
@Override |
138 |
public Future<Integer> read(ByteBuffer dst) { |
143 |
public Future<Integer> read(ByteBuffer dst) { |
139 |
return sc.read(dst); |
144 |
Exception previous = stack; |
|
|
145 |
try { |
146 |
throw new Exception(Thread.currentThread().getName()); |
147 |
} catch (Exception e) { |
148 |
stack = e; |
149 |
} |
150 |
try { |
151 |
return sc.read(dst); |
152 |
} catch (java.nio.channels.ReadPendingException e) { |
153 |
log.error("Read pending exception, previous read stack was: ", previous); |
154 |
throw e; |
155 |
} |
140 |
} |
156 |
} |
141 |
|
157 |
|
142 |
@Override |
158 |
@Override |
Lines 148-153
Link Here
|
148 |
public <A> void read(ByteBuffer dst, |
164 |
public <A> void read(ByteBuffer dst, |
149 |
long timeout, TimeUnit unit, A attachment, |
165 |
long timeout, TimeUnit unit, A attachment, |
150 |
CompletionHandler<Integer, ? super A> handler) { |
166 |
CompletionHandler<Integer, ? super A> handler) { |
|
|
167 |
try { |
168 |
throw new Exception(Thread.currentThread().getName()); |
169 |
} catch (Exception e) { |
170 |
stack = e; |
171 |
} |
151 |
sc.read(dst, timeout, unit, attachment, handler); |
172 |
sc.read(dst, timeout, unit, attachment, handler); |
152 |
} |
173 |
} |
153 |
|
174 |
|