Author: markt
Date: Thu Dec 18 14:24:09 2014
New Revision: 1646465
URL: http://svn.apache.org/r1646465
Log:
Simplify. NioChannel.getAttachment(boolean) was only ever called with a
parameter of false.
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletInputStream.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java?rev=1646465&r1=1646464&r2=1646465&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AjpNioProcessor.java Thu
Dec 18 14:24:09 2014
@@ -254,7 +254,7 @@ public class AjpNioProcessor extends Abs
if (param == null) return;
long timeout = ((Long)param).longValue();
final KeyAttachment ka =
-
(KeyAttachment)socketWrapper.getSocket().getAttachment(false);
+ (KeyAttachment)socketWrapper.getSocket().getAttachment();
ka.setTimeout(timeout);
break;
}
@@ -275,7 +275,7 @@ public class AjpNioProcessor extends Abs
// poller. Therefore, it needs to be reset once asycn processing has
// finished.
final KeyAttachment attach =
- (KeyAttachment)socketWrapper.getSocket().getAttachment(false);
+ (KeyAttachment)socketWrapper.getSocket().getAttachment();
if (!getErrorState().isError() && attach != null &&
asyncStateMachine.isAsyncDispatching()) {
long soTimeout = endpoint.getSoTimeout();
@@ -296,7 +296,7 @@ public class AjpNioProcessor extends Abs
throws IOException {
KeyAttachment att =
- (KeyAttachment) socketWrapper.getSocket().getAttachment(false);
+ (KeyAttachment) socketWrapper.getSocket().getAttachment();
if ( att == null ) throw new IOException("Key must be cancelled");
ByteBuffer writeBuffer =
@@ -363,7 +363,7 @@ public class AjpNioProcessor extends Abs
}
try {
NioEndpoint.KeyAttachment att =
- (NioEndpoint.KeyAttachment)
socketWrapper.getSocket().getAttachment(false);
+ (NioEndpoint.KeyAttachment)
socketWrapper.getSocket().getAttachment();
if ( att == null ) throw new IOException("Key must be
cancelled.");
nRead = pool.read(readBuffer, socketWrapper.getSocket(),
selector, att.getTimeout());
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=1646465&r1=1646464&r2=1646465&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
Thu Dec 18 14:24:09 2014
@@ -112,7 +112,7 @@ public class Http11NioProcessor extends
long soTimeout = endpoint.getSoTimeout();
RequestInfo rp = request.getRequestProcessor();
- final NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
+ final NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment();
try {
rp.setStage(org.apache.coyote.Constants.STAGE_SERVICE);
if (!getAdapter().event(request, response, status)) {
@@ -169,7 +169,7 @@ public class Http11NioProcessor extends
@Override
protected void resetTimeouts() {
- final NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
+ final NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment();
if (!getErrorState().isError() && attach != null &&
asyncStateMachine.isAsyncDispatching()) {
long soTimeout = endpoint.getSoTimeout();
@@ -459,10 +459,10 @@ public class Http11NioProcessor extends
break;
}
case COMET_CLOSE: {
- if (socketWrapper==null ||
socketWrapper.getSocket().getAttachment(false)==null) {
+ if (socketWrapper==null ||
socketWrapper.getSocket().getAttachment()==null) {
return;
}
- NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
+ NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment();
attach.setCometOps(NioEndpoint.OP_CALLBACK);
RequestInfo rp = request.getRequestProcessor();
if (rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE) {
@@ -477,10 +477,10 @@ public class Http11NioProcessor extends
if (param==null) {
return;
}
- if (socketWrapper==null ||
socketWrapper.getSocket().getAttachment(false)==null) {
+ if (socketWrapper==null ||
socketWrapper.getSocket().getAttachment()==null) {
return;
}
- NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
+ NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment();
long timeout = ((Long)param).longValue();
//if we are not piggy backing on a worker thread, set the timeout
RequestInfo rp = request.getRequestProcessor();
@@ -500,10 +500,10 @@ public class Http11NioProcessor extends
if (param==null) {
return;
}
- if (socketWrapper==null ||
socketWrapper.getSocket().getAttachment(false)==null) {
+ if (socketWrapper==null ||
socketWrapper.getSocket().getAttachment()==null) {
return;
}
- NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment(false);
+ NioEndpoint.KeyAttachment attach =
(NioEndpoint.KeyAttachment)socketWrapper.getSocket().getAttachment();
long timeout = ((Long)param).longValue();
//if we are not piggy backing on a worker thread, set the timeout
attach.setTimeout(timeout);
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java?rev=1646465&r1=1646464&r2=1646465&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioInputBuffer.java
Thu Dec 18 14:24:09 2014
@@ -420,7 +420,7 @@ public class InternalNioInputBuffer exte
}
try {
NioEndpoint.KeyAttachment att =
- (NioEndpoint.KeyAttachment)
socket.getAttachment(false);
+ (NioEndpoint.KeyAttachment) socket.getAttachment();
if (att == null) {
throw new IOException("Key must be cancelled.");
}
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java?rev=1646465&r1=1646464&r2=1646465&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/InternalNioOutputBuffer.java
Thu Dec 18 14:24:09 2014
@@ -150,7 +150,7 @@ public class InternalNioOutputBuffer ext
if ( flip ) bytebuffer.flip();
int written = 0;
- NioEndpoint.KeyAttachment att =
(NioEndpoint.KeyAttachment)socket.getAttachment(false);
+ NioEndpoint.KeyAttachment att =
(NioEndpoint.KeyAttachment)socket.getAttachment();
if ( att == null ) throw new IOException("Key must be cancelled");
long writeTimeout = att.getWriteTimeout();
Selector selector = null;
@@ -219,7 +219,7 @@ public class InternalNioOutputBuffer ext
length = length - thisTime;
offset = offset + thisTime;
}
- NioEndpoint.KeyAttachment ka =
(NioEndpoint.KeyAttachment)socket.getAttachment(false);
+ NioEndpoint.KeyAttachment ka =
(NioEndpoint.KeyAttachment)socket.getAttachment();
if ( ka!= null ) ka.access();//prevent timeouts for just doing client
writes
}
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletInputStream.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletInputStream.java?rev=1646465&r1=1646464&r2=1646465&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletInputStream.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletInputStream.java
Thu Dec 18 14:24:09 2014
@@ -119,7 +119,7 @@ public class NioServletInputStream exten
}
try {
NioEndpoint.KeyAttachment att =
- (NioEndpoint.KeyAttachment)
channel.getAttachment(false);
+ (NioEndpoint.KeyAttachment) channel.getAttachment();
if (att == null) {
throw new IOException("Key must be cancelled.");
}
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java?rev=1646465&r1=1646464&r2=1646465&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/NioServletOutputStream.java
Thu Dec 18 14:24:09 2014
@@ -79,7 +79,7 @@ public class NioServletOutputStream exte
int written = 0;
NioEndpoint.KeyAttachment att =
- (NioEndpoint.KeyAttachment) channel.getAttachment(false);
+ (NioEndpoint.KeyAttachment) channel.getAttachment();
if (att == null) {
throw new IOException("Key must be cancelled");
}
@@ -108,7 +108,7 @@ public class NioServletOutputStream exte
@Override
protected void doFlush() throws IOException {
NioEndpoint.KeyAttachment att =
- (NioEndpoint.KeyAttachment) channel.getAttachment(false);
+ (NioEndpoint.KeyAttachment) channel.getAttachment();
if (att == null) {
throw new IOException("Key must be cancelled");
}
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java?rev=1646465&r1=1646464&r2=1646465&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/coyote/http11/upgrade/UpgradeNioProcessor.java
Thu Dec 18 14:24:09 2014
@@ -56,7 +56,7 @@ public class UpgradeNioProcessor extends
@Override
public void flush() throws IOException {
NioEndpoint.KeyAttachment att =
- (NioEndpoint.KeyAttachment) nioChannel.getAttachment(false);
+ (NioEndpoint.KeyAttachment) nioChannel.getAttachment();
if (att == null) {
throw new IOException("Key must be cancelled");
}
@@ -180,7 +180,7 @@ public class UpgradeNioProcessor extends
}
try {
NioEndpoint.KeyAttachment att =
- (NioEndpoint.KeyAttachment)
nioChannel.getAttachment(false);
+ (NioEndpoint.KeyAttachment) nioChannel.getAttachment();
if (att == null) {
throw new IOException("Key must be cancelled.");
}
@@ -211,7 +211,7 @@ public class UpgradeNioProcessor extends
int written = 0;
NioEndpoint.KeyAttachment att =
- (NioEndpoint.KeyAttachment) nioChannel.getAttachment(false);
+ (NioEndpoint.KeyAttachment) nioChannel.getAttachment();
if (att == null) {
throw new IOException("Key must be cancelled");
}
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java?rev=1646465&r1=1646464&r2=1646465&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioChannel.java Thu
Dec 18 14:24:09 2014
@@ -141,12 +141,11 @@ public class NioChannel implements ByteC
return sc.read(dst);
}
- public Object getAttachment(boolean remove) {
+ public Object getAttachment() {
Poller pol = getPoller();
Selector sel = pol!=null?pol.getSelector():null;
SelectionKey key = sel!=null?getIOChannel().keyFor(sel):null;
Object att = key!=null?key.attachment():null;
- if (key != null && att != null && remove ) key.attach(null);
return att;
}
/**
Modified: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java?rev=1646465&r1=1646464&r2=1646465&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/net/NioEndpoint.java Thu
Dec 18 14:24:09 2014
@@ -739,7 +739,7 @@ public class NioEndpoint extends Abstrac
public boolean processSocket(NioChannel socket, SocketStatus status,
boolean dispatch) {
try {
- KeyAttachment attachment =
(KeyAttachment)socket.getAttachment(false);
+ KeyAttachment attachment = (KeyAttachment)socket.getAttachment();
if (attachment == null) {
return false;
}
@@ -1008,7 +1008,7 @@ public class NioEndpoint extends Abstrac
*/
@Deprecated
public void cometInterest(NioChannel socket) {
- KeyAttachment att = (KeyAttachment)socket.getAttachment(false);
+ KeyAttachment att = (KeyAttachment)socket.getAttachment();
add(socket,att.getCometOps());
if ( (att.getCometOps()&OP_CALLBACK) == OP_CALLBACK ) {
nextExpiration = 0; //force the check for faster callback
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]