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; |
29 |
import org.apache.tomcat.util.net.SecureNio2Channel.ApplicationBufferHandler; |
31 |
import org.apache.tomcat.util.net.SecureNio2Channel.ApplicationBufferHandler; |
30 |
|
32 |
|
31 |
/** |
33 |
/** |
Lines 35-40
Link Here
|
35 |
*/ |
37 |
*/ |
36 |
public class Nio2Channel implements AsynchronousByteChannel { |
38 |
public class Nio2Channel implements AsynchronousByteChannel { |
37 |
|
39 |
|
|
|
40 |
private static final Log log = LogFactory.getLog(Nio2Channel.class); |
38 |
protected static ByteBuffer emptyBuf = ByteBuffer.allocate(0); |
41 |
protected static ByteBuffer emptyBuf = ByteBuffer.allocate(0); |
39 |
|
42 |
|
40 |
protected AsynchronousSocketChannel sc = null; |
43 |
protected AsynchronousSocketChannel sc = null; |
Lines 128-136
Link Here
|
128 |
return super.toString()+":"+this.sc.toString(); |
131 |
return super.toString()+":"+this.sc.toString(); |
129 |
} |
132 |
} |
130 |
|
133 |
|
|
|
134 |
private volatile Exception stack = null; |
131 |
@Override |
135 |
@Override |
132 |
public Future<Integer> read(ByteBuffer dst) { |
136 |
public Future<Integer> read(ByteBuffer dst) { |
133 |
return sc.read(dst); |
137 |
Exception previous = stack; |
|
|
138 |
try { |
139 |
throw new Exception(Thread.currentThread().getName()); |
140 |
} catch (Exception e) { |
141 |
stack = e; |
142 |
} |
143 |
try { |
144 |
return sc.read(dst); |
145 |
} catch (java.nio.channels.ReadPendingException e) { |
146 |
log.error("Read pending exception, previous read stack was: ", previous); |
147 |
throw e; |
148 |
} |
134 |
} |
149 |
} |
135 |
|
150 |
|
136 |
@Override |
151 |
@Override |
Lines 142-147
Link Here
|
142 |
public <A> void read(ByteBuffer dst, |
157 |
public <A> void read(ByteBuffer dst, |
143 |
long timeout, TimeUnit unit, A attachment, |
158 |
long timeout, TimeUnit unit, A attachment, |
144 |
CompletionHandler<Integer, ? super A> handler) { |
159 |
CompletionHandler<Integer, ? super A> handler) { |
|
|
160 |
try { |
161 |
throw new Exception(Thread.currentThread().getName()); |
162 |
} catch (Exception e) { |
163 |
stack = e; |
164 |
} |
145 |
sc.read(dst, timeout, unit, attachment, handler); |
165 |
sc.read(dst, timeout, unit, attachment, handler); |
146 |
} |
166 |
} |
147 |
|
167 |
|