日期:2014-05-19 浏览次数:20674 次
2012-3-1 9:41:21 org.apache.tomcat.util.net.NioEndpoint$Poller processSendfile 严重: java.lang.IllegalArgumentException: You can only write using the application write buffer provided by the handler. at org.apache.tomcat.util.net.SecureNioChannel.write(SecureNioChannel.java:472) at sun.nio.ch.FileChannelImpl.transferToArbitraryChannel(FileChannelImpl.java:465) at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:514) at org.apache.tomcat.util.net.NioEndpoint$Poller.processSendfile(NioEndpoint.java:1244) at org.apache.tomcat.util.net.NioEndpoint$Poller.processKey(NioEndpoint.java:1176) at org.apache.tomcat.util.net.NioEndpoint$Poller.run(NioEndpoint.java:1136) at java.lang.Thread.run(Thread.java:662)
/** * Writes a sequence of bytes to this channel from the given buffer. * * @param src The buffer from which bytes are to be retrieved * @return The number of bytes written, possibly zero * @throws IOException If some other I/O error occurs * TODO Implement this java.nio.channels.WritableByteChannel method */ @Override public int write(ByteBuffer src) throws IOException { if ( src == this.netOutBuffer ) { //we can get here through a recursive call //by using the NioBlockingSelector int written = sc.write(src); return written; } else { //make sure we can handle expand, and that we only use on buffer if ( (!this.isSendFile()) && (src != bufHandler.getWriteBuffer()) ) throw new IllegalArgumentException("You can only write using the application write buffer provided by the handler."); //are we closing or closed? if ( closing || closed) throw new IOException("Channel is in closing state."); //the number of bytes written int written = 0; if (!flush(netOutBuffer)) { //we haven't emptied out the buffer yet return written; }