Author: markt Date: Tue May 31 20:09:09 2016 New Revision: 1746338 URL: http://svn.apache.org/viewvc?rev=1746338&view=rev Log: Pull up error. It is going to be used more widely for propagating IOExceptions in non-blocking reads and writes.
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Modified: tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java?rev=1746338&r1=1746337&r2=1746338&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Tue May 31 20:09:09 2016 @@ -567,7 +567,6 @@ public class Nio2Endpoint extends Abstra private final Semaphore writePending = new Semaphore(1); private boolean writeInterest = false; // Guarded by writeCompletionHandler private boolean writeNotify = false; - private volatile IOException error = null; private CompletionHandler<Integer, SocketWrapperBase<Nio2Channel>> awaitBytesHandler = new CompletionHandler<Integer, SocketWrapperBase<Nio2Channel>>() { @@ -837,16 +836,6 @@ public class Nio2Endpoint extends Abstra public void setSendfileData(SendfileData sf) { this.sendfileData = sf; } public SendfileData getSendfileData() { return this.sendfileData; } - public IOException getError() { return error; } - public void setError(IOException error) { this.error = error; } - public void checkError() throws IOException { - IOException ioe = error; - if (ioe != null) { - throw ioe; - } - } - - @Override public boolean isReadyForRead() throws IOException { synchronized (readCompletionHandler) { Modified: tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java?rev=1746338&r1=1746337&r2=1746338&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/net/SocketWrapperBase.java Tue May 31 20:09:09 2016 @@ -61,6 +61,12 @@ public abstract class SocketWrapperBase< private volatile boolean blockingStatus = true; private final Lock blockingStatusReadLock; private final WriteLock blockingStatusWriteLock; + /* + * Used to record the first IOException that occurs during non-blocking + * read/writes that can't be usefully propagated up the stack since there is + * no user code or appropriate container code in the stack to handle it. + */ + private volatile IOException error = null; /** * The buffers used for communicating with the socket. @@ -97,6 +103,15 @@ public abstract class SocketWrapperBase< return endpoint; } + public IOException getError() { return error; } + public void setError(IOException error) { this.error = error; } + public void checkError() throws IOException { + IOException ioe = error; + if (ioe != null) { + throw ioe; + } + } + public boolean isUpgraded() { return upgraded; } public void setUpgraded(boolean upgraded) { this.upgraded = upgraded; } public boolean isSecure() { return secure; } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org