Skip to content

Commit

Permalink
[Java] Platform specific new line generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed May 5, 2016
1 parent b37bb6a commit d6748a6
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions aeron-client/src/main/java/io/aeron/CommonContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,14 @@ public int saveErrorLog(final PrintStream stream)
buffer,
(observationCount, firstObservationTimestamp, lastObservationTimestamp, encodedException) ->
stream.format(
"***\n%d observations from %s to %s for:\n %s\n",
"***%n%d observations from %s to %s for:%n %s%n",
observationCount,
dateFormat.format(new Date(firstObservationTimestamp)),
dateFormat.format(new Date(lastObservationTimestamp)),
encodedException
));

stream.format("\n%d distinct errors observed.\n", distinctErrorCount);
stream.format("%n%d distinct errors observed.%n", distinctErrorCount);

result = distinctErrorCount;
}
Expand Down
4 changes: 2 additions & 2 deletions aeron-driver/src/main/java/io/aeron/driver/MediaDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ private static void validateSufficientSocketBufferLengths(final Context ctx)
if (maxSoSndBuf < SOCKET_SNDBUF_LENGTH)
{
System.err.format(
"WARNING: Could not get desired SO_SNDBUF, adjust OS buffer to match %s: attempted=%d, actual=%d\n",
"WARNING: Could not get desired SO_SNDBUF, adjust OS buffer to match %s: attempted=%d, actual=%d%n",
SOCKET_SNDBUF_LENGTH_PROP_NAME,
SOCKET_SNDBUF_LENGTH,
maxSoSndBuf);
Expand All @@ -326,7 +326,7 @@ private static void validateSufficientSocketBufferLengths(final Context ctx)
if (maxSoRcvBuf < SOCKET_RCVBUF_LENGTH)
{
System.err.format(
"WARNING: Could not get desired SO_RCVBUF, adjust OS buffer to match %s: attempted=%d, actual=%d\n",
"WARNING: Could not get desired SO_RCVBUF, adjust OS buffer to match %s: attempted=%d, actual=%d%n",
SOCKET_RCVBUF_LENGTH_PROP_NAME,
SOCKET_RCVBUF_LENGTH,
maxSoRcvBuf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void run()
final long bytesTransferred = newTotalBytes - lastTotalBytes;

System.out.format(
"Duration %dms - %,d messages - %,d bytes\n",
"Duration %dms - %,d messages - %,d bytes%n",
duration, bytesTransferred / MESSAGE_LENGTH, bytesTransferred);

lastTimeStamp = newTimeStamp;
Expand Down Expand Up @@ -151,7 +151,7 @@ public void run()
}

final double backPressureRatio = backPressureCount / (double)totalMessageCount;
System.out.format("Publisher back pressure ratio: %f\n", backPressureRatio);
System.out.format("Publisher back pressure ratio: %f%n", backPressureRatio);
}
}

Expand Down Expand Up @@ -213,7 +213,7 @@ public void run()
}

final double failureRatio = failedPolls / (double)(successfulPolls + failedPolls);
System.out.format("Subscriber poll failure ratio: %f\n", failureRatio);
System.out.format("Subscriber poll failure ratio: %f%n", failureRatio);
}

public void onFragment(final DirectBuffer buffer, final int offset, final int length, final Header header)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void run()
final long bytesTransferred = newTotalBytes - lastTotalBytes;

System.out.format(
"Duration %dms - %,d messages - %,d bytes\n",
"Duration %dms - %,d messages - %,d bytes%n",
duration, bytesTransferred / MESSAGE_LENGTH, bytesTransferred);

lastTimeStamp = newTimeStamp;
Expand Down Expand Up @@ -144,7 +144,7 @@ public void run()
}

final double backPressureRatio = backPressureCount / (double)totalMessageCount;
System.out.format("Publisher back pressure ratio: %f\n", backPressureRatio);
System.out.format("Publisher back pressure ratio: %f%n", backPressureRatio);
}
}

Expand Down Expand Up @@ -206,7 +206,7 @@ public void run()
}

final double failureRatio = failedPolls / (double)(successfulPolls + failedPolls);
System.out.format("Subscriber poll failure ratio: %f\n", failureRatio);
System.out.format("Subscriber poll failure ratio: %f%n", failureRatio);
}

public void onFragment(final DirectBuffer buffer, final int offset, final int length, final Header header)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static void main(final String[] args) throws Exception
do
{
System.out.format(
"\nStreaming %,d messages of size %d bytes to %s on stream Id %d\n",
"%nStreaming %,d messages of size %d bytes to %s on stream Id %d%n",
NUMBER_OF_MESSAGES, MESSAGE_LENGTH, CHANNEL, STREAM_ID);

printingActive = true;
Expand Down Expand Up @@ -115,7 +115,7 @@ public static void printRate(
if (printingActive)
{
System.out.format(
"%.02g msgs/sec, %.02g bytes/sec, totals %d messages %d MB\n",
"%.02g msgs/sec, %.02g bytes/sec, totals %d messages %d MB%n",
messagesPerSec, bytesPerSec, totalFragments, totalBytes / (1024 * 1024));
}
}
Expand Down
2 changes: 1 addition & 1 deletion aeron-samples/src/main/java/io/aeron/samples/Ping.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ private static void availablePongImageHandler(final Image image)
{
final Subscription subscription = image.subscription();
System.out.format(
"Available image: channel=%s streamId=%d session=%d\n",
"Available image: channel=%s streamId=%d session=%d%n",
subscription.channel(), subscription.streamId(), image.sessionId());

if (PONG_STREAM_ID == subscription.streamId() && PONG_CHANNEL.equals(subscription.channel()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static void main(final String[] args) throws Exception
printingActive = true;

System.out.format(
"\nStreaming %,d messages of%s size %d bytes to %s on stream Id %d\n",
"%nStreaming %,d messages of%s size %d bytes to %s on stream Id %d%n",
NUMBER_OF_MESSAGES,
(RANDOM_MESSAGE_LENGTH) ? " random" : "",
MESSAGE_LENGTH,
Expand Down Expand Up @@ -134,7 +134,7 @@ public static void printRate(
if (printingActive)
{
System.out.format(
"%.02g msgs/sec, %.02g bytes/sec, totals %d messages %d MB\n",
"%.02g msgs/sec, %.02g bytes/sec, totals %d messages %d MB%n",
messagesPerSec, bytesPerSec, totalFragments, totalBytes / (1024 * 1024));
}
}
Expand Down

0 comments on commit d6748a6

Please sign in to comment.