Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #3 from fourk/fix/remove_unnecessary_newline

Remove unnecessary newline character.
  • Loading branch information...
commit 42d67e849b2bf885f679b9eb3bf4aa1514573af5 2 parents d67b470 + e6b97af
@organicveggie authored
View
7 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);
Please sign in to comment.
Something went wrong with that request. Please try again.