You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2015/12/18 14:48:41 UTC
svn commit: r1720785 -
/tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java
Author: remm
Date: Fri Dec 18 13:48:41 2015
New Revision: 1720785
URL: http://svn.apache.org/viewvc?rev=1720785&view=rev
Log:
Code cleanup.
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.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=1720785&r1=1720784&r2=1720785&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/Nio2Endpoint.java Fri Dec 18 13:48:41 2015
@@ -694,7 +694,7 @@ public class Nio2Endpoint extends Abstra
} else {
ioe = new IOException(exc);
}
- Nio2SocketWrapper.this.setError(ioe);
+ setError(ioe);
if (exc instanceof AsynchronousCloseException) {
// Release here since there will be no
// notify/dispatch to do the release.
@@ -713,28 +713,27 @@ public class Nio2Endpoint extends Abstra
synchronized (writeCompletionHandler) {
if (nBytes.intValue() < 0) {
failed(new EOFException(sm.getString("iob.failedwrite")), attachment);
- } else if (Nio2SocketWrapper.this.bufferedWrites.size() > 0) {
+ } else if (bufferedWrites.size() > 0) {
nestedWriteCompletionCount.get().incrementAndGet();
// Continue writing data using a gathering write
ArrayList<ByteBuffer> arrayList = new ArrayList<>();
if (attachment.hasRemaining()) {
arrayList.add(attachment);
}
- for (ByteBufferHolder buffer : Nio2SocketWrapper.this.bufferedWrites) {
+ for (ByteBufferHolder buffer : bufferedWrites) {
buffer.flip();
arrayList.add(buffer.getBuf());
}
- Nio2SocketWrapper.this.bufferedWrites.clear();
+ bufferedWrites.clear();
ByteBuffer[] array = arrayList.toArray(new ByteBuffer[arrayList.size()]);
- Nio2SocketWrapper.this.getSocket().write(array, 0, array.length,
- Nio2SocketWrapper.this.getNio2WriteTimeout(), TimeUnit.MILLISECONDS,
+ getSocket().write(array, 0, array.length,
+ getNio2WriteTimeout(), TimeUnit.MILLISECONDS,
array, gatheringWriteCompletionHandler);
nestedWriteCompletionCount.get().decrementAndGet();
} else if (attachment.hasRemaining()) {
// Regular write
nestedWriteCompletionCount.get().incrementAndGet();
- Nio2SocketWrapper.this.getSocket().write(attachment,
- Nio2SocketWrapper.this.getNio2WriteTimeout(),
+ getSocket().write(attachment, getNio2WriteTimeout(),
TimeUnit.MILLISECONDS, attachment, writeCompletionHandler);
nestedWriteCompletionCount.get().decrementAndGet();
} else {
@@ -759,7 +758,7 @@ public class Nio2Endpoint extends Abstra
} else {
ioe = new IOException(exc);
}
- Nio2SocketWrapper.this.setError(ioe);
+ setError(ioe);
writePending.release();
endpoint.processSocket(Nio2SocketWrapper.this, SocketEvent.OPEN_WRITE, true);
}
@@ -772,7 +771,7 @@ public class Nio2Endpoint extends Abstra
synchronized (writeCompletionHandler) {
if (nBytes.longValue() < 0) {
failed(new EOFException(sm.getString("iob.failedwrite")), attachment);
- } else if (Nio2SocketWrapper.this.bufferedWrites.size() > 0 || arrayHasData(attachment)) {
+ } else if (bufferedWrites.size() > 0 || arrayHasData(attachment)) {
// Continue writing data
nestedWriteCompletionCount.get().incrementAndGet();
ArrayList<ByteBuffer> arrayList = new ArrayList<>();
@@ -781,14 +780,14 @@ public class Nio2Endpoint extends Abstra
arrayList.add(buffer);
}
}
- for (ByteBufferHolder buffer : Nio2SocketWrapper.this.bufferedWrites) {
+ for (ByteBufferHolder buffer : bufferedWrites) {
buffer.flip();
arrayList.add(buffer.getBuf());
}
- Nio2SocketWrapper.this.bufferedWrites.clear();
+ bufferedWrites.clear();
ByteBuffer[] array = arrayList.toArray(new ByteBuffer[arrayList.size()]);
- Nio2SocketWrapper.this.getSocket().write(array, 0, array.length,
- Nio2SocketWrapper.this.getNio2WriteTimeout(), TimeUnit.MILLISECONDS,
+ getSocket().write(array, 0, array.length,
+ getNio2WriteTimeout(), TimeUnit.MILLISECONDS,
array, gatheringWriteCompletionHandler);
nestedWriteCompletionCount.get().decrementAndGet();
} else {
@@ -813,7 +812,7 @@ public class Nio2Endpoint extends Abstra
} else {
ioe = new IOException(exc);
}
- Nio2SocketWrapper.this.setError(ioe);
+ setError(ioe);
writePending.release();
endpoint.processSocket(Nio2SocketWrapper.this, SocketEvent.OPEN_WRITE, true);
}
@@ -1027,7 +1026,7 @@ public class Nio2Endpoint extends Abstra
} else {
ioe = new IOException(exc);
}
- Nio2SocketWrapper.this.setError(ioe);
+ setError(ioe);
readPending.release();
if (exc instanceof AsynchronousCloseException) {
// If already closed, don't call onError and close again
@@ -1082,7 +1081,7 @@ public class Nio2Endpoint extends Abstra
} else {
ioe = new IOException(exc);
}
- Nio2SocketWrapper.this.setError(ioe);
+ setError(ioe);
writePending.release();
state.state = Nio2Endpoint.isInline() ? CompletionState.ERROR : CompletionState.DONE;
if (state.handler != null) {
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org