Permalink
Browse files

remove unnecessary newline character.

  • Loading branch information...
1 parent 6afa14e commit e6b97af957ff02b9cf4cb94468e633758f3785e2 @fourk fourk committed Feb 28, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/main/java/com/studyblue/metrics/reporting/StatsdReporter.java
@@ -46,6 +46,7 @@
protected Writer writer;
protected ByteArrayOutputStream outputData;
+ private boolean prependNewline = false;
private boolean printVMMetrics = true;
public interface UDPSocketProvider {
@@ -113,6 +114,7 @@ public void run() {
try {
socket = this.socketProvider.get();
outputData.reset();
+ prependNewline = false;
writer = new BufferedWriter(new OutputStreamWriter(this.outputData));
final long epoch = clock.time() / 1000;
@@ -306,6 +308,9 @@ protected void sendData(String name, String value, StatType statType) {
}
try {
+ if (prependNewline) {
+ writer.write("\n");
+ }
if (!prefix.isEmpty()) {
writer.write(prefix);
}
@@ -314,7 +319,7 @@ protected void sendData(String name, String value, StatType statType) {
writer.write(value);
writer.write("|");
writer.write(statTypeStr);
- writer.write('\n');
+ prependNewline = true;
writer.flush();
} catch (IOException e) {
LOG.error("Error sending to Graphite:", e);

0 comments on commit e6b97af

Please sign in to comment.