Skip to content

Commit f2cd897

Browse files
committed
Follow sonarcloud advises for better code
- use diamond operator - use format specifiers instead of string concatenation when logging
1 parent 6ece930 commit f2cd897

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

metafacture-flowcontrol/src/main/java/org/metafacture/flowcontrol/ObjectPipeDecoupler.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ public final class ObjectPipeDecoupler<T> implements ObjectPipe<T, ObjectReceive
4949
private boolean debug;
5050

5151
public ObjectPipeDecoupler() {
52-
queue = new LinkedBlockingQueue<Object>(DEFAULT_CAPACITY);
52+
queue = new LinkedBlockingQueue<>(DEFAULT_CAPACITY);
5353
}
5454

5555
public ObjectPipeDecoupler(final int capacity) {
56-
queue = new LinkedBlockingQueue<Object>(capacity);
56+
queue = new LinkedBlockingQueue<>(capacity);
5757
}
5858

5959
public ObjectPipeDecoupler(final String capacity) {
60-
queue = new LinkedBlockingQueue<Object>(Integer.parseInt(capacity));
60+
queue = new LinkedBlockingQueue<>(Integer.parseInt(capacity));
6161
}
6262

6363
public void setDebug(final boolean debug) {
@@ -73,7 +73,7 @@ public void process(final T obj) {
7373
try {
7474
queue.put(obj);
7575
if (debug) {
76-
LOG.info("Current buffer size: " + queue.size());
76+
LOG.info("Current buffer size: {}", queue.size());
7777
}
7878
} catch (InterruptedException e) {
7979
Thread.currentThread().interrupt();

metafacture-flowcontrol/src/main/java/org/metafacture/flowcontrol/ObjectThreader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public <R extends ObjectReceiver<T>> R setReceiver(final R receiver) {
6262

6363
@Override
6464
public Tee<ObjectReceiver<T>> addReceiver(final ObjectReceiver<T> receiver) {
65-
LOG.info("Adding thread " + (getReceivers().size() + 1));
65+
LOG.info("Adding thread {}", (getReceivers().size() + 1));
6666
ObjectPipeDecoupler<T> opd = new ObjectPipeDecoupler<>();
6767
opd.setReceiver(receiver);
6868
return super.addReceiver(opd);

0 commit comments

Comments
 (0)