Skip to content

Commit d3ad35b

Browse files
committed
metafacture-monitoring/ (main): Fix Checkstyle violations.
1 parent 0cd5d86 commit d3ad35b

File tree

10 files changed

+39
-31
lines changed

10 files changed

+39
-31
lines changed

metafacture-monitoring/src/main/java/org/metafacture/monitoring/ObjectBatchLogger.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.metafacture.monitoring;
1716

18-
import java.util.HashMap;
19-
import java.util.Map;
17+
package org.metafacture.monitoring;
2018

2119
import org.metafacture.commons.StringUtil;
2220
import org.metafacture.framework.FluxCommand;
@@ -25,9 +23,13 @@
2523
import org.metafacture.framework.annotations.In;
2624
import org.metafacture.framework.annotations.Out;
2725
import org.metafacture.framework.helpers.DefaultObjectPipe;
26+
2827
import org.slf4j.Logger;
2928
import org.slf4j.LoggerFactory;
3029

30+
import java.util.HashMap;
31+
import java.util.Map;
32+
3133
/**
3234
* Writes log info for every BATCHSIZE records.
3335
*
@@ -60,18 +62,15 @@ public final class ObjectBatchLogger<T> extends DefaultObjectPipe<T, ObjectRecei
6062
private long batchCount;
6163

6264
public ObjectBatchLogger() {
63-
super();
6465
this.format = DEFAULT_FORMAT;
6566

6667
}
6768

6869
public ObjectBatchLogger(final String format) {
69-
super();
7070
this.format = format;
7171
}
7272

7373
public ObjectBatchLogger(final String format, final Map<String, String> vars) {
74-
super();
7574
this.format = format;
7675
this.vars.putAll(vars);
7776
}

metafacture-monitoring/src/main/java/org/metafacture/monitoring/ObjectLogger.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.monitoring;
1718

1819
import org.metafacture.framework.FluxCommand;
@@ -21,10 +22,10 @@
2122
import org.metafacture.framework.annotations.In;
2223
import org.metafacture.framework.annotations.Out;
2324
import org.metafacture.framework.helpers.DefaultObjectPipe;
25+
2426
import org.slf4j.Logger;
2527
import org.slf4j.LoggerFactory;
2628

27-
2829
/**
2930
* Logs the string representation of every object.
3031
*
@@ -49,7 +50,6 @@ public ObjectLogger() {
4950
}
5051

5152
public ObjectLogger(final String logPrefix) {
52-
super();
5353
this.logPrefix = logPrefix;
5454
}
5555

metafacture-monitoring/src/main/java/org/metafacture/monitoring/ObjectTimer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.monitoring;
1718

1819
import org.metafacture.framework.FluxCommand;

metafacture-monitoring/src/main/java/org/metafacture/monitoring/StreamBatchLogger.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package org.metafacture.monitoring;
1716

18-
import java.util.HashMap;
19-
import java.util.Map;
17+
package org.metafacture.monitoring;
2018

2119
import org.metafacture.commons.StringUtil;
2220
import org.metafacture.framework.FluxCommand;
@@ -25,9 +23,13 @@
2523
import org.metafacture.framework.annotations.In;
2624
import org.metafacture.framework.annotations.Out;
2725
import org.metafacture.framework.helpers.ForwardingStreamPipe;
26+
2827
import org.slf4j.Logger;
2928
import org.slf4j.LoggerFactory;
3029

30+
import java.util.HashMap;
31+
import java.util.Map;
32+
3133
/**
3234
* Writes log info every {@code batchSize} records.
3335
*
@@ -73,11 +75,11 @@ public StreamBatchLogger(final String format, final Map<String, String> vars) {
7375
this.vars.putAll(vars);
7476
}
7577

76-
public final void setBatchSize(final int batchSize) {
78+
public void setBatchSize(final int batchSize) {
7779
this.batchSize = batchSize;
7880
}
7981

80-
public final long getBatchSize() {
82+
public long getBatchSize() {
8183
return batchSize;
8284
}
8385

@@ -90,12 +92,12 @@ public long getRecordCount() {
9092
}
9193

9294
@Override
93-
public final void endRecord() {
95+
public void endRecord() {
9496
getReceiver().endRecord();
95-
recordCount++;
97+
++recordCount;
9698
recordCount %= batchSize;
9799
if (recordCount == 0) {
98-
batchCount++;
100+
++batchCount;
99101
writeLog();
100102
}
101103
}
@@ -106,7 +108,7 @@ protected void onCloseStream() {
106108
}
107109

108110
@Override
109-
protected final void onResetStream() {
111+
protected void onResetStream() {
110112
recordCount = 0;
111113
batchCount = 0;
112114
}

metafacture-monitoring/src/main/java/org/metafacture/monitoring/StreamLogger.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.monitoring;
1718

1819
import org.metafacture.framework.FluxCommand;
@@ -21,10 +22,10 @@
2122
import org.metafacture.framework.annotations.In;
2223
import org.metafacture.framework.annotations.Out;
2324
import org.metafacture.framework.helpers.DefaultStreamPipe;
25+
2426
import org.slf4j.Logger;
2527
import org.slf4j.LoggerFactory;
2628

27-
2829
/**
2930
* Leaves the event stream untouched but logs it to the info log.
3031
* The {@link StreamReceiver} may be {@code null}.
@@ -49,7 +50,6 @@ public StreamLogger() {
4950
}
5051

5152
public StreamLogger(final String logPrefix) {
52-
super();
5353
this.logPrefix = logPrefix;
5454
}
5555

metafacture-monitoring/src/main/java/org/metafacture/monitoring/StreamTimer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.monitoring;
1718

1819
import org.metafacture.framework.FluxCommand;

metafacture-monitoring/src/main/java/org/metafacture/monitoring/TimerBase.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.monitoring;
1718

1819
import org.metafacture.commons.TimeUtil;
1920
import org.metafacture.framework.Receiver;
2021
import org.metafacture.framework.Sender;
22+
2123
import org.slf4j.Logger;
2224
import org.slf4j.LoggerFactory;
2325

24-
2526
/**
2627
* @author Christoph Böhme
2728
*
@@ -41,14 +42,13 @@ public class TimerBase<R extends Receiver> implements Sender<R> {
4142
private R receiver;
4243

4344
protected TimerBase(final String logPrefix) {
44-
super();
4545
this.logPrefix = logPrefix;
4646
}
4747

4848
@Override
49-
public final <S extends R> S setReceiver(final S receiver) {
50-
this.receiver = receiver;
51-
return receiver;
49+
public final <S extends R> S setReceiver(final S newReceiver) {
50+
receiver = newReceiver;
51+
return newReceiver;
5252
}
5353

5454
public final R getReceiver() {
@@ -69,12 +69,12 @@ public final void closeStream() {
6969
final long averageDuration;
7070
if (count > 0) {
7171
averageDuration = cumulativeDuration / count;
72-
} else {
72+
}
73+
else {
7374
averageDuration = 0;
7475
}
75-
LOG.info(logPrefix
76-
+ String.format("Executions: %d; Cumulative duration: %s; Average duration: %s", Long.valueOf(count),
77-
TimeUtil.formatDuration(cumulativeDuration), TimeUtil.formatDuration(averageDuration)));
76+
LOG.info(logPrefix + String.format("Executions: %d; Cumulative duration: %s; Average duration: %s", Long.valueOf(count),
77+
TimeUtil.formatDuration(cumulativeDuration), TimeUtil.formatDuration(averageDuration)));
7878
startMeasurement();
7979
if (receiver != null) {
8080
receiver.closeStream();
@@ -86,7 +86,7 @@ protected final void startMeasurement() {
8686
startTime = System.nanoTime();
8787
}
8888

89-
protected final void stopMeasurement(){
89+
protected final void stopMeasurement() {
9090
stopMeasurement("Execution %1$d:");
9191
}
9292

metafacture-monitoring/src/test/java/org/metafacture/monitoring/ObjectTimerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.monitoring;
1718

1819
import org.junit.Before;
@@ -41,7 +42,8 @@ private static final class BenchmarkedModule extends DefaultObjectReceiver<Strin
4142
public void process(final String obj) {
4243
try {
4344
Thread.sleep(getDuration());
44-
} catch (final InterruptedException e) {
45+
}
46+
catch (final InterruptedException e) {
4547
return;
4648
}
4749
}

metafacture-monitoring/src/test/java/org/metafacture/monitoring/StreamLoggerTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.monitoring;
1718

1819
import static org.mockito.Mockito.inOrder;

metafacture-monitoring/src/test/java/org/metafacture/monitoring/StreamTimerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.metafacture.monitoring;
1718

1819
import org.junit.Before;
@@ -41,7 +42,8 @@ private static final class BenchmarkedModule extends DefaultStreamReceiver {
4142
public void startRecord(final String id) {
4243
try {
4344
Thread.sleep(getDuration());
44-
} catch (final InterruptedException e) {
45+
}
46+
catch (final InterruptedException e) {
4547
return;
4648
}
4749
}

0 commit comments

Comments
 (0)