Skip to content
Snippets Groups Projects
Commit d625386d authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

some more fixes

parent 56dc86bc
No related branches found
No related tags found
No related merge requests found
...@@ -37,12 +37,12 @@ public class MonitoringThread extends Thread { ...@@ -37,12 +37,12 @@ public class MonitoringThread extends Thread {
while (!terminated) { while (!terminated) {
for (final AbstractPort<?> port : monitoredPorts) { for (final AbstractPort<?> port : monitoredPorts) {
if (LOGGER.isInfoEnabled()) {
IMonitorablePipe pipe = (IMonitorablePipe) port.getPipe(); IMonitorablePipe pipe = (IMonitorablePipe) port.getPipe();
final long pushThroughput = pipe.getPushThroughput(); final long pushThroughput = pipe.getPushThroughput();
final long pullThroughput = pipe.getPullThroughput(); final long pullThroughput = pipe.getPullThroughput();
final double ratio = (double) pushThroughput / pullThroughput; final double ratio = (double) pushThroughput / pullThroughput;
if (LOGGER.isInfoEnabled()) {
LOGGER.info("pipe: " + "size=" + pipe.size() + ", " + "ratio: " + String.format("%.1f", ratio)); LOGGER.info("pipe: " + "size=" + pipe.size() + ", " + "ratio: " + String.format("%.1f", ratio));
LOGGER.info("pushes: " + pushThroughput); LOGGER.info("pushes: " + pushThroughput);
LOGGER.info("pulls: " + pullThroughput); LOGGER.info("pulls: " + pullThroughput);
......
...@@ -41,7 +41,7 @@ public abstract class AbstractExceptionListener { ...@@ -41,7 +41,7 @@ public abstract class AbstractExceptionListener {
/** /**
* The default logger, which can be used by all subclasses * The default logger, which can be used by all subclasses
*/ */
protected final Logger logger; protected final Logger logger; // NOPMD can't be static as it needs to be initialized in cstr
protected AbstractExceptionListener(final boolean shouldLogExceptions) { protected AbstractExceptionListener(final boolean shouldLogExceptions) {
this.logger = LoggerFactory.getLogger(this.getClass().getCanonicalName()); this.logger = LoggerFactory.getLogger(this.getClass().getCanonicalName());
......
...@@ -37,12 +37,13 @@ public abstract class AbstractTcpReaderStage<T> extends AbstractProducerStage<T> ...@@ -37,12 +37,13 @@ public abstract class AbstractTcpReaderStage<T> extends AbstractProducerStage<T>
@Override @Override
protected void execute() { protected void execute() {
ServerSocketChannel serversocket = null; ServerSocketChannel serversocket = null; // NOPMD
try { try {
serversocket = ServerSocketChannel.open(); serversocket = ServerSocketChannel.open();
serversocket.socket().bind(new InetSocketAddress(this.port)); serversocket.socket().bind(new InetSocketAddress(this.port));
if (logger.isDebugEnabled()) {
logger.debug("Listening on port " + this.port); logger.debug("Listening on port " + this.port);
}
final SocketChannel socketChannel = serversocket.accept(); final SocketChannel socketChannel = serversocket.accept();
try { try {
final ByteBuffer buffer = ByteBuffer.allocateDirect(bufferCapacity); final ByteBuffer buffer = ByteBuffer.allocateDirect(bufferCapacity);
...@@ -55,7 +56,7 @@ public abstract class AbstractTcpReaderStage<T> extends AbstractProducerStage<T> ...@@ -55,7 +56,7 @@ public abstract class AbstractTcpReaderStage<T> extends AbstractProducerStage<T>
} catch (final IOException ex) { } catch (final IOException ex) {
logger.error("Error while reading.", ex); logger.error("Error while reading.", ex);
} finally { } finally {
if (null != serversocket) { if (serversocket != null) {
try { try {
serversocket.close(); serversocket.close();
} catch (final IOException e) { } catch (final IOException e) {
...@@ -90,7 +91,8 @@ public abstract class AbstractTcpReaderStage<T> extends AbstractProducerStage<T> ...@@ -90,7 +91,8 @@ public abstract class AbstractTcpReaderStage<T> extends AbstractProducerStage<T>
/** /**
* @param buffer * @param buffer
* to be read from * to be read from
* @return <ul> * @return
* <ul>
* <li><code>true</code> when there were enough bytes to perform the read operation * <li><code>true</code> when there were enough bytes to perform the read operation
* <li><code>false</code> otherwise. In this case, the buffer is reset, compacted, and filled with new content. * <li><code>false</code> otherwise. In this case, the buffer is reset, compacted, and filled with new content.
* </ul> * </ul>
......
...@@ -41,11 +41,11 @@ public class LoadXMLToDocumentStage extends AbstractTransformation<String, Docum ...@@ -41,11 +41,11 @@ public class LoadXMLToDocumentStage extends AbstractTransformation<String, Docum
@Override @Override
protected void execute(final String filename) { protected void execute(final String filename) {
File file = new File(filename); File file = new File(filename);
Document document = null; Document document;
try { try {
DocumentBuilder documentBuilder = factory.newDocumentBuilder(); DocumentBuilder documentBuilder = factory.newDocumentBuilder();
document = documentBuilder.parse(file); document = documentBuilder.parse(file); // NOPMD DU-Anomaly: must remain in try-scope
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {
// parser cannot be build // parser cannot be build
throw new IllegalStateException(e); throw new IllegalStateException(e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment