Author: markt
Date: Fri May 18 10:02:53 2018
New Revision: 1831843
URL: http://svn.apache.org/viewvc?rev=1831843&view=rev
Log:
SpotBugs
Better way to name BlockPoller threads
Modified:
tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
tomcat/trunk/res/findbugs/filter-false-positives.xml
Modified: tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java?rev=1831843&r1=1831842&r2=1831843&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/NioBlockingSelector.java Fri
May 18 10:02:53 2018
@@ -41,7 +41,7 @@ public class NioBlockingSelector {
private static final Log log =
LogFactory.getLog(NioBlockingSelector.class);
- private static int threadCounter = 0;
+ private static final AtomicInteger threadCounter = new AtomicInteger();
private final SynchronizedStack<KeyReference> keyReferenceStack =
new SynchronizedStack<>();
@@ -58,7 +58,7 @@ public class NioBlockingSelector {
poller = new BlockPoller();
poller.selector = sharedSelector;
poller.setDaemon(true);
- poller.setName("NioBlockingSelector.BlockPoller-"+(++threadCounter));
+ poller.setName("NioBlockingSelector.BlockPoller-" +
threadCounter.incrementAndGet());
poller.start();
}
Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1831843&r1=1831842&r2=1831843&view=diff
==============================================================================
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Fri May 18 10:02:53
2018
@@ -1328,6 +1328,24 @@
<Bug code="ML"/>
</Match>
<Match>
+ <!-- Single condition so no need for wait to be in loop -->
+ <Class name="org.apache.tomcat.util.net.Nio2Endpoint$Nio2SocketWrapper"/>
+ <Or>
+ <Method name="read"/>
+ <Method name="write"/>
+ </Or>
+ <Bug pattern="WA_NOT_IN_LOOP" />
+ </Match>
+ <Match>
+ <!-- Single wait so no need for notifyAll() -->
+ <Class
name="org.apache.tomcat.util.net.Nio2Endpoint$Nio2SocketWrapper$VectoredIOCompletionHandler"/>
+ <Or>
+ <Method name="completed"/>
+ <Method name="failed"/>
+ </Or>
+ <Bug pattern="NO_NOTIFY_NOT_NOTIFYALL " />
+ </Match>
+ <Match>
<Class name="org.apache.tomcat.util.net.SecureNioChannel"/>
<Method name="rehandshake"/>
<Bug code="DE" />
@@ -1381,6 +1399,12 @@
<Method name="upgradeDispatch"/>
<Bug code="SF" />
</Match>
+ <Match>
+ <!-- The array contents is never mutated. -->
+ <Class
name="org.apache.tomcat.websocket.server.WsRemoteEndpointImplServer" />
+ <Field name="buffers" />
+ <Bug pattern="VO_VOLATILE_REFERENCE_TO_ARRAY" />
+ </Match>
<!-- Example code -->
<Match>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]