You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2013/07/09 08:08:28 UTC
svn commit: r1501104 [4/5] - in /logging/log4j/log4j2/trunk:
api/src/main/java/org/apache/logging/log4j/
api/src/main/java/org/apache/logging/log4j/message/
api/src/main/java/org/apache/logging/log4j/simple/
api/src/main/java/org/apache/logging/log4j/s...
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java Tue Jul 9 06:08:25 2013
@@ -41,7 +41,7 @@ public class ContextStackAttributeConver
@Test
public void testConvertToDatabaseColumn01() {
- ThreadContext.ContextStack stack = new MutableThreadContextStack(
+ final ThreadContext.ContextStack stack = new MutableThreadContextStack(
Arrays.asList("value1", "another2"));
assertEquals("The converted value is not correct.", "value1\nanother2",
@@ -50,7 +50,7 @@ public class ContextStackAttributeConver
@Test
public void testConvertToDatabaseColumn02() {
- ThreadContext.ContextStack stack = new MutableThreadContextStack(
+ final ThreadContext.ContextStack stack = new MutableThreadContextStack(
Arrays.asList("key1", "value2", "my3"));
assertEquals("The converted value is not correct.",
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java Tue Jul 9 06:08:25 2013
@@ -42,14 +42,14 @@ public class ContextStackJsonAttributeCo
@Test
public void testConvert01() {
ThreadContext.clearStack();
- ThreadContext.ContextStack stack = new MutableThreadContextStack(
+ final ThreadContext.ContextStack stack = new MutableThreadContextStack(
Arrays.asList("value1", "another2"));
- String converted = this.converter.convertToDatabaseColumn(stack);
+ final String converted = this.converter.convertToDatabaseColumn(stack);
assertNotNull("The converted value should not be null.", converted);
- ThreadContext.ContextStack reversed = this.converter
+ final ThreadContext.ContextStack reversed = this.converter
.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
@@ -60,14 +60,14 @@ public class ContextStackJsonAttributeCo
@Test
public void testConvert02() {
ThreadContext.clearStack();
- ThreadContext.ContextStack stack = new MutableThreadContextStack(
+ final ThreadContext.ContextStack stack = new MutableThreadContextStack(
Arrays.asList("key1", "value2", "my3"));
- String converted = this.converter.convertToDatabaseColumn(stack);
+ final String converted = this.converter.convertToDatabaseColumn(stack);
assertNotNull("The converted value should not be null.", converted);
- ThreadContext.ContextStack reversed = this.converter
+ final ThreadContext.ContextStack reversed = this.converter
.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java Tue Jul 9 06:08:25 2013
@@ -39,14 +39,14 @@ public class MarkerAttributeConverterTes
@Test
public void testConvert01() {
- Marker marker = MarkerManager.getMarker("testConvert01");
+ final Marker marker = MarkerManager.getMarker("testConvert01");
- String converted = this.converter.convertToDatabaseColumn(marker);
+ final String converted = this.converter.convertToDatabaseColumn(marker);
assertNotNull("The converted value should not be null.", converted);
assertEquals("The converted value is not correct.", "testConvert01", converted);
- Marker reversed = this.converter.convertToEntityAttribute(converted);
+ final Marker reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("The reversed value is not correct.", "testConvert01", marker.getName());
@@ -54,19 +54,19 @@ public class MarkerAttributeConverterTes
@Test
public void testConvert02() {
- Marker marker = MarkerManager.getMarker("testConvert02",
+ final Marker marker = MarkerManager.getMarker("testConvert02",
MarkerManager.getMarker("anotherConvert02",
MarkerManager.getMarker("finalConvert03")
)
);
- String converted = this.converter.convertToDatabaseColumn(marker);
+ final String converted = this.converter.convertToDatabaseColumn(marker);
assertNotNull("The converted value should not be null.", converted);
assertEquals("The converted value is not correct.", "testConvert02[ anotherConvert02[ finalConvert03 ] ] ]",
converted);
- Marker reversed = this.converter.convertToEntityAttribute(converted);
+ final Marker reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("The reversed value is not correct.", "testConvert02", marker.getName());
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java Tue Jul 9 06:08:25 2013
@@ -41,14 +41,14 @@ public class MessageAttributeConverterTe
@Test
public void testConvert01() {
- Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
+ final Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
- String converted = this.converter.convertToDatabaseColumn(message);
+ final String converted = this.converter.convertToDatabaseColumn(message);
assertNotNull("The converted value should not be null.", converted);
assertEquals("The converted value is not correct.", "Message #3 said [Hello].", converted);
- Message reversed = this.converter.convertToEntityAttribute(converted);
+ final Message reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("The reversed value is not correct.", "Message #3 said [Hello].", reversed.getFormattedMessage());
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java Tue Jul 9 06:08:25 2013
@@ -37,15 +37,15 @@ public class StackTraceElementAttributeC
@Test
public void testConvert01() {
- StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
+ final StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
- String converted = this.converter.convertToDatabaseColumn(element);
+ final String converted = this.converter.convertToDatabaseColumn(element);
assertNotNull("The converted value should not be null.", converted);
assertEquals("The converted value is not correct.", "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
converted);
- StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
+ final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("The class name is not correct.", "TestNoPackage", reversed.getClassName());
@@ -57,17 +57,17 @@ public class StackTraceElementAttributeC
@Test
public void testConvert02() {
- StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
+ final StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
"testConvert02", "TestWithPackage.java", -1);
- String converted = this.converter.convertToDatabaseColumn(element);
+ final String converted = this.converter.convertToDatabaseColumn(element);
assertNotNull("The converted value should not be null.", converted);
assertEquals("The converted value is not correct.",
"org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
converted);
- StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
+ final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("The class name is not correct.", "org.apache.logging.TestWithPackage", reversed.getClassName());
@@ -79,17 +79,17 @@ public class StackTraceElementAttributeC
@Test
public void testConvert03() {
- StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
+ final StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
"testConvert03", null, -1);
- String converted = this.converter.convertToDatabaseColumn(element);
+ final String converted = this.converter.convertToDatabaseColumn(element);
assertNotNull("The converted value should not be null.", converted);
assertEquals("The converted value is not correct.",
"org.apache.logging.TestNoSource.testConvert03(Unknown Source)",
converted);
- StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
+ final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("The class name is not correct.", "org.apache.logging.TestNoSource", reversed.getClassName());
@@ -101,17 +101,17 @@ public class StackTraceElementAttributeC
@Test
public void testConvert04() {
- StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
+ final StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
"testConvert04", null, -2);
- String converted = this.converter.convertToDatabaseColumn(element);
+ final String converted = this.converter.convertToDatabaseColumn(element);
assertNotNull("The converted value should not be null.", converted);
assertEquals("The converted value is not correct.",
"org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
converted);
- StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
+ final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("The class name is not correct.", "org.apache.logging.TestIsNativeMethod",
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java Tue Jul 9 06:08:25 2013
@@ -39,16 +39,16 @@ public class ThrowableAttributeConverter
@Test
public void testConvert01() {
- RuntimeException exception = new RuntimeException("My message 01.");
+ final RuntimeException exception = new RuntimeException("My message 01.");
- String stackTrace = getStackTrace(exception);
+ final String stackTrace = getStackTrace(exception);
- String converted = this.converter.convertToDatabaseColumn(exception);
+ final String converted = this.converter.convertToDatabaseColumn(exception);
assertNotNull("The converted value is not correct.", converted);
assertEquals("The converted value is not correct.", stackTrace, converted);
- Throwable reversed = this.converter.convertToEntityAttribute(converted);
+ final Throwable reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
@@ -56,18 +56,18 @@ public class ThrowableAttributeConverter
@Test
public void testConvert02() {
- SQLException cause2 = new SQLException("This is a test cause.");
- Error cause1 = new Error(cause2);
- RuntimeException exception = new RuntimeException("My message 01.", cause1);
+ final SQLException cause2 = new SQLException("This is a test cause.");
+ final Error cause1 = new Error(cause2);
+ final RuntimeException exception = new RuntimeException("My message 01.", cause1);
- String stackTrace = getStackTrace(exception);
+ final String stackTrace = getStackTrace(exception);
- String converted = this.converter.convertToDatabaseColumn(exception);
+ final String converted = this.converter.convertToDatabaseColumn(exception);
assertNotNull("The converted value is not correct.", converted);
assertEquals("The converted value is not correct.", stackTrace, converted);
- Throwable reversed = this.converter.convertToEntityAttribute(converted);
+ final Throwable reversed = this.converter.convertToEntityAttribute(converted);
assertNotNull("The reversed value should not be null.", reversed);
assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
@@ -84,10 +84,10 @@ public class ThrowableAttributeConverter
assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
}
- private static String getStackTrace(Throwable throwable) {
+ private static String getStackTrace(final Throwable throwable) {
String returnValue = throwable.toString() + "\n";
- for (StackTraceElement element : throwable.getStackTrace()) {
+ for (final StackTraceElement element : throwable.getStackTrace()) {
returnValue += "\tat " + element.toString() + "\n";
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java Tue Jul 9 06:08:25 2013
@@ -51,7 +51,7 @@ public class MapRewritePolicyTest {
logEvent1 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ERROR,
new MapMessage(map), null, map, null, "none",
new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 29), 2);
- ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
+ final ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
logEvent2 = new Log4jLogEvent("test", MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
Level.TRACE, new StructuredDataMessage("test", "Nothing", "test", map), new RuntimeException("test"), null,
stack, "none", new StackTraceElement("MapRewritePolicyTest",
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java Tue Jul 9 06:08:25 2013
@@ -112,7 +112,7 @@ public class RewriteAppenderTest {
StructuredDataMessage msg = new StructuredDataMessage("Test", "This is a test", "Service");
msg.put("Key1", "Value2");
msg.put("Key2", "Value1");
- Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
+ final Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
logger.debug(msg);
msg = new StructuredDataMessage("Test", "This is a test", "Service");
msg.put("Key1", "Value1");
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java Tue Jul 9 06:08:25 2013
@@ -40,23 +40,23 @@ public class FastRollingFileManagerTest
*/
@Test
public void testWrite_multiplesOfBufferSize() throws IOException {
- File file = File.createTempFile("log4j2", "test");
+ final File file = File.createTempFile("log4j2", "test");
file.deleteOnExit();
- RandomAccessFile raf = new RandomAccessFile(file, "rw");
- OutputStream os = new FastRollingFileManager.DummyOutputStream();
- boolean append = false;
- boolean flushNow = false;
- long triggerSize = Long.MAX_VALUE;
- long time = System.currentTimeMillis();
- TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
+ final RandomAccessFile raf = new RandomAccessFile(file, "rw");
+ final OutputStream os = new FastRollingFileManager.DummyOutputStream();
+ final boolean append = false;
+ final boolean flushNow = false;
+ final long triggerSize = Long.MAX_VALUE;
+ final long time = System.currentTimeMillis();
+ final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
triggerSize);
- RolloverStrategy rolloverStrategy = null;
- FastRollingFileManager manager = new FastRollingFileManager(raf,
+ final RolloverStrategy rolloverStrategy = null;
+ final FastRollingFileManager manager = new FastRollingFileManager(raf,
file.getName(), "", os, append, flushNow, triggerSize, time,
triggerPolicy, rolloverStrategy, null, null);
- int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
- byte[] data = new byte[size];
+ final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
+ final byte[] data = new byte[size];
manager.write(data, 0, data.length); // no buffer overflow exception
// buffer is full but not flushed yet
@@ -71,23 +71,23 @@ public class FastRollingFileManagerTest
*/
@Test
public void testWrite_dataExceedingBufferSize() throws IOException {
- File file = File.createTempFile("log4j2", "test");
+ final File file = File.createTempFile("log4j2", "test");
file.deleteOnExit();
- RandomAccessFile raf = new RandomAccessFile(file, "rw");
- OutputStream os = new FastRollingFileManager.DummyOutputStream();
- boolean append = false;
- boolean flushNow = false;
- long triggerSize = 0;
- long time = System.currentTimeMillis();
- TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
+ final RandomAccessFile raf = new RandomAccessFile(file, "rw");
+ final OutputStream os = new FastRollingFileManager.DummyOutputStream();
+ final boolean append = false;
+ final boolean flushNow = false;
+ final long triggerSize = 0;
+ final long time = System.currentTimeMillis();
+ final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
triggerSize);
- RolloverStrategy rolloverStrategy = null;
- FastRollingFileManager manager = new FastRollingFileManager(raf,
+ final RolloverStrategy rolloverStrategy = null;
+ final FastRollingFileManager manager = new FastRollingFileManager(raf,
file.getName(), "", os, append, flushNow, triggerSize, time,
triggerPolicy, rolloverStrategy, null, null);
- int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
- byte[] data = new byte[size];
+ final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
+ final byte[] data = new byte[size];
manager.write(data, 0, data.length); // no exception
assertEquals(FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3,
raf.length());
@@ -98,12 +98,12 @@ public class FastRollingFileManagerTest
@Test
public void testAppendDoesNotOverwriteExistingFile() throws IOException {
- boolean isAppend = true;
- File file = File.createTempFile("log4j2", "test");
+ final boolean isAppend = true;
+ final File file = File.createTempFile("log4j2", "test");
file.deleteOnExit();
assertEquals(0, file.length());
- byte[] bytes = new byte[4 * 1024];
+ final byte[] bytes = new byte[4 * 1024];
// create existing file
FileOutputStream fos = null;
@@ -116,31 +116,31 @@ public class FastRollingFileManagerTest
}
assertEquals("all flushed to disk", bytes.length, file.length());
- FastRollingFileManager manager = FastRollingFileManager
+ final FastRollingFileManager manager = FastRollingFileManager
.getFastRollingFileManager(
//
file.getAbsolutePath(), "", isAppend, true,
new SizeBasedTriggeringPolicy(Long.MAX_VALUE), //
null, null, null);
manager.write(bytes, 0, bytes.length);
- int expected = bytes.length * 2;
+ final int expected = bytes.length * 2;
assertEquals("appended, not overwritten", expected, file.length());
}
@Test
public void testFileTimeBasedOnSystemClockWhenAppendIsFalse()
throws IOException {
- File file = File.createTempFile("log4j2", "test");
+ final File file = File.createTempFile("log4j2", "test");
file.deleteOnExit();
LockSupport.parkNanos(1000000); // 1 millisec
// append is false deletes the file if it exists
- boolean isAppend = false;
- long expectedMin = System.currentTimeMillis();
- long expectedMax = expectedMin + 50;
+ final boolean isAppend = false;
+ final long expectedMin = System.currentTimeMillis();
+ final long expectedMax = expectedMin + 50;
assertTrue(file.lastModified() < expectedMin);
- FastRollingFileManager manager = FastRollingFileManager
+ final FastRollingFileManager manager = FastRollingFileManager
.getFastRollingFileManager(
//
file.getAbsolutePath(), "", isAppend, true,
@@ -153,14 +153,14 @@ public class FastRollingFileManagerTest
@Test
public void testFileTimeBasedOnFileModifiedTimeWhenAppendIsTrue()
throws IOException {
- File file = File.createTempFile("log4j2", "test");
+ final File file = File.createTempFile("log4j2", "test");
file.deleteOnExit();
LockSupport.parkNanos(1000000); // 1 millisec
- boolean isAppend = true;
+ final boolean isAppend = true;
assertTrue(file.lastModified() < System.currentTimeMillis());
- FastRollingFileManager manager = FastRollingFileManager
+ final FastRollingFileManager manager = FastRollingFileManager
.getFastRollingFileManager(
//
file.getAbsolutePath(), "", isAppend, true,
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java Tue Jul 9 06:08:25 2013
@@ -35,7 +35,7 @@ public class FileRenameActionTest {
@BeforeClass
public static void beforeClass() throws Exception {
- File file = new File(DIR);
+ final File file = new File(DIR);
file.mkdirs();
}
@@ -51,15 +51,15 @@ public class FileRenameActionTest {
@Test
public void testRename1() throws Exception {
- File file = new File("target/fileRename/fileRename.log");
- PrintStream pos = new PrintStream(file);
+ final File file = new File("target/fileRename/fileRename.log");
+ final PrintStream pos = new PrintStream(file);
for (int i = 0; i < 100; ++i) {
pos.println("This is line " + i);
}
pos.close();
- File dest = new File("target/fileRename/newFile.log");
- FileRenameAction action = new FileRenameAction(file, dest, false);
+ final File dest = new File("target/fileRename/newFile.log");
+ final FileRenameAction action = new FileRenameAction(file, dest, false);
action.execute();
assertTrue("Renamed file does not exist", dest.exists());
assertTrue("Old file exists", !file.exists());
@@ -67,12 +67,12 @@ public class FileRenameActionTest {
@Test
public void testEmpty() throws Exception {
- File file = new File("target/fileRename/fileRename.log");
- PrintStream pos = new PrintStream(file);
+ final File file = new File("target/fileRename/fileRename.log");
+ final PrintStream pos = new PrintStream(file);
pos.close();
- File dest = new File("target/fileRename/newFile.log");
- FileRenameAction action = new FileRenameAction(file, dest, false);
+ final File dest = new File("target/fileRename/newFile.log");
+ final FileRenameAction action = new FileRenameAction(file, dest, false);
action.execute();
assertTrue("Renamed file does not exist", !dest.exists());
assertTrue("Old file does not exist", !file.exists());
@@ -81,16 +81,16 @@ public class FileRenameActionTest {
@Test
public void testNoParent() throws Exception {
- File file = new File("fileRename.log");
- PrintStream pos = new PrintStream(file);
+ final File file = new File("fileRename.log");
+ final PrintStream pos = new PrintStream(file);
for (int i = 0; i < 100; ++i) {
pos.println("This is line " + i);
}
pos.close();
- File dest = new File("newFile.log");
+ final File dest = new File("newFile.log");
try {
- FileRenameAction action = new FileRenameAction(file, dest, false);
+ final FileRenameAction action = new FileRenameAction(file, dest, false);
action.execute();
assertTrue("Renamed file does not exist", dest.exists());
assertTrue("Old file exists", !file.exists());
@@ -98,7 +98,7 @@ public class FileRenameActionTest {
try {
dest.delete();
file.delete();
- } catch (Exception ex) {
+ } catch (final Exception ex) {
System.out.println("Unable to cleanup files written to main directory");
}
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java Tue Jul 9 06:08:25 2013
@@ -39,17 +39,17 @@ public class AsyncLoggerConfigTest {
@Test
public void testAdditivity() throws Exception {
- File f = new File("target", "AsyncLoggerConfigTest.log");
+ final File f = new File("target", "AsyncLoggerConfigTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
- Logger log = LogManager.getLogger("com.foo.Bar");
- String msg = "Additive logging: 2 for the price of 1!";
+ final Logger log = LogManager.getLogger("com.foo.Bar");
+ final String msg = "Additive logging: 2 for the price of 1!";
log.info(msg);
((LifeCycle) LogManager.getContext()).stop(); // stop async thread
- BufferedReader reader = new BufferedReader(new FileReader(f));
- String line1 = reader.readLine();
- String line2 = reader.readLine();
+ final BufferedReader reader = new BufferedReader(new FileReader(f));
+ final String line1 = reader.readLine();
+ final String line2 = reader.readLine();
reader.close();
f.delete();
assertNotNull("line1", line1);
@@ -57,7 +57,7 @@ public class AsyncLoggerConfigTest {
assertTrue("line1 correct", line1.contains(msg));
assertTrue("line2 correct", line2.contains(msg));
- String location = "testAdditivity";
+ final String location = "testAdditivity";
assertTrue("location",
line1.contains(location) || line2.contains(location));
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java Tue Jul 9 06:08:25 2013
@@ -29,24 +29,24 @@ public class AsyncLoggerContextSelectorT
@Test
public void testContextReturnsAsyncLoggerContext() {
- AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
- LoggerContext context = selector.getContext(null, null, false);
+ final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
+ final LoggerContext context = selector.getContext(null, null, false);
assertTrue(context instanceof AsyncLoggerContext);
}
@Test
public void testContext2ReturnsAsyncLoggerContext() {
- AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
- LoggerContext context = selector.getContext(null, null, false, null);
+ final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
+ final LoggerContext context = selector.getContext(null, null, false, null);
assertTrue(context instanceof AsyncLoggerContext);
}
@Test
public void testLoggerContextsReturnsAsyncLoggerContext() {
- AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
- List<LoggerContext> list = selector.getLoggerContexts();
+ final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
+ final List<LoggerContext> list = selector.getLoggerContexts();
assertEquals(1, list.size());
assertTrue(list.get(0) instanceof AsyncLoggerContext);
@@ -54,8 +54,8 @@ public class AsyncLoggerContextSelectorT
@Test
public void testContextNameIsAsyncLoggerContext() {
- AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
- LoggerContext context = selector.getContext(null, null, false);
+ final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
+ final LoggerContext context = selector.getContext(null, null, false);
assertEquals("AsyncLoggerContext", context.getName());
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java Tue Jul 9 06:08:25 2013
@@ -30,7 +30,7 @@ public class AsyncLoggerContextTest {
@Test
public void testNewInstanceReturnsAsyncLogger() {
- Logger logger = new AsyncLoggerContext("a").newInstance(
+ final Logger logger = new AsyncLoggerContext("a").newInstance(
new LoggerContext("a"), "a", null);
assertTrue(logger instanceof AsyncLogger);
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java Tue Jul 9 06:08:25 2013
@@ -49,22 +49,22 @@ public class AsyncLoggerLocationTest {
@Test
public void testAsyncLogWritesToLog() throws Exception {
- File f = new File("target", "AsyncLoggerLocationTest.log");
+ final File f = new File("target", "AsyncLoggerLocationTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
- Logger log = LogManager.getLogger("com.foo.Bar");
- String msg = "Async logger msg with location";
+ final Logger log = LogManager.getLogger("com.foo.Bar");
+ final String msg = "Async logger msg with location";
log.info(msg);
((LifeCycle) LogManager.getContext()).stop(); // stop async thread
- BufferedReader reader = new BufferedReader(new FileReader(f));
- String line1 = reader.readLine();
+ final BufferedReader reader = new BufferedReader(new FileReader(f));
+ final String line1 = reader.readLine();
reader.close();
f.delete();
assertNotNull("line1", line1);
assertTrue("line1 correct", line1.contains(msg));
- String location = "testAsyncLogWritesToLog";
+ final String location = "testAsyncLogWritesToLog";
assertTrue("has location", line1.contains(location));
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java Tue Jul 9 06:08:25 2013
@@ -49,22 +49,22 @@ public class AsyncLoggerTest {
@Test
public void testAsyncLogWritesToLog() throws Exception {
- File f = new File("target", "AsyncLoggerTest.log");
+ final File f = new File("target", "AsyncLoggerTest.log");
// System.out.println(f.getAbsolutePath());
f.delete();
- Logger log = LogManager.getLogger("com.foo.Bar");
- String msg = "Async logger msg";
+ final Logger log = LogManager.getLogger("com.foo.Bar");
+ final String msg = "Async logger msg";
log.info(msg);
((LifeCycle) LogManager.getContext()).stop(); // stop async thread
- BufferedReader reader = new BufferedReader(new FileReader(f));
- String line1 = reader.readLine();
+ final BufferedReader reader = new BufferedReader(new FileReader(f));
+ final String line1 = reader.readLine();
reader.close();
f.delete();
assertNotNull("line1", line1);
assertTrue("line1 correct", line1.contains(msg));
- String location = "testAsyncLogWritesToLog";
+ final String location = "testAsyncLogWritesToLog";
assertTrue("no location", !line1.contains(location));
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java Tue Jul 9 06:08:25 2013
@@ -22,23 +22,23 @@ import com.lmax.disruptor.collections.Hi
public class MTPerfTest extends PerfTest {
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
new MTPerfTest().doMain(args);
}
@Override
public void runTestAndPrintResult(final IPerfTestRunner runner,
- final String name, final int threadCount, String resultFile)
+ final String name, final int threadCount, final String resultFile)
throws Exception {
// ThreadContext.put("aKey", "mdcVal");
PerfTest.println("Warming up the JVM...");
- long t1 = System.nanoTime();
+ final long t1 = System.nanoTime();
// warmup at least 2 rounds and at most 1 minute
final Histogram warmupHist = PerfTest.createHistogram();
final long stop = System.currentTimeMillis() + (60 * 1000);
- Runnable run1 = new Runnable() {
+ final Runnable run1 = new Runnable() {
@Override
public void run() {
for (int i = 0; i < 10; i++) {
@@ -50,8 +50,8 @@ public class MTPerfTest extends PerfTest
}
}
};
- Thread thread1 = new Thread(run1);
- Thread thread2 = new Thread(run1);
+ final Thread thread1 = new Thread(run1);
+ final Thread thread2 = new Thread(run1);
thread1.start();
thread2.start();
thread1.join();
@@ -74,7 +74,7 @@ public class MTPerfTest extends PerfTest
}
private void multiThreadedTestRun(final IPerfTestRunner runner,
- final String name, final int threadCount, String resultFile)
+ final String name, final int threadCount, final String resultFile)
throws Exception {
final Histogram[] histograms = new Histogram[threadCount];
@@ -83,28 +83,28 @@ public class MTPerfTest extends PerfTest
}
final int LINES = 256 * 1024;
- Thread[] threads = new Thread[threadCount];
+ final Thread[] threads = new Thread[threadCount];
for (int i = 0; i < threads.length; i++) {
final Histogram histogram = histograms[i];
threads[i] = new Thread() {
@Override
public void run() {
// int latencyCount = threadCount >= 16 ? 1000000 : 5000000;
- int latencyCount = 5000000;
- int count = PerfTest.throughput ? LINES / threadCount
+ final int latencyCount = 5000000;
+ final int count = PerfTest.throughput ? LINES / threadCount
: latencyCount;
runTest(runner, count, "end", histogram, threadCount);
}
};
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
thread.start();
}
- for (Thread thread : threads) {
+ for (final Thread thread : threads) {
thread.join();
}
- for (Histogram histogram : histograms) {
+ for (final Histogram histogram : histograms) {
PerfTest.reportResult(resultFile, name, histogram);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java Tue Jul 9 06:08:25 2013
@@ -33,7 +33,7 @@ public class PerfTest {
// determine how long it takes to call System.nanoTime() (on average)
static long calcNanoTimeCost() {
final long iterations = 10000000;
- long start = System.nanoTime();
+ final long start = System.nanoTime();
long finish = start;
for (int i = 0; i < iterations; i++) {
@@ -49,7 +49,7 @@ public class PerfTest {
}
static Histogram createHistogram() {
- long[] intervals = new long[31];
+ final long[] intervals = new long[31];
long intervalUpperBound = 1L;
for (int i = 0, size = intervals.length - 1; i < size; i++) {
intervalUpperBound *= 2;
@@ -60,17 +60,17 @@ public class PerfTest {
return new Histogram(intervals);
}
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
new PerfTest().doMain(args);
}
- public void doMain(String[] args) throws Exception {
- String runnerClass = args[0];
- IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
+ public void doMain(final String[] args) throws Exception {
+ final String runnerClass = args[0];
+ final IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
.newInstance();
- String name = args[1];
- String resultFile = args.length > 2 ? args[2] : null;
- for (String arg : args) {
+ final String name = args[1];
+ final String resultFile = args.length > 2 ? args[2] : null;
+ for (final String arg : args) {
if (verbose && throughput) {
break;
}
@@ -81,7 +81,7 @@ public class PerfTest {
throughput = true;
}
}
- int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
+ final int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
printf("Starting %s %s (%d)...%n", getClass().getSimpleName(), name,
threadCount);
runTestAndPrintResult(runner, name, threadCount, resultFile);
@@ -89,14 +89,14 @@ public class PerfTest {
System.exit(0);
}
- public void runTestAndPrintResult(IPerfTestRunner runner,
- final String name, int threadCount, String resultFile)
+ public void runTestAndPrintResult(final IPerfTestRunner runner,
+ final String name, final int threadCount, final String resultFile)
throws Exception {
- Histogram warmupHist = createHistogram();
+ final Histogram warmupHist = createHistogram();
// ThreadContext.put("aKey", "mdcVal");
println("Warming up the JVM...");
- long t1 = System.nanoTime();
+ final long t1 = System.nanoTime();
// warmup at least 2 rounds and at most 1 minute
final long stop = System.currentTimeMillis() + (60 * 1000);
@@ -124,46 +124,46 @@ public class PerfTest {
runSingleThreadedTest(runner, name, resultFile);
}
- private int runSingleThreadedTest(IPerfTestRunner runner, String name,
- String resultFile) throws IOException {
- Histogram latency = createHistogram();
+ private int runSingleThreadedTest(final IPerfTestRunner runner, final String name,
+ final String resultFile) throws IOException {
+ final Histogram latency = createHistogram();
final int LINES = throughput ? 50000 : 5000000;
runTest(runner, LINES, "end", latency, 1);
reportResult(resultFile, name, latency);
return LINES;
}
- static void reportResult(String file, String name, Histogram histogram)
+ static void reportResult(final String file, final String name, final Histogram histogram)
throws IOException {
- String result = createSamplingReport(name, histogram);
+ final String result = createSamplingReport(name, histogram);
println(result);
if (file != null) {
- FileWriter writer = new FileWriter(file, true);
+ final FileWriter writer = new FileWriter(file, true);
writer.write(result);
writer.write(System.getProperty("line.separator"));
writer.close();
}
}
- static void printf(String msg, Object... objects) {
+ static void printf(final String msg, final Object... objects) {
if (verbose) {
System.out.printf(msg, objects);
}
}
- static void println(String msg) {
+ static void println(final String msg) {
if (verbose) {
System.out.println(msg);
}
}
- static String createSamplingReport(String name, Histogram histogram) {
- Histogram data = histogram;
+ static String createSamplingReport(final String name, final Histogram histogram) {
+ final Histogram data = histogram;
if (throughput) {
return data.getMax() + " operations/second";
}
- String result = String.format(
+ final String result = String.format(
"avg=%.0f 99%%=%d 99.99%%=%d sampleCount=%d", data.getMean(), //
data.getTwoNinesUpperBound(), //
data.getFourNinesUpperBound(), //
@@ -172,12 +172,12 @@ public class PerfTest {
return result;
}
- public void runTest(IPerfTestRunner runner, int lines, String finalMessage,
- Histogram histogram, int threadCount) {
+ public void runTest(final IPerfTestRunner runner, final int lines, final String finalMessage,
+ final Histogram histogram, final int threadCount) {
if (throughput) {
runner.runThroughputTest(lines, histogram);
} else {
- long nanoTimeCost = calcNanoTimeCost();
+ final long nanoTimeCost = calcNanoTimeCost();
runner.runLatencyTest(lines, histogram, nanoTimeCost, threadCount);
}
if (finalMessage != null) {
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java Tue Jul 9 06:08:25 2013
@@ -41,19 +41,19 @@ public class PerfTestDriver {
* Defines the setup for a java process running a performance test.
*/
static class Setup implements Comparable<Setup> {
- private Class<?> _class;
- private String _log4jConfig;
- private String _name;
- private String[] _systemProperties;
- private int _threadCount;
- private File _temp;
+ private final Class<?> _class;
+ private final String _log4jConfig;
+ private final String _name;
+ private final String[] _systemProperties;
+ private final int _threadCount;
+ private final File _temp;
public Stats _stats;
- private WaitStrategy _wait;
- private String _runner;
+ private final WaitStrategy _wait;
+ private final String _runner;
- public Setup(Class<?> klass, String runner, String name,
- String log4jConfig, int threadCount, WaitStrategy wait,
- String... systemProperties) throws IOException {
+ public Setup(final Class<?> klass, final String runner, final String name,
+ final String log4jConfig, final int threadCount, final WaitStrategy wait,
+ final String... systemProperties) throws IOException {
_class = klass;
_runner = runner;
_name = name;
@@ -64,8 +64,8 @@ public class PerfTestDriver {
_temp = File.createTempFile("log4jperformance", ".txt");
}
- List<String> processArguments(String java) {
- List<String> args = new ArrayList<String>();
+ List<String> processArguments(final String java) {
+ final List<String> args = new ArrayList<String>();
args.add(java);
args.add("-server");
args.add("-Xms1g");
@@ -84,7 +84,7 @@ public class PerfTestDriver {
args.add("-Dlog4j.configurationFile=" + _log4jConfig); // log4j 2
args.add("-Dlogback.configurationFile=" + _log4jConfig);// logback
- int ringBufferSize = getUserSpecifiedRingBufferSize();
+ final int ringBufferSize = getUserSpecifiedRingBufferSize();
if (ringBufferSize >= 128) {
args.add("-DAsyncLoggerConfig.RingBufferSize=" + ringBufferSize);
args.add("-DAsyncLogger.RingBufferSize=" + ringBufferSize);
@@ -108,23 +108,23 @@ public class PerfTestDriver {
try {
return Integer.parseInt(System.getProperty("RingBufferSize",
"-1"));
- } catch (Exception ignored) {
+ } catch (final Exception ignored) {
return -1;
}
}
- ProcessBuilder latencyTest(String java) {
+ ProcessBuilder latencyTest(final String java) {
return new ProcessBuilder(processArguments(java));
}
- ProcessBuilder throughputTest(String java) {
- List<String> args = processArguments(java);
+ ProcessBuilder throughputTest(final String java) {
+ final List<String> args = processArguments(java);
args.add("-throughput");
return new ProcessBuilder(args);
}
@Override
- public int compareTo(Setup other) {
+ public int compareTo(final Setup other) {
// largest ops/sec first
return (int) Math.signum(other._stats._averageOpsPerSec
- _stats._averageOpsPerSec);
@@ -137,7 +137,7 @@ public class PerfTestDriver {
} else if (MTPerfTest.class == _class) {
detail = _threadCount + " threads";
}
- String target = _runner.substring(_runner.indexOf(".Run") + 4);
+ final String target = _runner.substring(_runner.indexOf(".Run") + 4);
return target + ": " + _name + " (" + detail + ")";
}
}
@@ -152,16 +152,16 @@ public class PerfTestDriver {
long _pct99_99;
double _latencyRowCount;
int _throughputRowCount;
- private long _averageOpsPerSec;
+ private final long _averageOpsPerSec;
// example line: avg=828 99%=1118 99.99%=5028 Count=3125
- public Stats(String raw) {
- String[] lines = raw.split("[\\r\\n]+");
+ public Stats(final String raw) {
+ final String[] lines = raw.split("[\\r\\n]+");
long totalOps = 0;
- for (String line : lines) {
+ for (final String line : lines) {
if (line.startsWith("avg")) {
_latencyRowCount++;
- String[] parts = line.split(" ");
+ final String[] parts = line.split(" ");
int i = 0;
_average += Long.parseLong(parts[i++].split("=")[1]);
_pct99 += Long.parseLong(parts[i++].split("=")[1]);
@@ -169,8 +169,8 @@ public class PerfTestDriver {
_count += Integer.parseInt(parts[i].split("=")[1]);
} else {
_throughputRowCount++;
- String number = line.substring(0, line.indexOf(' '));
- long opsPerSec = Long.parseLong(number);
+ final String number = line.substring(0, line.indexOf(' '));
+ final long opsPerSec = Long.parseLong(number);
totalOps += opsPerSec;
}
}
@@ -179,7 +179,7 @@ public class PerfTestDriver {
@Override
public String toString() {
- String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
+ final String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
return String.format(fmt, _averageOpsPerSec, //
_average / _latencyRowCount, // mean latency
_pct99 / _latencyRowCount, // 99% observations less than
@@ -189,24 +189,24 @@ public class PerfTestDriver {
}
// single-threaded performance test
- private static Setup s(String config, String runner, String name,
- String... systemProperties) throws IOException {
- WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
+ private static Setup s(final String config, final String runner, final String name,
+ final String... systemProperties) throws IOException {
+ final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
"WaitStrategy", "Sleep"));
return new Setup(PerfTest.class, runner, name, config, 1, wait,
systemProperties);
}
// multi-threaded performance test
- private static Setup m(String config, String runner, String name,
- int threadCount, String... systemProperties) throws IOException {
- WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
+ private static Setup m(final String config, final String runner, final String name,
+ final int threadCount, final String... systemProperties) throws IOException {
+ final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
"WaitStrategy", "Sleep"));
return new Setup(MTPerfTest.class, runner, name, config, threadCount,
wait, systemProperties);
}
- public static void main(String[] args) throws Exception {
+ public static void main(final String[] args) throws Exception {
final String ALL_ASYNC = "-DLog4jContextSelector="
+ AsyncLoggerContextSelector.class.getName();
final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
@@ -215,8 +215,8 @@ public class PerfTestDriver {
final String LOG20 = RunLog4j2.class.getName();
final String LOGBK = RunLogback.class.getName();
- long start = System.nanoTime();
- List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
+ final long start = System.nanoTime();
+ final List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
// includeLocation=false
tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
ALL_ASYNC, SYSCLOCK));
@@ -285,29 +285,29 @@ public class PerfTestDriver {
// "RollFastFileAppender", i));
}
- String java = args.length > 0 ? args[0] : "java";
- int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
+ final String java = args.length > 0 ? args[0] : "java";
+ final int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
int x = 0;
- for (Setup config : tests) {
+ for (final Setup config : tests) {
System.out.print(config.description());
- ProcessBuilder pb = config.throughputTest(java);
+ final ProcessBuilder pb = config.throughputTest(java);
pb.redirectErrorStream(true); // merge System.out and System.err
- long t1 = System.nanoTime();
+ final long t1 = System.nanoTime();
// int count = config._threadCount >= 16 ? 2 : repeat;
runPerfTest(repeat, x++, config, pb);
System.out.printf(" took %.1f seconds%n", (System.nanoTime() - t1)
/ (1000.0 * 1000.0 * 1000.0));
- FileReader reader = new FileReader(config._temp);
- CharBuffer buffer = CharBuffer.allocate(256 * 1024);
+ final FileReader reader = new FileReader(config._temp);
+ final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
reader.read(buffer);
reader.close();
config._temp.delete();
buffer.flip();
- String raw = buffer.toString();
+ final String raw = buffer.toString();
System.out.print(raw);
- Stats stats = new Stats(raw);
+ final Stats stats = new Stats(raw);
System.out.println(stats);
System.out.println("-----");
config._stats = stats;
@@ -321,19 +321,19 @@ public class PerfTestDriver {
printRanking(tests.toArray(new Setup[tests.size()]));
}
- private static void printRanking(Setup[] tests) {
+ private static void printRanking(final Setup[] tests) {
System.out.println();
System.out.println("Ranking:");
Arrays.sort(tests);
for (int i = 0; i < tests.length; i++) {
- Setup setup = tests[i];
+ final Setup setup = tests[i];
System.out.println((i + 1) + ". " + setup.description() + ": "
+ setup._stats);
}
}
- private static void runPerfTest(int repeat, int setupIndex, Setup config,
- ProcessBuilder pb) throws IOException, InterruptedException {
+ private static void runPerfTest(final int repeat, final int setupIndex, final Setup config,
+ final ProcessBuilder pb) throws IOException, InterruptedException {
for (int i = 0; i < repeat; i++) {
System.out.print(" (" + (i + 1) + "/" + repeat + ")...");
final Process process = pb.start();
@@ -343,7 +343,7 @@ public class PerfTestDriver {
process.waitFor();
stop[0] = true;
- File gc = new File("gc" + setupIndex + "_" + i
+ final File gc = new File("gc" + setupIndex + "_" + i
+ config._log4jConfig + ".log");
if (gc.exists()) {
gc.delete();
@@ -355,17 +355,17 @@ public class PerfTestDriver {
private static Thread printProcessOutput(final Process process,
final boolean[] stop) {
- Thread t = new Thread("OutputWriter") {
+ final Thread t = new Thread("OutputWriter") {
@Override
public void run() {
- BufferedReader in = new BufferedReader(new InputStreamReader(
+ final BufferedReader in = new BufferedReader(new InputStreamReader(
process.getInputStream()));
try {
String line = null;
while (!stop[0] && (line = in.readLine()) != null) {
System.out.println(line);
}
- } catch (Exception ignored) {
+ } catch (final Exception ignored) {
}
}
};
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java Tue Jul 9 06:08:25 2013
@@ -42,7 +42,7 @@ class PerfTestResultFormatter {
double latency99Pct;
double latency99_99Pct;
- Stats(String throughput, String avg, String lat99, String lat99_99)
+ Stats(final String throughput, final String avg, final String lat99, final String lat99_99)
throws ParseException {
this.throughput = NUM.parse(throughput.trim()).longValue();
this.avgLatency = Double.parseDouble(avg.trim());
@@ -51,40 +51,40 @@ class PerfTestResultFormatter {
}
}
- private Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
+ private final Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
public PerfTestResultFormatter() {
}
- public String format(String text) throws ParseException {
+ public String format(final String text) throws ParseException {
results.clear();
- String[] lines = text.split("[\\r\\n]+");
- for (String line : lines) {
+ final String[] lines = text.split("[\\r\\n]+");
+ for (final String line : lines) {
process(line);
}
return latencyTable() + LF + throughputTable();
}
private String latencyTable() {
- StringBuilder sb = new StringBuilder(4 * 1024);
- Set<String> subKeys = results.values().iterator().next().keySet();
- char[] tabs = new char[subKeys.size()];
+ final StringBuilder sb = new StringBuilder(4 * 1024);
+ final Set<String> subKeys = results.values().iterator().next().keySet();
+ final char[] tabs = new char[subKeys.size()];
Arrays.fill(tabs, '\t');
- String sep = new String(tabs);
+ final String sep = new String(tabs);
sb.append("\tAverage latency").append(sep).append("99% less than").append(sep).append("99.99% less than");
sb.append(LF);
for (int i = 0; i < 3; i++) {
- for (String subKey : subKeys) {
+ for (final String subKey : subKeys) {
sb.append("\t").append(subKey);
}
}
sb.append(LF);
- for (String key : results.keySet()) {
+ for (final String key : results.keySet()) {
sb.append(key);
for (int i = 0; i < 3; i++) {
- Map<String, Stats> sub = results.get(key);
- for (String subKey : sub.keySet()) {
- Stats stats = sub.get(subKey);
+ final Map<String, Stats> sub = results.get(key);
+ for (final String subKey : sub.keySet()) {
+ final Stats stats = sub.get(subKey);
switch (i) {
case 0:
sb.append("\t").append((long) stats.avgLatency);
@@ -104,19 +104,19 @@ class PerfTestResultFormatter {
}
private String throughputTable() {
- StringBuilder sb = new StringBuilder(4 * 1024);
- Set<String> subKeys = results.values().iterator().next().keySet();
+ final StringBuilder sb = new StringBuilder(4 * 1024);
+ final Set<String> subKeys = results.values().iterator().next().keySet();
sb.append("\tThroughput per thread (msg/sec)");
sb.append(LF);
- for (String subKey : subKeys) {
+ for (final String subKey : subKeys) {
sb.append("\t").append(subKey);
}
sb.append(LF);
- for (String key : results.keySet()) {
+ for (final String key : results.keySet()) {
sb.append(key);
- Map<String, Stats> sub = results.get(key);
- for (String subKey : sub.keySet()) {
- Stats stats = sub.get(subKey);
+ final Map<String, Stats> sub = results.get(key);
+ for (final String subKey : sub.keySet()) {
+ final Stats stats = sub.get(subKey);
sb.append("\t").append(stats.throughput);
}
sb.append(LF);
@@ -124,19 +124,19 @@ class PerfTestResultFormatter {
return sb.toString();
}
- private void process(String line) throws ParseException {
- String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
- String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
- String throughput = line.substring(line.indexOf("throughput: ")
+ private void process(final String line) throws ParseException {
+ final String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
+ final String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
+ final String throughput = line.substring(line.indexOf("throughput: ")
+ "throughput: ".length(), line.indexOf(" ops"));
- String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
+ final String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
line.indexOf(" 99%"));
- String pct99 = line.substring(
+ final String pct99 = line.substring(
line.indexOf("99% < ") + "99% < ".length(),
line.indexOf(" 99.99%"));
- String pct99_99 = line.substring(line.indexOf("99.99% < ")
+ final String pct99_99 = line.substring(line.indexOf("99.99% < ")
+ "99.99% < ".length(), line.lastIndexOf('(') - 1);
- Stats stats = new Stats(throughput, avg, pct99, pct99_99);
+ final Stats stats = new Stats(throughput, avg, pct99, pct99_99);
Map<String, Stats> map = results.get(key.trim());
if (map == null) {
map = new TreeMap<String, Stats>(sort());
@@ -156,9 +156,9 @@ class PerfTestResultFormatter {
"64 threads");
@Override
- public int compare(String o1, String o2) {
- int i1 = expected.indexOf(o1);
- int i2 = expected.indexOf(o2);
+ public int compare(final String o1, final String o2) {
+ final int i1 = expected.indexOf(o1);
+ final int i2 = expected.indexOf(o2);
if (i1 < 0 || i2 < 0) {
return o1.compareTo(o2);
}
@@ -167,9 +167,9 @@ class PerfTestResultFormatter {
};
}
- public static void main(String[] args) throws Exception {
- PerfTestResultFormatter fmt = new PerfTestResultFormatter();
- BufferedReader reader = new BufferedReader(new InputStreamReader(
+ public static void main(final String[] args) throws Exception {
+ final PerfTestResultFormatter fmt = new PerfTestResultFormatter();
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(
System.in));
String line;
while ((line = reader.readLine()) != null) {
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java Tue Jul 9 06:08:25 2013
@@ -24,32 +24,32 @@ import com.lmax.disruptor.collections.Hi
public class RunLog4j1 implements IPerfTestRunner {
@Override
- public void runThroughputTest(int lines, Histogram histogram) {
- long s1 = System.nanoTime();
- Logger logger = LogManager.getLogger(getClass());
+ public void runThroughputTest(final int lines, final Histogram histogram) {
+ final long s1 = System.nanoTime();
+ final Logger logger = LogManager.getLogger(getClass());
for (int j = 0; j < lines; j++) {
logger.info(THROUGHPUT_MSG);
}
- long s2 = System.nanoTime();
- long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
+ final long s2 = System.nanoTime();
+ final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
histogram.addObservation(opsPerSec);
}
@Override
- public void runLatencyTest(int samples, Histogram histogram,
- long nanoTimeCost, int threadCount) {
- Logger logger = LogManager.getLogger(getClass());
+ public void runLatencyTest(final int samples, final Histogram histogram,
+ final long nanoTimeCost, final int threadCount) {
+ final Logger logger = LogManager.getLogger(getClass());
for (int i = 0; i < samples; i++) {
- long s1 = System.nanoTime();
+ final long s1 = System.nanoTime();
logger.info(LATENCY_MSG);
- long s2 = System.nanoTime();
- long value = s2 - s1 - nanoTimeCost;
+ final long s2 = System.nanoTime();
+ final long value = s2 - s1 - nanoTimeCost;
if (value > 0) {
histogram.addObservation(value);
}
// wait 1 microsec
final long PAUSE_NANOS = 10000 * threadCount;
- long pauseStart = System.nanoTime();
+ final long pauseStart = System.nanoTime();
while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
// busy spin
}
@@ -62,8 +62,8 @@ public class RunLog4j1 implements IPerfT
}
@Override
- public void log(String finalMessage) {
- Logger logger = LogManager.getLogger(getClass());
+ public void log(final String finalMessage) {
+ final Logger logger = LogManager.getLogger(getClass());
logger.info(finalMessage);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java Tue Jul 9 06:08:25 2013
@@ -25,33 +25,33 @@ import com.lmax.disruptor.collections.Hi
public class RunLog4j2 implements IPerfTestRunner {
@Override
- public void runThroughputTest(int lines, Histogram histogram) {
- long s1 = System.nanoTime();
- Logger logger = LogManager.getLogger(getClass());
+ public void runThroughputTest(final int lines, final Histogram histogram) {
+ final long s1 = System.nanoTime();
+ final Logger logger = LogManager.getLogger(getClass());
for (int j = 0; j < lines; j++) {
logger.info(THROUGHPUT_MSG);
}
- long s2 = System.nanoTime();
- long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
+ final long s2 = System.nanoTime();
+ final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
histogram.addObservation(opsPerSec);
}
@Override
- public void runLatencyTest(int samples, Histogram histogram,
- long nanoTimeCost, int threadCount) {
- Logger logger = LogManager.getLogger(getClass());
+ public void runLatencyTest(final int samples, final Histogram histogram,
+ final long nanoTimeCost, final int threadCount) {
+ final Logger logger = LogManager.getLogger(getClass());
for (int i = 0; i < samples; i++) {
- long s1 = System.nanoTime();
+ final long s1 = System.nanoTime();
logger.info(LATENCY_MSG);
- long s2 = System.nanoTime();
- long value = s2 - s1 - nanoTimeCost;
+ final long s2 = System.nanoTime();
+ final long value = s2 - s1 - nanoTimeCost;
if (value > 0) {
histogram.addObservation(value);
}
// wait 1 microsec
final long PAUSE_NANOS = 10000 * threadCount;
- long pauseStart = System.nanoTime();
+ final long pauseStart = System.nanoTime();
while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
// busy spin
}
@@ -66,8 +66,8 @@ public class RunLog4j2 implements IPerfT
@Override
- public void log(String finalMessage) {
- Logger logger = LogManager.getLogger(getClass());
+ public void log(final String finalMessage) {
+ final Logger logger = LogManager.getLogger(getClass());
logger.info(finalMessage);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java Tue Jul 9 06:08:25 2013
@@ -26,32 +26,32 @@ import com.lmax.disruptor.collections.Hi
public class RunLogback implements IPerfTestRunner {
@Override
- public void runThroughputTest(int lines, Histogram histogram) {
- long s1 = System.nanoTime();
- Logger logger = (Logger) LoggerFactory.getLogger(getClass());
+ public void runThroughputTest(final int lines, final Histogram histogram) {
+ final long s1 = System.nanoTime();
+ final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
for (int j = 0; j < lines; j++) {
logger.info(THROUGHPUT_MSG);
}
- long s2 = System.nanoTime();
- long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
+ final long s2 = System.nanoTime();
+ final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
histogram.addObservation(opsPerSec);
}
@Override
- public void runLatencyTest(int samples, Histogram histogram,
- long nanoTimeCost, int threadCount) {
- Logger logger = (Logger) LoggerFactory.getLogger(getClass());
+ public void runLatencyTest(final int samples, final Histogram histogram,
+ final long nanoTimeCost, final int threadCount) {
+ final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
for (int i = 0; i < samples; i++) {
- long s1 = System.nanoTime();
+ final long s1 = System.nanoTime();
logger.info(LATENCY_MSG);
- long s2 = System.nanoTime();
- long value = s2 - s1 - nanoTimeCost;
+ final long s2 = System.nanoTime();
+ final long value = s2 - s1 - nanoTimeCost;
if (value > 0) {
histogram.addObservation(value);
}
// wait 1 microsec
final long PAUSE_NANOS = 10000 * threadCount;
- long pauseStart = System.nanoTime();
+ final long pauseStart = System.nanoTime();
while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
// busy spin
}
@@ -64,8 +64,8 @@ public class RunLogback implements IPerf
}
@Override
- public void log(String msg) {
- Logger logger = (Logger) LoggerFactory.getLogger(getClass());
+ public void log(final String msg) {
+ final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
logger.info(msg);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java Tue Jul 9 06:08:25 2013
@@ -63,12 +63,12 @@ public class AdvertiserTest {
file.delete();
}
- private void verifyExpectedEntriesAdvertised(Map<Object, Map<String, String>> entries) {
+ private void verifyExpectedEntriesAdvertised(final Map<Object, Map<String, String>> entries) {
boolean foundFile1 = false;
boolean foundFile2 = false;
boolean foundSocket1 = false;
boolean foundSocket2 = false;
- for (Map<String, String>entry:entries.values()) {
+ for (final Map<String, String>entry:entries.values()) {
if (foundFile1 && foundFile2 && foundSocket1 && foundSocket2) {
break;
}
@@ -103,7 +103,7 @@ public class AdvertiserTest {
final LoggerContext ctx = (LoggerContext) LogManager.getContext();
ctx.stop();
- Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
+ final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
assertTrue("Entries found: " + entries, entries.isEmpty());
//reconfigure for subsequent testing
@@ -117,7 +117,7 @@ public class AdvertiserTest {
final LoggerContext ctx = (LoggerContext) LogManager.getContext();
ctx.stop();
- Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
+ final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
assertTrue("Entries found: " + entries, entries.isEmpty());
ctx.start();
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java Tue Jul 9 06:08:25 2013
@@ -34,9 +34,9 @@ public class BaseConfigurationTest {
@Test
public void testMissingRootLogger() throws Exception {
PluginManager.addPackage("org.apache.logging.log4j.test.appender");
- LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
+ final LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
final Logger logger = LogManager.getLogger("sample.Logger1");
- Configuration config = ctx.getConfiguration();
+ final Configuration config = ctx.getConfiguration();
assertNotNull("Config not null", config);
// final String MISSINGROOT = "MissingRootTest";
// assertTrue("Incorrect Configuration. Expected " + MISSINGROOT + " but found " + config.getName(),
@@ -53,15 +53,15 @@ public class BaseConfigurationTest {
// only the sample logger, no root logger in loggerMap!
assertTrue("contains key=sample", loggerMap.containsKey("sample"));
- LoggerConfig sample = loggerMap.get("sample");
- Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
+ final LoggerConfig sample = loggerMap.get("sample");
+ final Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
assertEquals("sampleAppenders Size", 1, sampleAppenders.size());
// sample only has List appender, not Console!
assertTrue("sample has appender List", sampleAppenders.containsKey("List"));
- BaseConfiguration baseConfig = (BaseConfiguration) config;
- LoggerConfig root = baseConfig.getRootLogger();
- Map<String, Appender<?>> rootAppenders = root.getAppenders();
+ final BaseConfiguration baseConfig = (BaseConfiguration) config;
+ final LoggerConfig root = baseConfig.getRootLogger();
+ final Map<String, Appender<?>> rootAppenders = root.getAppenders();
assertEquals("rootAppenders Size", 1, rootAppenders.size());
// root only has Console appender!
assertTrue("root has appender Console", rootAppenders.containsKey("Console"));
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java Tue Jul 9 06:08:25 2013
@@ -28,20 +28,20 @@ public class InMemoryAdvertiser implemen
public static Map<Object, Map<String, String>> getAdvertisedEntries()
{
- Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
+ final Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
result.putAll(properties);
return result;
}
@Override
- public Object advertise(Map<String, String> newEntry) {
- Object object = new Object();
+ public Object advertise(final Map<String, String> newEntry) {
+ final Object object = new Object();
properties.put(object, new HashMap<String, String>(newEntry));
return object;
}
@Override
- public void unadvertise(Object advertisedObject) {
+ public void unadvertise(final Object advertisedObject) {
properties.remove(advertisedObject);
}
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java Tue Jul 9 06:08:25 2013
@@ -189,24 +189,24 @@ public class TestConfigurator {
public void testEnvironment() throws Exception {
final LoggerContext ctx = Configurator.initialize("-config", null, (String) null);
final Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
- Configuration config = ctx.getConfiguration();
+ final Configuration config = ctx.getConfiguration();
assertNotNull("No configuration", config);
assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
CONFIG_NAME.equals(config.getName()));
final Map<String, Appender<?>> map = config.getAppenders();
assertNotNull("No Appenders", map != null && map.size() > 0);
Appender<?> app = null;
- for (Map.Entry<String, Appender<?>> entry: map.entrySet()) {
+ for (final Map.Entry<String, Appender<?>> entry: map.entrySet()) {
if (entry.getKey().equals("List2")) {
app = entry.getValue();
break;
}
}
assertNotNull("No ListAppender named List2", app);
- Layout layout = app.getLayout();
+ final Layout layout = app.getLayout();
assertNotNull("Appender List2 does not have a Layout", layout);
assertTrue("Appender List2 is not configured with a PatternLayout", layout instanceof PatternLayout);
- String pattern = ((PatternLayout) layout).getConversionPattern();
+ final String pattern = ((PatternLayout) layout).getConversionPattern();
assertNotNull("No conversion pattern for List2 PatternLayout", pattern);
assertFalse("Environment variable was not substituted", pattern.startsWith("${env:PATH}"));
}
Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java (original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java Tue Jul 9 06:08:25 2013
@@ -55,7 +55,7 @@ public class RegexFilterTest {
@Test
public void TestNoMsg() {
- RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
+ final RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
filter.start();
assertTrue(filter.isStarted());
assertTrue(filter.filter(null, Level.DEBUG, null, (String)null, (Throwable)null) == Filter.Result.DENY);
Re: svn commit: r1501104 [4/5] - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/ api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j/s...
Posted by Nick Williams <ni...@nicholaswilliams.net>.
Interesting. I haven't been noticing any problems with IntelliJ 12 lately (and, man, have I ever been using it a lot these days). Hmm. :-/
N
On Jul 9, 2013, at 3:30 PM, Ralph Goers wrote:
> I fixed both compile errors. Unfortunately, I have been working on the fix for the FlumePersistentManager and IntelliJ lost it due to the conflicts with all the changes that were made. I'm not really sure why - the latest versions of IntelliJ 12 have been misbehaving for me.
>
> Ralph
>
> On Jul 9, 2013, at 1:25 PM, Nick Williams wrote:
>
>> Ralph already committed a change a few minutes ago that removed the @Override from that method that can't have it.
>>
>> N
>>
>> On Jul 9, 2013, at 3:20 PM, Gary Gregory wrote:
>>
>>> Everything is compiling in Eclipse (Java 6) and Maven (Java 7) but I just read Nick's comment. I am running Maven on Java 6 as I write this...
>>>
>>> Gary
>>>
>>>
>>> On Tue, Jul 9, 2013 at 4:10 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>>> After fixing the prior compiler error I then ran into this one:
>>>
>>> [INFO] ------------------------------------------------------------------------
>>> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project log4j-core: Compilation failure
>>> [ERROR] /Users/rgoers/projects/apache/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java:[177,13] variable _averageOpsPerSec might already have been assigned
>>>
>>> Can you please compile and test before committing?
>>>
>>> Ralph
>>>
>>> On Jul 8, 2013, at 11:08 PM, ggregory@apache.org wrote:
>>>
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -41,7 +41,7 @@ public class ContextStackAttributeConver
>>> >
>>> > @Test
>>> > public void testConvertToDatabaseColumn01() {
>>> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
>>> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
>>> > Arrays.asList("value1", "another2"));
>>> >
>>> > assertEquals("The converted value is not correct.", "value1\nanother2",
>>> > @@ -50,7 +50,7 @@ public class ContextStackAttributeConver
>>> >
>>> > @Test
>>> > public void testConvertToDatabaseColumn02() {
>>> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
>>> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
>>> > Arrays.asList("key1", "value2", "my3"));
>>> >
>>> > assertEquals("The converted value is not correct.",
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -42,14 +42,14 @@ public class ContextStackJsonAttributeCo
>>> > @Test
>>> > public void testConvert01() {
>>> > ThreadContext.clearStack();
>>> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
>>> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
>>> > Arrays.asList("value1", "another2"));
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(stack);
>>> > + final String converted = this.converter.convertToDatabaseColumn(stack);
>>> >
>>> > assertNotNull("The converted value should not be null.", converted);
>>> >
>>> > - ThreadContext.ContextStack reversed = this.converter
>>> > + final ThreadContext.ContextStack reversed = this.converter
>>> > .convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > @@ -60,14 +60,14 @@ public class ContextStackJsonAttributeCo
>>> > @Test
>>> > public void testConvert02() {
>>> > ThreadContext.clearStack();
>>> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
>>> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
>>> > Arrays.asList("key1", "value2", "my3"));
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(stack);
>>> > + final String converted = this.converter.convertToDatabaseColumn(stack);
>>> >
>>> > assertNotNull("The converted value should not be null.", converted);
>>> >
>>> > - ThreadContext.ContextStack reversed = this.converter
>>> > + final ThreadContext.ContextStack reversed = this.converter
>>> > .convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -39,14 +39,14 @@ public class MarkerAttributeConverterTes
>>> >
>>> > @Test
>>> > public void testConvert01() {
>>> > - Marker marker = MarkerManager.getMarker("testConvert01");
>>> > + final Marker marker = MarkerManager.getMarker("testConvert01");
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(marker);
>>> > + final String converted = this.converter.convertToDatabaseColumn(marker);
>>> >
>>> > assertNotNull("The converted value should not be null.", converted);
>>> > assertEquals("The converted value is not correct.", "testConvert01", converted);
>>> >
>>> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
>>> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > assertEquals("The reversed value is not correct.", "testConvert01", marker.getName());
>>> > @@ -54,19 +54,19 @@ public class MarkerAttributeConverterTes
>>> >
>>> > @Test
>>> > public void testConvert02() {
>>> > - Marker marker = MarkerManager.getMarker("testConvert02",
>>> > + final Marker marker = MarkerManager.getMarker("testConvert02",
>>> > MarkerManager.getMarker("anotherConvert02",
>>> > MarkerManager.getMarker("finalConvert03")
>>> > )
>>> > );
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(marker);
>>> > + final String converted = this.converter.convertToDatabaseColumn(marker);
>>> >
>>> > assertNotNull("The converted value should not be null.", converted);
>>> > assertEquals("The converted value is not correct.", "testConvert02[ anotherConvert02[ finalConvert03 ] ] ]",
>>> > converted);
>>> >
>>> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
>>> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > assertEquals("The reversed value is not correct.", "testConvert02", marker.getName());
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -41,14 +41,14 @@ public class MessageAttributeConverterTe
>>> >
>>> > @Test
>>> > public void testConvert01() {
>>> > - Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
>>> > + final Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(message);
>>> > + final String converted = this.converter.convertToDatabaseColumn(message);
>>> >
>>> > assertNotNull("The converted value should not be null.", converted);
>>> > assertEquals("The converted value is not correct.", "Message #3 said [Hello].", converted);
>>> >
>>> > - Message reversed = this.converter.convertToEntityAttribute(converted);
>>> > + final Message reversed = this.converter.convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > assertEquals("The reversed value is not correct.", "Message #3 said [Hello].", reversed.getFormattedMessage());
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -37,15 +37,15 @@ public class StackTraceElementAttributeC
>>> >
>>> > @Test
>>> > public void testConvert01() {
>>> > - StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
>>> > + final StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(element);
>>> > + final String converted = this.converter.convertToDatabaseColumn(element);
>>> >
>>> > assertNotNull("The converted value should not be null.", converted);
>>> > assertEquals("The converted value is not correct.", "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
>>> > converted);
>>> >
>>> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>>> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > assertEquals("The class name is not correct.", "TestNoPackage", reversed.getClassName());
>>> > @@ -57,17 +57,17 @@ public class StackTraceElementAttributeC
>>> >
>>> > @Test
>>> > public void testConvert02() {
>>> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
>>> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
>>> > "testConvert02", "TestWithPackage.java", -1);
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(element);
>>> > + final String converted = this.converter.convertToDatabaseColumn(element);
>>> >
>>> > assertNotNull("The converted value should not be null.", converted);
>>> > assertEquals("The converted value is not correct.",
>>> > "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
>>> > converted);
>>> >
>>> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>>> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > assertEquals("The class name is not correct.", "org.apache.logging.TestWithPackage", reversed.getClassName());
>>> > @@ -79,17 +79,17 @@ public class StackTraceElementAttributeC
>>> >
>>> > @Test
>>> > public void testConvert03() {
>>> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
>>> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
>>> > "testConvert03", null, -1);
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(element);
>>> > + final String converted = this.converter.convertToDatabaseColumn(element);
>>> >
>>> > assertNotNull("The converted value should not be null.", converted);
>>> > assertEquals("The converted value is not correct.",
>>> > "org.apache.logging.TestNoSource.testConvert03(Unknown Source)",
>>> > converted);
>>> >
>>> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>>> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > assertEquals("The class name is not correct.", "org.apache.logging.TestNoSource", reversed.getClassName());
>>> > @@ -101,17 +101,17 @@ public class StackTraceElementAttributeC
>>> >
>>> > @Test
>>> > public void testConvert04() {
>>> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
>>> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
>>> > "testConvert04", null, -2);
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(element);
>>> > + final String converted = this.converter.convertToDatabaseColumn(element);
>>> >
>>> > assertNotNull("The converted value should not be null.", converted);
>>> > assertEquals("The converted value is not correct.",
>>> > "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
>>> > converted);
>>> >
>>> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>>> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > assertEquals("The class name is not correct.", "org.apache.logging.TestIsNativeMethod",
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -39,16 +39,16 @@ public class ThrowableAttributeConverter
>>> >
>>> > @Test
>>> > public void testConvert01() {
>>> > - RuntimeException exception = new RuntimeException("My message 01.");
>>> > + final RuntimeException exception = new RuntimeException("My message 01.");
>>> >
>>> > - String stackTrace = getStackTrace(exception);
>>> > + final String stackTrace = getStackTrace(exception);
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(exception);
>>> > + final String converted = this.converter.convertToDatabaseColumn(exception);
>>> >
>>> > assertNotNull("The converted value is not correct.", converted);
>>> > assertEquals("The converted value is not correct.", stackTrace, converted);
>>> >
>>> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
>>> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
>>> > @@ -56,18 +56,18 @@ public class ThrowableAttributeConverter
>>> >
>>> > @Test
>>> > public void testConvert02() {
>>> > - SQLException cause2 = new SQLException("This is a test cause.");
>>> > - Error cause1 = new Error(cause2);
>>> > - RuntimeException exception = new RuntimeException("My message 01.", cause1);
>>> > + final SQLException cause2 = new SQLException("This is a test cause.");
>>> > + final Error cause1 = new Error(cause2);
>>> > + final RuntimeException exception = new RuntimeException("My message 01.", cause1);
>>> >
>>> > - String stackTrace = getStackTrace(exception);
>>> > + final String stackTrace = getStackTrace(exception);
>>> >
>>> > - String converted = this.converter.convertToDatabaseColumn(exception);
>>> > + final String converted = this.converter.convertToDatabaseColumn(exception);
>>> >
>>> > assertNotNull("The converted value is not correct.", converted);
>>> > assertEquals("The converted value is not correct.", stackTrace, converted);
>>> >
>>> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
>>> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
>>> >
>>> > assertNotNull("The reversed value should not be null.", reversed);
>>> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
>>> > @@ -84,10 +84,10 @@ public class ThrowableAttributeConverter
>>> > assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
>>> > }
>>> >
>>> > - private static String getStackTrace(Throwable throwable) {
>>> > + private static String getStackTrace(final Throwable throwable) {
>>> > String returnValue = throwable.toString() + "\n";
>>> >
>>> > - for (StackTraceElement element : throwable.getStackTrace()) {
>>> > + for (final StackTraceElement element : throwable.getStackTrace()) {
>>> > returnValue += "\tat " + element.toString() + "\n";
>>> > }
>>> >
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -51,7 +51,7 @@ public class MapRewritePolicyTest {
>>> > logEvent1 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ERROR,
>>> > new MapMessage(map), null, map, null, "none",
>>> > new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 29), 2);
>>> > - ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
>>> > + final ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
>>> > logEvent2 = new Log4jLogEvent("test", MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
>>> > Level.TRACE, new StructuredDataMessage("test", "Nothing", "test", map), new RuntimeException("test"), null,
>>> > stack, "none", new StackTraceElement("MapRewritePolicyTest",
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -112,7 +112,7 @@ public class RewriteAppenderTest {
>>> > StructuredDataMessage msg = new StructuredDataMessage("Test", "This is a test", "Service");
>>> > msg.put("Key1", "Value2");
>>> > msg.put("Key2", "Value1");
>>> > - Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
>>> > + final Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
>>> > logger.debug(msg);
>>> > msg = new StructuredDataMessage("Test", "This is a test", "Service");
>>> > msg.put("Key1", "Value1");
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -40,23 +40,23 @@ public class FastRollingFileManagerTest
>>> > */
>>> > @Test
>>> > public void testWrite_multiplesOfBufferSize() throws IOException {
>>> > - File file = File.createTempFile("log4j2", "test");
>>> > + final File file = File.createTempFile("log4j2", "test");
>>> > file.deleteOnExit();
>>> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
>>> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
>>> > - boolean append = false;
>>> > - boolean flushNow = false;
>>> > - long triggerSize = Long.MAX_VALUE;
>>> > - long time = System.currentTimeMillis();
>>> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>>> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
>>> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
>>> > + final boolean append = false;
>>> > + final boolean flushNow = false;
>>> > + final long triggerSize = Long.MAX_VALUE;
>>> > + final long time = System.currentTimeMillis();
>>> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>>> > triggerSize);
>>> > - RolloverStrategy rolloverStrategy = null;
>>> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
>>> > + final RolloverStrategy rolloverStrategy = null;
>>> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
>>> > file.getName(), "", os, append, flushNow, triggerSize, time,
>>> > triggerPolicy, rolloverStrategy, null, null);
>>> >
>>> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
>>> > - byte[] data = new byte[size];
>>> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
>>> > + final byte[] data = new byte[size];
>>> > manager.write(data, 0, data.length); // no buffer overflow exception
>>> >
>>> > // buffer is full but not flushed yet
>>> > @@ -71,23 +71,23 @@ public class FastRollingFileManagerTest
>>> > */
>>> > @Test
>>> > public void testWrite_dataExceedingBufferSize() throws IOException {
>>> > - File file = File.createTempFile("log4j2", "test");
>>> > + final File file = File.createTempFile("log4j2", "test");
>>> > file.deleteOnExit();
>>> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
>>> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
>>> > - boolean append = false;
>>> > - boolean flushNow = false;
>>> > - long triggerSize = 0;
>>> > - long time = System.currentTimeMillis();
>>> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>>> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
>>> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
>>> > + final boolean append = false;
>>> > + final boolean flushNow = false;
>>> > + final long triggerSize = 0;
>>> > + final long time = System.currentTimeMillis();
>>> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>>> > triggerSize);
>>> > - RolloverStrategy rolloverStrategy = null;
>>> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
>>> > + final RolloverStrategy rolloverStrategy = null;
>>> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
>>> > file.getName(), "", os, append, flushNow, triggerSize, time,
>>> > triggerPolicy, rolloverStrategy, null, null);
>>> >
>>> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
>>> > - byte[] data = new byte[size];
>>> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
>>> > + final byte[] data = new byte[size];
>>> > manager.write(data, 0, data.length); // no exception
>>> > assertEquals(FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3,
>>> > raf.length());
>>> > @@ -98,12 +98,12 @@ public class FastRollingFileManagerTest
>>> >
>>> > @Test
>>> > public void testAppendDoesNotOverwriteExistingFile() throws IOException {
>>> > - boolean isAppend = true;
>>> > - File file = File.createTempFile("log4j2", "test");
>>> > + final boolean isAppend = true;
>>> > + final File file = File.createTempFile("log4j2", "test");
>>> > file.deleteOnExit();
>>> > assertEquals(0, file.length());
>>> >
>>> > - byte[] bytes = new byte[4 * 1024];
>>> > + final byte[] bytes = new byte[4 * 1024];
>>> >
>>> > // create existing file
>>> > FileOutputStream fos = null;
>>> > @@ -116,31 +116,31 @@ public class FastRollingFileManagerTest
>>> > }
>>> > assertEquals("all flushed to disk", bytes.length, file.length());
>>> >
>>> > - FastRollingFileManager manager = FastRollingFileManager
>>> > + final FastRollingFileManager manager = FastRollingFileManager
>>> > .getFastRollingFileManager(
>>> > //
>>> > file.getAbsolutePath(), "", isAppend, true,
>>> > new SizeBasedTriggeringPolicy(Long.MAX_VALUE), //
>>> > null, null, null);
>>> > manager.write(bytes, 0, bytes.length);
>>> > - int expected = bytes.length * 2;
>>> > + final int expected = bytes.length * 2;
>>> > assertEquals("appended, not overwritten", expected, file.length());
>>> > }
>>> >
>>> > @Test
>>> > public void testFileTimeBasedOnSystemClockWhenAppendIsFalse()
>>> > throws IOException {
>>> > - File file = File.createTempFile("log4j2", "test");
>>> > + final File file = File.createTempFile("log4j2", "test");
>>> > file.deleteOnExit();
>>> > LockSupport.parkNanos(1000000); // 1 millisec
>>> >
>>> > // append is false deletes the file if it exists
>>> > - boolean isAppend = false;
>>> > - long expectedMin = System.currentTimeMillis();
>>> > - long expectedMax = expectedMin + 50;
>>> > + final boolean isAppend = false;
>>> > + final long expectedMin = System.currentTimeMillis();
>>> > + final long expectedMax = expectedMin + 50;
>>> > assertTrue(file.lastModified() < expectedMin);
>>> >
>>> > - FastRollingFileManager manager = FastRollingFileManager
>>> > + final FastRollingFileManager manager = FastRollingFileManager
>>> > .getFastRollingFileManager(
>>> > //
>>> > file.getAbsolutePath(), "", isAppend, true,
>>> > @@ -153,14 +153,14 @@ public class FastRollingFileManagerTest
>>> > @Test
>>> > public void testFileTimeBasedOnFileModifiedTimeWhenAppendIsTrue()
>>> > throws IOException {
>>> > - File file = File.createTempFile("log4j2", "test");
>>> > + final File file = File.createTempFile("log4j2", "test");
>>> > file.deleteOnExit();
>>> > LockSupport.parkNanos(1000000); // 1 millisec
>>> >
>>> > - boolean isAppend = true;
>>> > + final boolean isAppend = true;
>>> > assertTrue(file.lastModified() < System.currentTimeMillis());
>>> >
>>> > - FastRollingFileManager manager = FastRollingFileManager
>>> > + final FastRollingFileManager manager = FastRollingFileManager
>>> > .getFastRollingFileManager(
>>> > //
>>> > file.getAbsolutePath(), "", isAppend, true,
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -35,7 +35,7 @@ public class FileRenameActionTest {
>>> >
>>> > @BeforeClass
>>> > public static void beforeClass() throws Exception {
>>> > - File file = new File(DIR);
>>> > + final File file = new File(DIR);
>>> > file.mkdirs();
>>> > }
>>> >
>>> > @@ -51,15 +51,15 @@ public class FileRenameActionTest {
>>> >
>>> > @Test
>>> > public void testRename1() throws Exception {
>>> > - File file = new File("target/fileRename/fileRename.log");
>>> > - PrintStream pos = new PrintStream(file);
>>> > + final File file = new File("target/fileRename/fileRename.log");
>>> > + final PrintStream pos = new PrintStream(file);
>>> > for (int i = 0; i < 100; ++i) {
>>> > pos.println("This is line " + i);
>>> > }
>>> > pos.close();
>>> >
>>> > - File dest = new File("target/fileRename/newFile.log");
>>> > - FileRenameAction action = new FileRenameAction(file, dest, false);
>>> > + final File dest = new File("target/fileRename/newFile.log");
>>> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
>>> > action.execute();
>>> > assertTrue("Renamed file does not exist", dest.exists());
>>> > assertTrue("Old file exists", !file.exists());
>>> > @@ -67,12 +67,12 @@ public class FileRenameActionTest {
>>> >
>>> > @Test
>>> > public void testEmpty() throws Exception {
>>> > - File file = new File("target/fileRename/fileRename.log");
>>> > - PrintStream pos = new PrintStream(file);
>>> > + final File file = new File("target/fileRename/fileRename.log");
>>> > + final PrintStream pos = new PrintStream(file);
>>> > pos.close();
>>> >
>>> > - File dest = new File("target/fileRename/newFile.log");
>>> > - FileRenameAction action = new FileRenameAction(file, dest, false);
>>> > + final File dest = new File("target/fileRename/newFile.log");
>>> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
>>> > action.execute();
>>> > assertTrue("Renamed file does not exist", !dest.exists());
>>> > assertTrue("Old file does not exist", !file.exists());
>>> > @@ -81,16 +81,16 @@ public class FileRenameActionTest {
>>> >
>>> > @Test
>>> > public void testNoParent() throws Exception {
>>> > - File file = new File("fileRename.log");
>>> > - PrintStream pos = new PrintStream(file);
>>> > + final File file = new File("fileRename.log");
>>> > + final PrintStream pos = new PrintStream(file);
>>> > for (int i = 0; i < 100; ++i) {
>>> > pos.println("This is line " + i);
>>> > }
>>> > pos.close();
>>> >
>>> > - File dest = new File("newFile.log");
>>> > + final File dest = new File("newFile.log");
>>> > try {
>>> > - FileRenameAction action = new FileRenameAction(file, dest, false);
>>> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
>>> > action.execute();
>>> > assertTrue("Renamed file does not exist", dest.exists());
>>> > assertTrue("Old file exists", !file.exists());
>>> > @@ -98,7 +98,7 @@ public class FileRenameActionTest {
>>> > try {
>>> > dest.delete();
>>> > file.delete();
>>> > - } catch (Exception ex) {
>>> > + } catch (final Exception ex) {
>>> > System.out.println("Unable to cleanup files written to main directory");
>>> > }
>>> > }
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -39,17 +39,17 @@ public class AsyncLoggerConfigTest {
>>> >
>>> > @Test
>>> > public void testAdditivity() throws Exception {
>>> > - File f = new File("target", "AsyncLoggerConfigTest.log");
>>> > + final File f = new File("target", "AsyncLoggerConfigTest.log");
>>> > // System.out.println(f.getAbsolutePath());
>>> > f.delete();
>>> > - Logger log = LogManager.getLogger("com.foo.Bar");
>>> > - String msg = "Additive logging: 2 for the price of 1!";
>>> > + final Logger log = LogManager.getLogger("com.foo.Bar");
>>> > + final String msg = "Additive logging: 2 for the price of 1!";
>>> > log.info(msg);
>>> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>>> >
>>> > - BufferedReader reader = new BufferedReader(new FileReader(f));
>>> > - String line1 = reader.readLine();
>>> > - String line2 = reader.readLine();
>>> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
>>> > + final String line1 = reader.readLine();
>>> > + final String line2 = reader.readLine();
>>> > reader.close();
>>> > f.delete();
>>> > assertNotNull("line1", line1);
>>> > @@ -57,7 +57,7 @@ public class AsyncLoggerConfigTest {
>>> > assertTrue("line1 correct", line1.contains(msg));
>>> > assertTrue("line2 correct", line2.contains(msg));
>>> >
>>> > - String location = "testAdditivity";
>>> > + final String location = "testAdditivity";
>>> > assertTrue("location",
>>> > line1.contains(location) || line2.contains(location));
>>> > }
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -29,24 +29,24 @@ public class AsyncLoggerContextSelectorT
>>> >
>>> > @Test
>>> > public void testContextReturnsAsyncLoggerContext() {
>>> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>>> > - LoggerContext context = selector.getContext(null, null, false);
>>> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>>> > + final LoggerContext context = selector.getContext(null, null, false);
>>> >
>>> > assertTrue(context instanceof AsyncLoggerContext);
>>> > }
>>> >
>>> > @Test
>>> > public void testContext2ReturnsAsyncLoggerContext() {
>>> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>>> > - LoggerContext context = selector.getContext(null, null, false, null);
>>> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>>> > + final LoggerContext context = selector.getContext(null, null, false, null);
>>> >
>>> > assertTrue(context instanceof AsyncLoggerContext);
>>> > }
>>> >
>>> > @Test
>>> > public void testLoggerContextsReturnsAsyncLoggerContext() {
>>> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>>> > - List<LoggerContext> list = selector.getLoggerContexts();
>>> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>>> > + final List<LoggerContext> list = selector.getLoggerContexts();
>>> >
>>> > assertEquals(1, list.size());
>>> > assertTrue(list.get(0) instanceof AsyncLoggerContext);
>>> > @@ -54,8 +54,8 @@ public class AsyncLoggerContextSelectorT
>>> >
>>> > @Test
>>> > public void testContextNameIsAsyncLoggerContext() {
>>> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>>> > - LoggerContext context = selector.getContext(null, null, false);
>>> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>>> > + final LoggerContext context = selector.getContext(null, null, false);
>>> >
>>> > assertEquals("AsyncLoggerContext", context.getName());
>>> > }
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -30,7 +30,7 @@ public class AsyncLoggerContextTest {
>>> >
>>> > @Test
>>> > public void testNewInstanceReturnsAsyncLogger() {
>>> > - Logger logger = new AsyncLoggerContext("a").newInstance(
>>> > + final Logger logger = new AsyncLoggerContext("a").newInstance(
>>> > new LoggerContext("a"), "a", null);
>>> > assertTrue(logger instanceof AsyncLogger);
>>> >
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -49,22 +49,22 @@ public class AsyncLoggerLocationTest {
>>> >
>>> > @Test
>>> > public void testAsyncLogWritesToLog() throws Exception {
>>> > - File f = new File("target", "AsyncLoggerLocationTest.log");
>>> > + final File f = new File("target", "AsyncLoggerLocationTest.log");
>>> > // System.out.println(f.getAbsolutePath());
>>> > f.delete();
>>> > - Logger log = LogManager.getLogger("com.foo.Bar");
>>> > - String msg = "Async logger msg with location";
>>> > + final Logger log = LogManager.getLogger("com.foo.Bar");
>>> > + final String msg = "Async logger msg with location";
>>> > log.info(msg);
>>> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>>> >
>>> > - BufferedReader reader = new BufferedReader(new FileReader(f));
>>> > - String line1 = reader.readLine();
>>> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
>>> > + final String line1 = reader.readLine();
>>> > reader.close();
>>> > f.delete();
>>> > assertNotNull("line1", line1);
>>> > assertTrue("line1 correct", line1.contains(msg));
>>> >
>>> > - String location = "testAsyncLogWritesToLog";
>>> > + final String location = "testAsyncLogWritesToLog";
>>> > assertTrue("has location", line1.contains(location));
>>> > }
>>> >
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -49,22 +49,22 @@ public class AsyncLoggerTest {
>>> >
>>> > @Test
>>> > public void testAsyncLogWritesToLog() throws Exception {
>>> > - File f = new File("target", "AsyncLoggerTest.log");
>>> > + final File f = new File("target", "AsyncLoggerTest.log");
>>> > // System.out.println(f.getAbsolutePath());
>>> > f.delete();
>>> > - Logger log = LogManager.getLogger("com.foo.Bar");
>>> > - String msg = "Async logger msg";
>>> > + final Logger log = LogManager.getLogger("com.foo.Bar");
>>> > + final String msg = "Async logger msg";
>>> > log.info(msg);
>>> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>>> >
>>> > - BufferedReader reader = new BufferedReader(new FileReader(f));
>>> > - String line1 = reader.readLine();
>>> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
>>> > + final String line1 = reader.readLine();
>>> > reader.close();
>>> > f.delete();
>>> > assertNotNull("line1", line1);
>>> > assertTrue("line1 correct", line1.contains(msg));
>>> >
>>> > - String location = "testAsyncLogWritesToLog";
>>> > + final String location = "testAsyncLogWritesToLog";
>>> > assertTrue("no location", !line1.contains(location));
>>> > }
>>> >
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -22,23 +22,23 @@ import com.lmax.disruptor.collections.Hi
>>> >
>>> > public class MTPerfTest extends PerfTest {
>>> >
>>> > - public static void main(String[] args) throws Exception {
>>> > + public static void main(final String[] args) throws Exception {
>>> > new MTPerfTest().doMain(args);
>>> > }
>>> >
>>> > @Override
>>> > public void runTestAndPrintResult(final IPerfTestRunner runner,
>>> > - final String name, final int threadCount, String resultFile)
>>> > + final String name, final int threadCount, final String resultFile)
>>> > throws Exception {
>>> >
>>> > // ThreadContext.put("aKey", "mdcVal");
>>> > PerfTest.println("Warming up the JVM...");
>>> > - long t1 = System.nanoTime();
>>> > + final long t1 = System.nanoTime();
>>> >
>>> > // warmup at least 2 rounds and at most 1 minute
>>> > final Histogram warmupHist = PerfTest.createHistogram();
>>> > final long stop = System.currentTimeMillis() + (60 * 1000);
>>> > - Runnable run1 = new Runnable() {
>>> > + final Runnable run1 = new Runnable() {
>>> > @Override
>>> > public void run() {
>>> > for (int i = 0; i < 10; i++) {
>>> > @@ -50,8 +50,8 @@ public class MTPerfTest extends PerfTest
>>> > }
>>> > }
>>> > };
>>> > - Thread thread1 = new Thread(run1);
>>> > - Thread thread2 = new Thread(run1);
>>> > + final Thread thread1 = new Thread(run1);
>>> > + final Thread thread2 = new Thread(run1);
>>> > thread1.start();
>>> > thread2.start();
>>> > thread1.join();
>>> > @@ -74,7 +74,7 @@ public class MTPerfTest extends PerfTest
>>> > }
>>> >
>>> > private void multiThreadedTestRun(final IPerfTestRunner runner,
>>> > - final String name, final int threadCount, String resultFile)
>>> > + final String name, final int threadCount, final String resultFile)
>>> > throws Exception {
>>> >
>>> > final Histogram[] histograms = new Histogram[threadCount];
>>> > @@ -83,28 +83,28 @@ public class MTPerfTest extends PerfTest
>>> > }
>>> > final int LINES = 256 * 1024;
>>> >
>>> > - Thread[] threads = new Thread[threadCount];
>>> > + final Thread[] threads = new Thread[threadCount];
>>> > for (int i = 0; i < threads.length; i++) {
>>> > final Histogram histogram = histograms[i];
>>> > threads[i] = new Thread() {
>>> > @Override
>>> > public void run() {
>>> > // int latencyCount = threadCount >= 16 ? 1000000 : 5000000;
>>> > - int latencyCount = 5000000;
>>> > - int count = PerfTest.throughput ? LINES / threadCount
>>> > + final int latencyCount = 5000000;
>>> > + final int count = PerfTest.throughput ? LINES / threadCount
>>> > : latencyCount;
>>> > runTest(runner, count, "end", histogram, threadCount);
>>> > }
>>> > };
>>> > }
>>> > - for (Thread thread : threads) {
>>> > + for (final Thread thread : threads) {
>>> > thread.start();
>>> > }
>>> > - for (Thread thread : threads) {
>>> > + for (final Thread thread : threads) {
>>> > thread.join();
>>> > }
>>> >
>>> > - for (Histogram histogram : histograms) {
>>> > + for (final Histogram histogram : histograms) {
>>> > PerfTest.reportResult(resultFile, name, histogram);
>>> > }
>>> > }
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -33,7 +33,7 @@ public class PerfTest {
>>> > // determine how long it takes to call System.nanoTime() (on average)
>>> > static long calcNanoTimeCost() {
>>> > final long iterations = 10000000;
>>> > - long start = System.nanoTime();
>>> > + final long start = System.nanoTime();
>>> > long finish = start;
>>> >
>>> > for (int i = 0; i < iterations; i++) {
>>> > @@ -49,7 +49,7 @@ public class PerfTest {
>>> > }
>>> >
>>> > static Histogram createHistogram() {
>>> > - long[] intervals = new long[31];
>>> > + final long[] intervals = new long[31];
>>> > long intervalUpperBound = 1L;
>>> > for (int i = 0, size = intervals.length - 1; i < size; i++) {
>>> > intervalUpperBound *= 2;
>>> > @@ -60,17 +60,17 @@ public class PerfTest {
>>> > return new Histogram(intervals);
>>> > }
>>> >
>>> > - public static void main(String[] args) throws Exception {
>>> > + public static void main(final String[] args) throws Exception {
>>> > new PerfTest().doMain(args);
>>> > }
>>> >
>>> > - public void doMain(String[] args) throws Exception {
>>> > - String runnerClass = args[0];
>>> > - IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
>>> > + public void doMain(final String[] args) throws Exception {
>>> > + final String runnerClass = args[0];
>>> > + final IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
>>> > .newInstance();
>>> > - String name = args[1];
>>> > - String resultFile = args.length > 2 ? args[2] : null;
>>> > - for (String arg : args) {
>>> > + final String name = args[1];
>>> > + final String resultFile = args.length > 2 ? args[2] : null;
>>> > + for (final String arg : args) {
>>> > if (verbose && throughput) {
>>> > break;
>>> > }
>>> > @@ -81,7 +81,7 @@ public class PerfTest {
>>> > throughput = true;
>>> > }
>>> > }
>>> > - int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
>>> > + final int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
>>> > printf("Starting %s %s (%d)...%n", getClass().getSimpleName(), name,
>>> > threadCount);
>>> > runTestAndPrintResult(runner, name, threadCount, resultFile);
>>> > @@ -89,14 +89,14 @@ public class PerfTest {
>>> > System.exit(0);
>>> > }
>>> >
>>> > - public void runTestAndPrintResult(IPerfTestRunner runner,
>>> > - final String name, int threadCount, String resultFile)
>>> > + public void runTestAndPrintResult(final IPerfTestRunner runner,
>>> > + final String name, final int threadCount, final String resultFile)
>>> > throws Exception {
>>> > - Histogram warmupHist = createHistogram();
>>> > + final Histogram warmupHist = createHistogram();
>>> >
>>> > // ThreadContext.put("aKey", "mdcVal");
>>> > println("Warming up the JVM...");
>>> > - long t1 = System.nanoTime();
>>> > + final long t1 = System.nanoTime();
>>> >
>>> > // warmup at least 2 rounds and at most 1 minute
>>> > final long stop = System.currentTimeMillis() + (60 * 1000);
>>> > @@ -124,46 +124,46 @@ public class PerfTest {
>>> > runSingleThreadedTest(runner, name, resultFile);
>>> > }
>>> >
>>> > - private int runSingleThreadedTest(IPerfTestRunner runner, String name,
>>> > - String resultFile) throws IOException {
>>> > - Histogram latency = createHistogram();
>>> > + private int runSingleThreadedTest(final IPerfTestRunner runner, final String name,
>>> > + final String resultFile) throws IOException {
>>> > + final Histogram latency = createHistogram();
>>> > final int LINES = throughput ? 50000 : 5000000;
>>> > runTest(runner, LINES, "end", latency, 1);
>>> > reportResult(resultFile, name, latency);
>>> > return LINES;
>>> > }
>>> >
>>> > - static void reportResult(String file, String name, Histogram histogram)
>>> > + static void reportResult(final String file, final String name, final Histogram histogram)
>>> > throws IOException {
>>> > - String result = createSamplingReport(name, histogram);
>>> > + final String result = createSamplingReport(name, histogram);
>>> > println(result);
>>> >
>>> > if (file != null) {
>>> > - FileWriter writer = new FileWriter(file, true);
>>> > + final FileWriter writer = new FileWriter(file, true);
>>> > writer.write(result);
>>> > writer.write(System.getProperty("line.separator"));
>>> > writer.close();
>>> > }
>>> > }
>>> >
>>> > - static void printf(String msg, Object... objects) {
>>> > + static void printf(final String msg, final Object... objects) {
>>> > if (verbose) {
>>> > System.out.printf(msg, objects);
>>> > }
>>> > }
>>> >
>>> > - static void println(String msg) {
>>> > + static void println(final String msg) {
>>> > if (verbose) {
>>> > System.out.println(msg);
>>> > }
>>> > }
>>> >
>>> > - static String createSamplingReport(String name, Histogram histogram) {
>>> > - Histogram data = histogram;
>>> > + static String createSamplingReport(final String name, final Histogram histogram) {
>>> > + final Histogram data = histogram;
>>> > if (throughput) {
>>> > return data.getMax() + " operations/second";
>>> > }
>>> > - String result = String.format(
>>> > + final String result = String.format(
>>> > "avg=%.0f 99%%=%d 99.99%%=%d sampleCount=%d", data.getMean(), //
>>> > data.getTwoNinesUpperBound(), //
>>> > data.getFourNinesUpperBound(), //
>>> > @@ -172,12 +172,12 @@ public class PerfTest {
>>> > return result;
>>> > }
>>> >
>>> > - public void runTest(IPerfTestRunner runner, int lines, String finalMessage,
>>> > - Histogram histogram, int threadCount) {
>>> > + public void runTest(final IPerfTestRunner runner, final int lines, final String finalMessage,
>>> > + final Histogram histogram, final int threadCount) {
>>> > if (throughput) {
>>> > runner.runThroughputTest(lines, histogram);
>>> > } else {
>>> > - long nanoTimeCost = calcNanoTimeCost();
>>> > + final long nanoTimeCost = calcNanoTimeCost();
>>> > runner.runLatencyTest(lines, histogram, nanoTimeCost, threadCount);
>>> > }
>>> > if (finalMessage != null) {
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java Tue Jul 9 06:08:25 2013
>>> > @@ -41,19 +41,19 @@ public class PerfTestDriver {
>>> > * Defines the setup for a java process running a performance test.
>>> > */
>>> > static class Setup implements Comparable<Setup> {
>>> > - private Class<?> _class;
>>> > - private String _log4jConfig;
>>> > - private String _name;
>>> > - private String[] _systemProperties;
>>> > - private int _threadCount;
>>> > - private File _temp;
>>> > + private final Class<?> _class;
>>> > + private final String _log4jConfig;
>>> > + private final String _name;
>>> > + private final String[] _systemProperties;
>>> > + private final int _threadCount;
>>> > + private final File _temp;
>>> > public Stats _stats;
>>> > - private WaitStrategy _wait;
>>> > - private String _runner;
>>> > + private final WaitStrategy _wait;
>>> > + private final String _runner;
>>> >
>>> > - public Setup(Class<?> klass, String runner, String name,
>>> > - String log4jConfig, int threadCount, WaitStrategy wait,
>>> > - String... systemProperties) throws IOException {
>>> > + public Setup(final Class<?> klass, final String runner, final String name,
>>> > + final String log4jConfig, final int threadCount, final WaitStrategy wait,
>>> > + final String... systemProperties) throws IOException {
>>> > _class = klass;
>>> > _runner = runner;
>>> > _name = name;
>>> > @@ -64,8 +64,8 @@ public class PerfTestDriver {
>>> > _temp = File.createTempFile("log4jperformance", ".txt");
>>> > }
>>> >
>>> > - List<String> processArguments(String java) {
>>> > - List<String> args = new ArrayList<String>();
>>> > + List<String> processArguments(final String java) {
>>> > + final List<String> args = new ArrayList<String>();
>>> > args.add(java);
>>> > args.add("-server");
>>> > args.add("-Xms1g");
>>> > @@ -84,7 +84,7 @@ public class PerfTestDriver {
>>> > args.add("-Dlog4j.configurationFile=" + _log4jConfig); // log4j 2
>>> > args.add("-Dlogback.configurationFile=" + _log4jConfig);// logback
>>> >
>>> > - int ringBufferSize = getUserSpecifiedRingBufferSize();
>>> > + final int ringBufferSize = getUserSpecifiedRingBufferSize();
>>> > if (ringBufferSize >= 128) {
>>> > args.add("-DAsyncLoggerConfig.RingBufferSize=" + ringBufferSize);
>>> > args.add("-DAsyncLogger.RingBufferSize=" + ringBufferSize);
>>> > @@ -108,23 +108,23 @@ public class PerfTestDriver {
>>> > try {
>>> > return Integer.parseInt(System.getProperty("RingBufferSize",
>>> > "-1"));
>>> > - } catch (Exception ignored) {
>>> > + } catch (final Exception ignored) {
>>> > return -1;
>>> > }
>>> > }
>>> >
>>> > - ProcessBuilder latencyTest(String java) {
>>> > + ProcessBuilder latencyTest(final String java) {
>>> > return new ProcessBuilder(processArguments(java));
>>> > }
>>> >
>>> > - ProcessBuilder throughputTest(String java) {
>>> > - List<String> args = processArguments(java);
>>> > + ProcessBuilder throughputTest(final String java) {
>>> > + final List<String> args = processArguments(java);
>>> > args.add("-throughput");
>>> > return new ProcessBuilder(args);
>>> > }
>>> >
>>> > @Override
>>> > - public int compareTo(Setup other) {
>>> > + public int compareTo(final Setup other) {
>>> > // largest ops/sec first
>>> > return (int) Math.signum(other._stats._averageOpsPerSec
>>> > - _stats._averageOpsPerSec);
>>> > @@ -137,7 +137,7 @@ public class PerfTestDriver {
>>> > } else if (MTPerfTest.class == _class) {
>>> > detail = _threadCount + " threads";
>>> > }
>>> > - String target = _runner.substring(_runner.indexOf(".Run") + 4);
>>> > + final String target = _runner.substring(_runner.indexOf(".Run") + 4);
>>> > return target + ": " + _name + " (" + detail + ")";
>>> > }
>>> > }
>>> > @@ -152,16 +152,16 @@ public class PerfTestDriver {
>>> > long _pct99_99;
>>> > double _latencyRowCount;
>>> > int _throughputRowCount;
>>> > - private long _averageOpsPerSec;
>>> > + private final long _averageOpsPerSec;
>>> >
>>> > // example line: avg=828 99%=1118 99.99%=5028 Count=3125
>>> > - public Stats(String raw) {
>>> > - String[] lines = raw.split("[\\r\\n]+");
>>> > + public Stats(final String raw) {
>>> > + final String[] lines = raw.split("[\\r\\n]+");
>>> > long totalOps = 0;
>>> > - for (String line : lines) {
>>> > + for (final String line : lines) {
>>> > if (line.startsWith("avg")) {
>>> > _latencyRowCount++;
>>> > - String[] parts = line.split(" ");
>>> > + final String[] parts = line.split(" ");
>>> > int i = 0;
>>> > _average += Long.parseLong(parts[i++].split("=")[1]);
>>> > _pct99 += Long.parseLong(parts[i++].split("=")[1]);
>>> > @@ -169,8 +169,8 @@ public class PerfTestDriver {
>>> > _count += Integer.parseInt(parts[i].split("=")[1]);
>>> > } else {
>>> > _throughputRowCount++;
>>> > - String number = line.substring(0, line.indexOf(' '));
>>> > - long opsPerSec = Long.parseLong(number);
>>> > + final String number = line.substring(0, line.indexOf(' '));
>>> > + final long opsPerSec = Long.parseLong(number);
>>> > totalOps += opsPerSec;
>>> > }
>>> > }
>>> > @@ -179,7 +179,7 @@ public class PerfTestDriver {
>>> >
>>> > @Override
>>> > public String toString() {
>>> > - String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
>>> > + final String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
>>> > return String.format(fmt, _averageOpsPerSec, //
>>> > _average / _latencyRowCount, // mean latency
>>> > _pct99 / _latencyRowCount, // 99% observations less than
>>> > @@ -189,24 +189,24 @@ public class PerfTestDriver {
>>> > }
>>> >
>>> > // single-threaded performance test
>>> > - private static Setup s(String config, String runner, String name,
>>> > - String... systemProperties) throws IOException {
>>> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>>> > + private static Setup s(final String config, final String runner, final String name,
>>> > + final String... systemProperties) throws IOException {
>>> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>>> > "WaitStrategy", "Sleep"));
>>> > return new Setup(PerfTest.class, runner, name, config, 1, wait,
>>> > systemProperties);
>>> > }
>>> >
>>> > // multi-threaded performance test
>>> > - private static Setup m(String config, String runner, String name,
>>> > - int threadCount, String... systemProperties) throws IOException {
>>> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>>> > + private static Setup m(final String config, final String runner, final String name,
>>> > + final int threadCount, final String... systemProperties) throws IOException {
>>> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>>> > "WaitStrategy", "Sleep"));
>>> > return new Setup(MTPerfTest.class, runner, name, config, threadCount,
>>> > wait, systemProperties);
>>> > }
>>> >
>>> > - public static void main(String[] args) throws Exception {
>>> > + public static void main(final String[] args) throws Exception {
>>> > final String ALL_ASYNC = "-DLog4jContextSelector="
>>> > + AsyncLoggerContextSelector.class.getName();
>>> > final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
>>> > @@ -215,8 +215,8 @@ public class PerfTestDriver {
>>> > final String LOG20 = RunLog4j2.class.getName();
>>> > final String LOGBK = RunLogback.class.getName();
>>> >
>>> > - long start = System.nanoTime();
>>> > - List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
>>> > + final long start = System.nanoTime();
>>> > + final List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
>>> > // includeLocation=false
>>> > tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
>>> > ALL_ASYNC, SYSCLOCK));
>>> > @@ -285,29 +285,29 @@ public class PerfTestDriver {
>>> > // "RollFastFileAppender", i));
>>> > }
>>> >
>>> > - String java = args.length > 0 ? args[0] : "java";
>>> > - int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
>>> > + final String java = args.length > 0 ? args[0] : "java";
>>> > + final int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
>>> > int x = 0;
>>> > - for (Setup config : tests) {
>>> > + for (final Setup config : tests) {
>>> > System.out.print(config.description());
>>> > - ProcessBuilder pb = config.throughputTest(java);
>>> > + final ProcessBuilder pb = config.throughputTest(java);
>>> > pb.redirectErrorStream(true); // merge System.out and System.err
>>> > - long t1 = System.nanoTime();
>>> > + final long t1 = System.nanoTime();
>>> > // int count = config._threadCount >= 16 ? 2 : repeat;
>>> > runPerfTest(repeat, x++, config, pb);
>>> > System.out.printf(" took %.1f seconds%n", (System.nanoTime() - t1)
>>> > / (1000.0 * 1000.0 * 1000.0));
>>> >
>>> > - FileReader reader = new FileReader(config._temp);
>>> > - CharBuffer buffer = CharBuffer.allocate(256 * 1024);
>>> > + final FileReader reader = new FileReader(config._temp);
>>> > + final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
>>> > reader.read(buffer);
>>> > reader.close();
>>> > config._temp.delete();
>>> > buffer.flip();
>>> >
>>> > - String raw = buffer.toString();
>>> > + final String raw = buffer.toString();
>>> > System.out.print(raw);
>>> > - Stats stats = new Stats(raw);
>>> > + final Stats stats = new Stats(raw);
>>> > System.out.println(stats);
>>> > System.out.println("-----");
>>> > config._stats = stats;
>>> > @@ -321,19 +321,19 @@ public class PerfTestDriver {
>>> > printRanking(tests.toArray(new Setup[tests.size()]));
>>> > }
>>> >
>>> > - private static void printRanking(Setup[] tests) {
>>> > + private static void printRanking(final Setup[] tests) {
>>> > System.out.println();
>>> > System.out.println("Ranking:");
>>> > Arrays.sort(tests);
>>> > for (int i = 0; i < tests.length; i++) {
>>> > - Setup setup = tests[i];
>>> > + final Setup setup = tests[i];
>>> > System.out.println((i + 1) + ". " + setup.description() + ": "
>>> > + setup._stats);
>>> > }
>>> > }
>>> >
>>> > - private static void runPerfTest(int repeat, int setupIndex, Setup config,
>>> > - ProcessBuilder pb) throws IOException, InterruptedException {
>>> > + private static void runPerfTest(final int repeat, final int setupIndex, final Setup config,
>>> > + final ProcessBuilder pb) throws IOException, InterruptedException {
>>> > for (int i = 0; i < repeat; i++) {
>>> > System.out.print(" (" + (i + 1) + "/" + repeat + ")...");
>>> > final Process process = pb.start();
>>> > @@ -343,7 +343,7 @@ public class PerfTestDriver {
>>> > process.waitFor();
>>> > stop[0] = true;
>>> >
>>> > - File gc = new File("gc" + setupIndex + "_" + i
>>> > + final File gc = new File("gc" + setupIndex + "_" + i
>>> > + config._log4jConfig + ".log");
>>> > if (gc.exists()) {
>>> > gc.delete();
>>> > @@ -355,17 +355,17 @@ public class PerfTestDriver {
>>> > private static Thread printProcessOutput(final Process process,
>>> > final boolean[] stop) {
>>> >
>>> > - Thread t = new Thread("OutputWriter") {
>>> > + final Thread t = new Thread("OutputWriter") {
>>> > @Override
>>> > public void run() {
>>> > - BufferedReader in = new BufferedReader(new InputStreamReader(
>>> > + final BufferedReader in = new BufferedReader(new InputStreamReader(
>>> > process.getInputStream()));
>>> > try {
>>> > String line = null;
>>> > while (!stop[0] && (line = in.readLine()) != null) {
>>> > System.out.println(line);
>>> > }
>>> > - } catch (Exception ignored) {
>>> > + } catch (final Exception ignored) {
>>> > }
>>> > }
>>> > };
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java Tue Jul 9 06:08:25 2013
>>> > @@ -42,7 +42,7 @@ class PerfTestResultFormatter {
>>> > double latency99Pct;
>>> > double latency99_99Pct;
>>> >
>>> > - Stats(String throughput, String avg, String lat99, String lat99_99)
>>> > + Stats(final String throughput, final String avg, final String lat99, final String lat99_99)
>>> > throws ParseException {
>>> > this.throughput = NUM.parse(throughput.trim()).longValue();
>>> > this.avgLatency = Double.parseDouble(avg.trim());
>>> > @@ -51,40 +51,40 @@ class PerfTestResultFormatter {
>>> > }
>>> > }
>>> >
>>> > - private Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
>>> > + private final Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
>>> >
>>> > public PerfTestResultFormatter() {
>>> > }
>>> >
>>> > - public String format(String text) throws ParseException {
>>> > + public String format(final String text) throws ParseException {
>>> > results.clear();
>>> > - String[] lines = text.split("[\\r\\n]+");
>>> > - for (String line : lines) {
>>> > + final String[] lines = text.split("[\\r\\n]+");
>>> > + for (final String line : lines) {
>>> > process(line);
>>> > }
>>> > return latencyTable() + LF + throughputTable();
>>> > }
>>> >
>>> > private String latencyTable() {
>>> > - StringBuilder sb = new StringBuilder(4 * 1024);
>>> > - Set<String> subKeys = results.values().iterator().next().keySet();
>>> > - char[] tabs = new char[subKeys.size()];
>>> > + final StringBuilder sb = new StringBuilder(4 * 1024);
>>> > + final Set<String> subKeys = results.values().iterator().next().keySet();
>>> > + final char[] tabs = new char[subKeys.size()];
>>> > Arrays.fill(tabs, '\t');
>>> > - String sep = new String(tabs);
>>> > + final String sep = new String(tabs);
>>> > sb.append("\tAverage latency").append(sep).append("99% less than").append(sep).append("99.99% less than");
>>> > sb.append(LF);
>>> > for (int i = 0; i < 3; i++) {
>>> > - for (String subKey : subKeys) {
>>> > + for (final String subKey : subKeys) {
>>> > sb.append("\t").append(subKey);
>>> > }
>>> > }
>>> > sb.append(LF);
>>> > - for (String key : results.keySet()) {
>>> > + for (final String key : results.keySet()) {
>>> > sb.append(key);
>>> > for (int i = 0; i < 3; i++) {
>>> > - Map<String, Stats> sub = results.get(key);
>>> > - for (String subKey : sub.keySet()) {
>>> > - Stats stats = sub.get(subKey);
>>> > + final Map<String, Stats> sub = results.get(key);
>>> > + for (final String subKey : sub.keySet()) {
>>> > + final Stats stats = sub.get(subKey);
>>> > switch (i) {
>>> > case 0:
>>> > sb.append("\t").append((long) stats.avgLatency);
>>> > @@ -104,19 +104,19 @@ class PerfTestResultFormatter {
>>> > }
>>> >
>>> > private String throughputTable() {
>>> > - StringBuilder sb = new StringBuilder(4 * 1024);
>>> > - Set<String> subKeys = results.values().iterator().next().keySet();
>>> > + final StringBuilder sb = new StringBuilder(4 * 1024);
>>> > + final Set<String> subKeys = results.values().iterator().next().keySet();
>>> > sb.append("\tThroughput per thread (msg/sec)");
>>> > sb.append(LF);
>>> > - for (String subKey : subKeys) {
>>> > + for (final String subKey : subKeys) {
>>> > sb.append("\t").append(subKey);
>>> > }
>>> > sb.append(LF);
>>> > - for (String key : results.keySet()) {
>>> > + for (final String key : results.keySet()) {
>>> > sb.append(key);
>>> > - Map<String, Stats> sub = results.get(key);
>>> > - for (String subKey : sub.keySet()) {
>>> > - Stats stats = sub.get(subKey);
>>> > + final Map<String, Stats> sub = results.get(key);
>>> > + for (final String subKey : sub.keySet()) {
>>> > + final Stats stats = sub.get(subKey);
>>> > sb.append("\t").append(stats.throughput);
>>> > }
>>> > sb.append(LF);
>>> > @@ -124,19 +124,19 @@ class PerfTestResultFormatter {
>>> > return sb.toString();
>>> > }
>>> >
>>> > - private void process(String line) throws ParseException {
>>> > - String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
>>> > - String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
>>> > - String throughput = line.substring(line.indexOf("throughput: ")
>>> > + private void process(final String line) throws ParseException {
>>> > + final String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
>>> > + final String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
>>> > + final String throughput = line.substring(line.indexOf("throughput: ")
>>> > + "throughput: ".length(), line.indexOf(" ops"));
>>> > - String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
>>> > + final String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
>>> > line.indexOf(" 99%"));
>>> > - String pct99 = line.substring(
>>> > + final String pct99 = line.substring(
>>> > line.indexOf("99% < ") + "99% < ".length(),
>>> > line.indexOf(" 99.99%"));
>>> > - String pct99_99 = line.substring(line.indexOf("99.99% < ")
>>> > + final String pct99_99 = line.substring(line.indexOf("99.99% < ")
>>> > + "99.99% < ".length(), line.lastIndexOf('(') - 1);
>>> > - Stats stats = new Stats(throughput, avg, pct99, pct99_99);
>>> > + final Stats stats = new Stats(throughput, avg, pct99, pct99_99);
>>> > Map<String, Stats> map = results.get(key.trim());
>>> > if (map == null) {
>>> > map = new TreeMap<String, Stats>(sort());
>>> > @@ -156,9 +156,9 @@ class PerfTestResultFormatter {
>>> > "64 threads");
>>> >
>>> > @Override
>>> > - public int compare(String o1, String o2) {
>>> > - int i1 = expected.indexOf(o1);
>>> > - int i2 = expected.indexOf(o2);
>>> > + public int compare(final String o1, final String o2) {
>>> > + final int i1 = expected.indexOf(o1);
>>> > + final int i2 = expected.indexOf(o2);
>>> > if (i1 < 0 || i2 < 0) {
>>> > return o1.compareTo(o2);
>>> > }
>>> > @@ -167,9 +167,9 @@ class PerfTestResultFormatter {
>>> > };
>>> > }
>>> >
>>> > - public static void main(String[] args) throws Exception {
>>> > - PerfTestResultFormatter fmt = new PerfTestResultFormatter();
>>> > - BufferedReader reader = new BufferedReader(new InputStreamReader(
>>> > + public static void main(final String[] args) throws Exception {
>>> > + final PerfTestResultFormatter fmt = new PerfTestResultFormatter();
>>> > + final BufferedReader reader = new BufferedReader(new InputStreamReader(
>>> > System.in));
>>> > String line;
>>> > while ((line = reader.readLine()) != null) {
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java Tue Jul 9 06:08:25 2013
>>> > @@ -24,32 +24,32 @@ import com.lmax.disruptor.collections.Hi
>>> > public class RunLog4j1 implements IPerfTestRunner {
>>> >
>>> > @Override
>>> > - public void runThroughputTest(int lines, Histogram histogram) {
>>> > - long s1 = System.nanoTime();
>>> > - Logger logger = LogManager.getLogger(getClass());
>>> > + public void runThroughputTest(final int lines, final Histogram histogram) {
>>> > + final long s1 = System.nanoTime();
>>> > + final Logger logger = LogManager.getLogger(getClass());
>>> > for (int j = 0; j < lines; j++) {
>>> > logger.info(THROUGHPUT_MSG);
>>> > }
>>> > - long s2 = System.nanoTime();
>>> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>>> > + final long s2 = System.nanoTime();
>>> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>>> > histogram.addObservation(opsPerSec);
>>> > }
>>> >
>>> > @Override
>>> > - public void runLatencyTest(int samples, Histogram histogram,
>>> > - long nanoTimeCost, int threadCount) {
>>> > - Logger logger = LogManager.getLogger(getClass());
>>> > + public void runLatencyTest(final int samples, final Histogram histogram,
>>> > + final long nanoTimeCost, final int threadCount) {
>>> > + final Logger logger = LogManager.getLogger(getClass());
>>> > for (int i = 0; i < samples; i++) {
>>> > - long s1 = System.nanoTime();
>>> > + final long s1 = System.nanoTime();
>>> > logger.info(LATENCY_MSG);
>>> > - long s2 = System.nanoTime();
>>> > - long value = s2 - s1 - nanoTimeCost;
>>> > + final long s2 = System.nanoTime();
>>> > + final long value = s2 - s1 - nanoTimeCost;
>>> > if (value > 0) {
>>> > histogram.addObservation(value);
>>> > }
>>> > // wait 1 microsec
>>> > final long PAUSE_NANOS = 10000 * threadCount;
>>> > - long pauseStart = System.nanoTime();
>>> > + final long pauseStart = System.nanoTime();
>>> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
>>> > // busy spin
>>> > }
>>> > @@ -62,8 +62,8 @@ public class RunLog4j1 implements IPerfT
>>> > }
>>> >
>>> > @Override
>>> > - public void log(String finalMessage) {
>>> > - Logger logger = LogManager.getLogger(getClass());
>>> > + public void log(final String finalMessage) {
>>> > + final Logger logger = LogManager.getLogger(getClass());
>>> > logger.info(finalMessage);
>>> > }
>>> > }
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java Tue Jul 9 06:08:25 2013
>>> > @@ -25,33 +25,33 @@ import com.lmax.disruptor.collections.Hi
>>> > public class RunLog4j2 implements IPerfTestRunner {
>>> >
>>> > @Override
>>> > - public void runThroughputTest(int lines, Histogram histogram) {
>>> > - long s1 = System.nanoTime();
>>> > - Logger logger = LogManager.getLogger(getClass());
>>> > + public void runThroughputTest(final int lines, final Histogram histogram) {
>>> > + final long s1 = System.nanoTime();
>>> > + final Logger logger = LogManager.getLogger(getClass());
>>> > for (int j = 0; j < lines; j++) {
>>> > logger.info(THROUGHPUT_MSG);
>>> > }
>>> > - long s2 = System.nanoTime();
>>> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>>> > + final long s2 = System.nanoTime();
>>> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>>> > histogram.addObservation(opsPerSec);
>>> > }
>>> >
>>> >
>>> > @Override
>>> > - public void runLatencyTest(int samples, Histogram histogram,
>>> > - long nanoTimeCost, int threadCount) {
>>> > - Logger logger = LogManager.getLogger(getClass());
>>> > + public void runLatencyTest(final int samples, final Histogram histogram,
>>> > + final long nanoTimeCost, final int threadCount) {
>>> > + final Logger logger = LogManager.getLogger(getClass());
>>> > for (int i = 0; i < samples; i++) {
>>> > - long s1 = System.nanoTime();
>>> > + final long s1 = System.nanoTime();
>>> > logger.info(LATENCY_MSG);
>>> > - long s2 = System.nanoTime();
>>> > - long value = s2 - s1 - nanoTimeCost;
>>> > + final long s2 = System.nanoTime();
>>> > + final long value = s2 - s1 - nanoTimeCost;
>>> > if (value > 0) {
>>> > histogram.addObservation(value);
>>> > }
>>> > // wait 1 microsec
>>> > final long PAUSE_NANOS = 10000 * threadCount;
>>> > - long pauseStart = System.nanoTime();
>>> > + final long pauseStart = System.nanoTime();
>>> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
>>> > // busy spin
>>> > }
>>> > @@ -66,8 +66,8 @@ public class RunLog4j2 implements IPerfT
>>> >
>>> >
>>> > @Override
>>> > - public void log(String finalMessage) {
>>> > - Logger logger = LogManager.getLogger(getClass());
>>> > + public void log(final String finalMessage) {
>>> > + final Logger logger = LogManager.getLogger(getClass());
>>> > logger.info(finalMessage);
>>> > }
>>> > }
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java Tue Jul 9 06:08:25 2013
>>> > @@ -26,32 +26,32 @@ import com.lmax.disruptor.collections.Hi
>>> > public class RunLogback implements IPerfTestRunner {
>>> >
>>> > @Override
>>> > - public void runThroughputTest(int lines, Histogram histogram) {
>>> > - long s1 = System.nanoTime();
>>> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>>> > + public void runThroughputTest(final int lines, final Histogram histogram) {
>>> > + final long s1 = System.nanoTime();
>>> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>>> > for (int j = 0; j < lines; j++) {
>>> > logger.info(THROUGHPUT_MSG);
>>> > }
>>> > - long s2 = System.nanoTime();
>>> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>>> > + final long s2 = System.nanoTime();
>>> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>>> > histogram.addObservation(opsPerSec);
>>> > }
>>> >
>>> > @Override
>>> > - public void runLatencyTest(int samples, Histogram histogram,
>>> > - long nanoTimeCost, int threadCount) {
>>> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>>> > + public void runLatencyTest(final int samples, final Histogram histogram,
>>> > + final long nanoTimeCost, final int threadCount) {
>>> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>>> > for (int i = 0; i < samples; i++) {
>>> > - long s1 = System.nanoTime();
>>> > + final long s1 = System.nanoTime();
>>> > logger.info(LATENCY_MSG);
>>> > - long s2 = System.nanoTime();
>>> > - long value = s2 - s1 - nanoTimeCost;
>>> > + final long s2 = System.nanoTime();
>>> > + final long value = s2 - s1 - nanoTimeCost;
>>> > if (value > 0) {
>>> > histogram.addObservation(value);
>>> > }
>>> > // wait 1 microsec
>>> > final long PAUSE_NANOS = 10000 * threadCount;
>>> > - long pauseStart = System.nanoTime();
>>> > + final long pauseStart = System.nanoTime();
>>> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
>>> > // busy spin
>>> > }
>>> > @@ -64,8 +64,8 @@ public class RunLogback implements IPerf
>>> > }
>>> >
>>> > @Override
>>> > - public void log(String msg) {
>>> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>>> > + public void log(final String msg) {
>>> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>>> > logger.info(msg);
>>> > }
>>> > }
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -63,12 +63,12 @@ public class AdvertiserTest {
>>> > file.delete();
>>> > }
>>> >
>>> > - private void verifyExpectedEntriesAdvertised(Map<Object, Map<String, String>> entries) {
>>> > + private void verifyExpectedEntriesAdvertised(final Map<Object, Map<String, String>> entries) {
>>> > boolean foundFile1 = false;
>>> > boolean foundFile2 = false;
>>> > boolean foundSocket1 = false;
>>> > boolean foundSocket2 = false;
>>> > - for (Map<String, String>entry:entries.values()) {
>>> > + for (final Map<String, String>entry:entries.values()) {
>>> > if (foundFile1 && foundFile2 && foundSocket1 && foundSocket2) {
>>> > break;
>>> > }
>>> > @@ -103,7 +103,7 @@ public class AdvertiserTest {
>>> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
>>> > ctx.stop();
>>> >
>>> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
>>> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
>>> > assertTrue("Entries found: " + entries, entries.isEmpty());
>>> >
>>> > //reconfigure for subsequent testing
>>> > @@ -117,7 +117,7 @@ public class AdvertiserTest {
>>> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
>>> > ctx.stop();
>>> >
>>> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
>>> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
>>> > assertTrue("Entries found: " + entries, entries.isEmpty());
>>> >
>>> > ctx.start();
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -34,9 +34,9 @@ public class BaseConfigurationTest {
>>> > @Test
>>> > public void testMissingRootLogger() throws Exception {
>>> > PluginManager.addPackage("org.apache.logging.log4j.test.appender");
>>> > - LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
>>> > + final LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
>>> > final Logger logger = LogManager.getLogger("sample.Logger1");
>>> > - Configuration config = ctx.getConfiguration();
>>> > + final Configuration config = ctx.getConfiguration();
>>> > assertNotNull("Config not null", config);
>>> > // final String MISSINGROOT = "MissingRootTest";
>>> > // assertTrue("Incorrect Configuration. Expected " + MISSINGROOT + " but found " + config.getName(),
>>> > @@ -53,15 +53,15 @@ public class BaseConfigurationTest {
>>> > // only the sample logger, no root logger in loggerMap!
>>> > assertTrue("contains key=sample", loggerMap.containsKey("sample"));
>>> >
>>> > - LoggerConfig sample = loggerMap.get("sample");
>>> > - Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
>>> > + final LoggerConfig sample = loggerMap.get("sample");
>>> > + final Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
>>> > assertEquals("sampleAppenders Size", 1, sampleAppenders.size());
>>> > // sample only has List appender, not Console!
>>> > assertTrue("sample has appender List", sampleAppenders.containsKey("List"));
>>> >
>>> > - BaseConfiguration baseConfig = (BaseConfiguration) config;
>>> > - LoggerConfig root = baseConfig.getRootLogger();
>>> > - Map<String, Appender<?>> rootAppenders = root.getAppenders();
>>> > + final BaseConfiguration baseConfig = (BaseConfiguration) config;
>>> > + final LoggerConfig root = baseConfig.getRootLogger();
>>> > + final Map<String, Appender<?>> rootAppenders = root.getAppenders();
>>> > assertEquals("rootAppenders Size", 1, rootAppenders.size());
>>> > // root only has Console appender!
>>> > assertTrue("root has appender Console", rootAppenders.containsKey("Console"));
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java Tue Jul 9 06:08:25 2013
>>> > @@ -28,20 +28,20 @@ public class InMemoryAdvertiser implemen
>>> >
>>> > public static Map<Object, Map<String, String>> getAdvertisedEntries()
>>> > {
>>> > - Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
>>> > + final Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
>>> > result.putAll(properties);
>>> > return result;
>>> > }
>>> >
>>> > @Override
>>> > - public Object advertise(Map<String, String> newEntry) {
>>> > - Object object = new Object();
>>> > + public Object advertise(final Map<String, String> newEntry) {
>>> > + final Object object = new Object();
>>> > properties.put(object, new HashMap<String, String>(newEntry));
>>> > return object;
>>> > }
>>> >
>>> > @Override
>>> > - public void unadvertise(Object advertisedObject) {
>>> > + public void unadvertise(final Object advertisedObject) {
>>> > properties.remove(advertisedObject);
>>> > }
>>> > }
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java Tue Jul 9 06:08:25 2013
>>> > @@ -189,24 +189,24 @@ public class TestConfigurator {
>>> > public void testEnvironment() throws Exception {
>>> > final LoggerContext ctx = Configurator.initialize("-config", null, (String) null);
>>> > final Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
>>> > - Configuration config = ctx.getConfiguration();
>>> > + final Configuration config = ctx.getConfiguration();
>>> > assertNotNull("No configuration", config);
>>> > assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
>>> > CONFIG_NAME.equals(config.getName()));
>>> > final Map<String, Appender<?>> map = config.getAppenders();
>>> > assertNotNull("No Appenders", map != null && map.size() > 0);
>>> > Appender<?> app = null;
>>> > - for (Map.Entry<String, Appender<?>> entry: map.entrySet()) {
>>> > + for (final Map.Entry<String, Appender<?>> entry: map.entrySet()) {
>>> > if (entry.getKey().equals("List2")) {
>>> > app = entry.getValue();
>>> > break;
>>> > }
>>> > }
>>> > assertNotNull("No ListAppender named List2", app);
>>> > - Layout layout = app.getLayout();
>>> > + final Layout layout = app.getLayout();
>>> > assertNotNull("Appender List2 does not have a Layout", layout);
>>> > assertTrue("Appender List2 is not configured with a PatternLayout", layout instanceof PatternLayout);
>>> > - String pattern = ((PatternLayout) layout).getConversionPattern();
>>> > + final String pattern = ((PatternLayout) layout).getConversionPattern();
>>> > assertNotNull("No conversion pattern for List2 PatternLayout", pattern);
>>> > assertFalse("Environment variable was not substituted", pattern.startsWith("${env:PATH}"));
>>> > }
>>> >
>>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
>>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>>> > ==============================================================================
>>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java (original)
>>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java Tue Jul 9 06:08:25 2013
>>> > @@ -55,7 +55,7 @@ public class RegexFilterTest {
>>> >
>>> > @Test
>>> > public void TestNoMsg() {
>>> > - RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
>>> > + final RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
>>> > filter.start();
>>> > assertTrue(filter.isStarted());
>>> > assertTrue(filter.filter(null, Level.DEBUG, null, (String)null, (Throwable)null) == Filter.Result.DENY);
>>> >
>>> >
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>
>>>
>>>
>>>
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> JUnit in Action, Second Edition
>>> Spring Batch in Action
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>
>
Re: svn commit: r1501104 [4/5] - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/ api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j/s...
Posted by Ralph Goers <ra...@dslextreme.com>.
I fixed both compile errors. Unfortunately, I have been working on the fix for the FlumePersistentManager and IntelliJ lost it due to the conflicts with all the changes that were made. I'm not really sure why - the latest versions of IntelliJ 12 have been misbehaving for me.
Ralph
On Jul 9, 2013, at 1:25 PM, Nick Williams wrote:
> Ralph already committed a change a few minutes ago that removed the @Override from that method that can't have it.
>
> N
>
> On Jul 9, 2013, at 3:20 PM, Gary Gregory wrote:
>
>> Everything is compiling in Eclipse (Java 6) and Maven (Java 7) but I just read Nick's comment. I am running Maven on Java 6 as I write this...
>>
>> Gary
>>
>>
>> On Tue, Jul 9, 2013 at 4:10 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>> After fixing the prior compiler error I then ran into this one:
>>
>> [INFO] ------------------------------------------------------------------------
>> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project log4j-core: Compilation failure
>> [ERROR] /Users/rgoers/projects/apache/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java:[177,13] variable _averageOpsPerSec might already have been assigned
>>
>> Can you please compile and test before committing?
>>
>> Ralph
>>
>> On Jul 8, 2013, at 11:08 PM, ggregory@apache.org wrote:
>>
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>> > @@ -41,7 +41,7 @@ public class ContextStackAttributeConver
>> >
>> > @Test
>> > public void testConvertToDatabaseColumn01() {
>> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
>> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
>> > Arrays.asList("value1", "another2"));
>> >
>> > assertEquals("The converted value is not correct.", "value1\nanother2",
>> > @@ -50,7 +50,7 @@ public class ContextStackAttributeConver
>> >
>> > @Test
>> > public void testConvertToDatabaseColumn02() {
>> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
>> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
>> > Arrays.asList("key1", "value2", "my3"));
>> >
>> > assertEquals("The converted value is not correct.",
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>> > @@ -42,14 +42,14 @@ public class ContextStackJsonAttributeCo
>> > @Test
>> > public void testConvert01() {
>> > ThreadContext.clearStack();
>> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
>> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
>> > Arrays.asList("value1", "another2"));
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(stack);
>> > + final String converted = this.converter.convertToDatabaseColumn(stack);
>> >
>> > assertNotNull("The converted value should not be null.", converted);
>> >
>> > - ThreadContext.ContextStack reversed = this.converter
>> > + final ThreadContext.ContextStack reversed = this.converter
>> > .convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > @@ -60,14 +60,14 @@ public class ContextStackJsonAttributeCo
>> > @Test
>> > public void testConvert02() {
>> > ThreadContext.clearStack();
>> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
>> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
>> > Arrays.asList("key1", "value2", "my3"));
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(stack);
>> > + final String converted = this.converter.convertToDatabaseColumn(stack);
>> >
>> > assertNotNull("The converted value should not be null.", converted);
>> >
>> > - ThreadContext.ContextStack reversed = this.converter
>> > + final ThreadContext.ContextStack reversed = this.converter
>> > .convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>> > @@ -39,14 +39,14 @@ public class MarkerAttributeConverterTes
>> >
>> > @Test
>> > public void testConvert01() {
>> > - Marker marker = MarkerManager.getMarker("testConvert01");
>> > + final Marker marker = MarkerManager.getMarker("testConvert01");
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(marker);
>> > + final String converted = this.converter.convertToDatabaseColumn(marker);
>> >
>> > assertNotNull("The converted value should not be null.", converted);
>> > assertEquals("The converted value is not correct.", "testConvert01", converted);
>> >
>> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
>> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.", "testConvert01", marker.getName());
>> > @@ -54,19 +54,19 @@ public class MarkerAttributeConverterTes
>> >
>> > @Test
>> > public void testConvert02() {
>> > - Marker marker = MarkerManager.getMarker("testConvert02",
>> > + final Marker marker = MarkerManager.getMarker("testConvert02",
>> > MarkerManager.getMarker("anotherConvert02",
>> > MarkerManager.getMarker("finalConvert03")
>> > )
>> > );
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(marker);
>> > + final String converted = this.converter.convertToDatabaseColumn(marker);
>> >
>> > assertNotNull("The converted value should not be null.", converted);
>> > assertEquals("The converted value is not correct.", "testConvert02[ anotherConvert02[ finalConvert03 ] ] ]",
>> > converted);
>> >
>> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
>> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.", "testConvert02", marker.getName());
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>> > @@ -41,14 +41,14 @@ public class MessageAttributeConverterTe
>> >
>> > @Test
>> > public void testConvert01() {
>> > - Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
>> > + final Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(message);
>> > + final String converted = this.converter.convertToDatabaseColumn(message);
>> >
>> > assertNotNull("The converted value should not be null.", converted);
>> > assertEquals("The converted value is not correct.", "Message #3 said [Hello].", converted);
>> >
>> > - Message reversed = this.converter.convertToEntityAttribute(converted);
>> > + final Message reversed = this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.", "Message #3 said [Hello].", reversed.getFormattedMessage());
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>> > @@ -37,15 +37,15 @@ public class StackTraceElementAttributeC
>> >
>> > @Test
>> > public void testConvert01() {
>> > - StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
>> > + final StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(element);
>> > + final String converted = this.converter.convertToDatabaseColumn(element);
>> >
>> > assertNotNull("The converted value should not be null.", converted);
>> > assertEquals("The converted value is not correct.", "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
>> > converted);
>> >
>> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The class name is not correct.", "TestNoPackage", reversed.getClassName());
>> > @@ -57,17 +57,17 @@ public class StackTraceElementAttributeC
>> >
>> > @Test
>> > public void testConvert02() {
>> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
>> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
>> > "testConvert02", "TestWithPackage.java", -1);
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(element);
>> > + final String converted = this.converter.convertToDatabaseColumn(element);
>> >
>> > assertNotNull("The converted value should not be null.", converted);
>> > assertEquals("The converted value is not correct.",
>> > "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
>> > converted);
>> >
>> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The class name is not correct.", "org.apache.logging.TestWithPackage", reversed.getClassName());
>> > @@ -79,17 +79,17 @@ public class StackTraceElementAttributeC
>> >
>> > @Test
>> > public void testConvert03() {
>> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
>> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
>> > "testConvert03", null, -1);
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(element);
>> > + final String converted = this.converter.convertToDatabaseColumn(element);
>> >
>> > assertNotNull("The converted value should not be null.", converted);
>> > assertEquals("The converted value is not correct.",
>> > "org.apache.logging.TestNoSource.testConvert03(Unknown Source)",
>> > converted);
>> >
>> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The class name is not correct.", "org.apache.logging.TestNoSource", reversed.getClassName());
>> > @@ -101,17 +101,17 @@ public class StackTraceElementAttributeC
>> >
>> > @Test
>> > public void testConvert04() {
>> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
>> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
>> > "testConvert04", null, -2);
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(element);
>> > + final String converted = this.converter.convertToDatabaseColumn(element);
>> >
>> > assertNotNull("The converted value should not be null.", converted);
>> > assertEquals("The converted value is not correct.",
>> > "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
>> > converted);
>> >
>> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The class name is not correct.", "org.apache.logging.TestIsNativeMethod",
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java Tue Jul 9 06:08:25 2013
>> > @@ -39,16 +39,16 @@ public class ThrowableAttributeConverter
>> >
>> > @Test
>> > public void testConvert01() {
>> > - RuntimeException exception = new RuntimeException("My message 01.");
>> > + final RuntimeException exception = new RuntimeException("My message 01.");
>> >
>> > - String stackTrace = getStackTrace(exception);
>> > + final String stackTrace = getStackTrace(exception);
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(exception);
>> > + final String converted = this.converter.convertToDatabaseColumn(exception);
>> >
>> > assertNotNull("The converted value is not correct.", converted);
>> > assertEquals("The converted value is not correct.", stackTrace, converted);
>> >
>> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
>> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
>> > @@ -56,18 +56,18 @@ public class ThrowableAttributeConverter
>> >
>> > @Test
>> > public void testConvert02() {
>> > - SQLException cause2 = new SQLException("This is a test cause.");
>> > - Error cause1 = new Error(cause2);
>> > - RuntimeException exception = new RuntimeException("My message 01.", cause1);
>> > + final SQLException cause2 = new SQLException("This is a test cause.");
>> > + final Error cause1 = new Error(cause2);
>> > + final RuntimeException exception = new RuntimeException("My message 01.", cause1);
>> >
>> > - String stackTrace = getStackTrace(exception);
>> > + final String stackTrace = getStackTrace(exception);
>> >
>> > - String converted = this.converter.convertToDatabaseColumn(exception);
>> > + final String converted = this.converter.convertToDatabaseColumn(exception);
>> >
>> > assertNotNull("The converted value is not correct.", converted);
>> > assertEquals("The converted value is not correct.", stackTrace, converted);
>> >
>> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
>> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
>> > @@ -84,10 +84,10 @@ public class ThrowableAttributeConverter
>> > assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
>> > }
>> >
>> > - private static String getStackTrace(Throwable throwable) {
>> > + private static String getStackTrace(final Throwable throwable) {
>> > String returnValue = throwable.toString() + "\n";
>> >
>> > - for (StackTraceElement element : throwable.getStackTrace()) {
>> > + for (final StackTraceElement element : throwable.getStackTrace()) {
>> > returnValue += "\tat " + element.toString() + "\n";
>> > }
>> >
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java Tue Jul 9 06:08:25 2013
>> > @@ -51,7 +51,7 @@ public class MapRewritePolicyTest {
>> > logEvent1 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ERROR,
>> > new MapMessage(map), null, map, null, "none",
>> > new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 29), 2);
>> > - ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
>> > + final ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
>> > logEvent2 = new Log4jLogEvent("test", MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
>> > Level.TRACE, new StructuredDataMessage("test", "Nothing", "test", map), new RuntimeException("test"), null,
>> > stack, "none", new StackTraceElement("MapRewritePolicyTest",
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java Tue Jul 9 06:08:25 2013
>> > @@ -112,7 +112,7 @@ public class RewriteAppenderTest {
>> > StructuredDataMessage msg = new StructuredDataMessage("Test", "This is a test", "Service");
>> > msg.put("Key1", "Value2");
>> > msg.put("Key2", "Value1");
>> > - Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
>> > + final Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
>> > logger.debug(msg);
>> > msg = new StructuredDataMessage("Test", "This is a test", "Service");
>> > msg.put("Key1", "Value1");
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java Tue Jul 9 06:08:25 2013
>> > @@ -40,23 +40,23 @@ public class FastRollingFileManagerTest
>> > */
>> > @Test
>> > public void testWrite_multiplesOfBufferSize() throws IOException {
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
>> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
>> > - boolean append = false;
>> > - boolean flushNow = false;
>> > - long triggerSize = Long.MAX_VALUE;
>> > - long time = System.currentTimeMillis();
>> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
>> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
>> > + final boolean append = false;
>> > + final boolean flushNow = false;
>> > + final long triggerSize = Long.MAX_VALUE;
>> > + final long time = System.currentTimeMillis();
>> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>> > triggerSize);
>> > - RolloverStrategy rolloverStrategy = null;
>> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
>> > + final RolloverStrategy rolloverStrategy = null;
>> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
>> > file.getName(), "", os, append, flushNow, triggerSize, time,
>> > triggerPolicy, rolloverStrategy, null, null);
>> >
>> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
>> > - byte[] data = new byte[size];
>> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
>> > + final byte[] data = new byte[size];
>> > manager.write(data, 0, data.length); // no buffer overflow exception
>> >
>> > // buffer is full but not flushed yet
>> > @@ -71,23 +71,23 @@ public class FastRollingFileManagerTest
>> > */
>> > @Test
>> > public void testWrite_dataExceedingBufferSize() throws IOException {
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
>> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
>> > - boolean append = false;
>> > - boolean flushNow = false;
>> > - long triggerSize = 0;
>> > - long time = System.currentTimeMillis();
>> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
>> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
>> > + final boolean append = false;
>> > + final boolean flushNow = false;
>> > + final long triggerSize = 0;
>> > + final long time = System.currentTimeMillis();
>> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>> > triggerSize);
>> > - RolloverStrategy rolloverStrategy = null;
>> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
>> > + final RolloverStrategy rolloverStrategy = null;
>> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
>> > file.getName(), "", os, append, flushNow, triggerSize, time,
>> > triggerPolicy, rolloverStrategy, null, null);
>> >
>> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
>> > - byte[] data = new byte[size];
>> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
>> > + final byte[] data = new byte[size];
>> > manager.write(data, 0, data.length); // no exception
>> > assertEquals(FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3,
>> > raf.length());
>> > @@ -98,12 +98,12 @@ public class FastRollingFileManagerTest
>> >
>> > @Test
>> > public void testAppendDoesNotOverwriteExistingFile() throws IOException {
>> > - boolean isAppend = true;
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final boolean isAppend = true;
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > assertEquals(0, file.length());
>> >
>> > - byte[] bytes = new byte[4 * 1024];
>> > + final byte[] bytes = new byte[4 * 1024];
>> >
>> > // create existing file
>> > FileOutputStream fos = null;
>> > @@ -116,31 +116,31 @@ public class FastRollingFileManagerTest
>> > }
>> > assertEquals("all flushed to disk", bytes.length, file.length());
>> >
>> > - FastRollingFileManager manager = FastRollingFileManager
>> > + final FastRollingFileManager manager = FastRollingFileManager
>> > .getFastRollingFileManager(
>> > //
>> > file.getAbsolutePath(), "", isAppend, true,
>> > new SizeBasedTriggeringPolicy(Long.MAX_VALUE), //
>> > null, null, null);
>> > manager.write(bytes, 0, bytes.length);
>> > - int expected = bytes.length * 2;
>> > + final int expected = bytes.length * 2;
>> > assertEquals("appended, not overwritten", expected, file.length());
>> > }
>> >
>> > @Test
>> > public void testFileTimeBasedOnSystemClockWhenAppendIsFalse()
>> > throws IOException {
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > LockSupport.parkNanos(1000000); // 1 millisec
>> >
>> > // append is false deletes the file if it exists
>> > - boolean isAppend = false;
>> > - long expectedMin = System.currentTimeMillis();
>> > - long expectedMax = expectedMin + 50;
>> > + final boolean isAppend = false;
>> > + final long expectedMin = System.currentTimeMillis();
>> > + final long expectedMax = expectedMin + 50;
>> > assertTrue(file.lastModified() < expectedMin);
>> >
>> > - FastRollingFileManager manager = FastRollingFileManager
>> > + final FastRollingFileManager manager = FastRollingFileManager
>> > .getFastRollingFileManager(
>> > //
>> > file.getAbsolutePath(), "", isAppend, true,
>> > @@ -153,14 +153,14 @@ public class FastRollingFileManagerTest
>> > @Test
>> > public void testFileTimeBasedOnFileModifiedTimeWhenAppendIsTrue()
>> > throws IOException {
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > LockSupport.parkNanos(1000000); // 1 millisec
>> >
>> > - boolean isAppend = true;
>> > + final boolean isAppend = true;
>> > assertTrue(file.lastModified() < System.currentTimeMillis());
>> >
>> > - FastRollingFileManager manager = FastRollingFileManager
>> > + final FastRollingFileManager manager = FastRollingFileManager
>> > .getFastRollingFileManager(
>> > //
>> > file.getAbsolutePath(), "", isAppend, true,
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java Tue Jul 9 06:08:25 2013
>> > @@ -35,7 +35,7 @@ public class FileRenameActionTest {
>> >
>> > @BeforeClass
>> > public static void beforeClass() throws Exception {
>> > - File file = new File(DIR);
>> > + final File file = new File(DIR);
>> > file.mkdirs();
>> > }
>> >
>> > @@ -51,15 +51,15 @@ public class FileRenameActionTest {
>> >
>> > @Test
>> > public void testRename1() throws Exception {
>> > - File file = new File("target/fileRename/fileRename.log");
>> > - PrintStream pos = new PrintStream(file);
>> > + final File file = new File("target/fileRename/fileRename.log");
>> > + final PrintStream pos = new PrintStream(file);
>> > for (int i = 0; i < 100; ++i) {
>> > pos.println("This is line " + i);
>> > }
>> > pos.close();
>> >
>> > - File dest = new File("target/fileRename/newFile.log");
>> > - FileRenameAction action = new FileRenameAction(file, dest, false);
>> > + final File dest = new File("target/fileRename/newFile.log");
>> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
>> > action.execute();
>> > assertTrue("Renamed file does not exist", dest.exists());
>> > assertTrue("Old file exists", !file.exists());
>> > @@ -67,12 +67,12 @@ public class FileRenameActionTest {
>> >
>> > @Test
>> > public void testEmpty() throws Exception {
>> > - File file = new File("target/fileRename/fileRename.log");
>> > - PrintStream pos = new PrintStream(file);
>> > + final File file = new File("target/fileRename/fileRename.log");
>> > + final PrintStream pos = new PrintStream(file);
>> > pos.close();
>> >
>> > - File dest = new File("target/fileRename/newFile.log");
>> > - FileRenameAction action = new FileRenameAction(file, dest, false);
>> > + final File dest = new File("target/fileRename/newFile.log");
>> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
>> > action.execute();
>> > assertTrue("Renamed file does not exist", !dest.exists());
>> > assertTrue("Old file does not exist", !file.exists());
>> > @@ -81,16 +81,16 @@ public class FileRenameActionTest {
>> >
>> > @Test
>> > public void testNoParent() throws Exception {
>> > - File file = new File("fileRename.log");
>> > - PrintStream pos = new PrintStream(file);
>> > + final File file = new File("fileRename.log");
>> > + final PrintStream pos = new PrintStream(file);
>> > for (int i = 0; i < 100; ++i) {
>> > pos.println("This is line " + i);
>> > }
>> > pos.close();
>> >
>> > - File dest = new File("newFile.log");
>> > + final File dest = new File("newFile.log");
>> > try {
>> > - FileRenameAction action = new FileRenameAction(file, dest, false);
>> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
>> > action.execute();
>> > assertTrue("Renamed file does not exist", dest.exists());
>> > assertTrue("Old file exists", !file.exists());
>> > @@ -98,7 +98,7 @@ public class FileRenameActionTest {
>> > try {
>> > dest.delete();
>> > file.delete();
>> > - } catch (Exception ex) {
>> > + } catch (final Exception ex) {
>> > System.out.println("Unable to cleanup files written to main directory");
>> > }
>> > }
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java Tue Jul 9 06:08:25 2013
>> > @@ -39,17 +39,17 @@ public class AsyncLoggerConfigTest {
>> >
>> > @Test
>> > public void testAdditivity() throws Exception {
>> > - File f = new File("target", "AsyncLoggerConfigTest.log");
>> > + final File f = new File("target", "AsyncLoggerConfigTest.log");
>> > // System.out.println(f.getAbsolutePath());
>> > f.delete();
>> > - Logger log = LogManager.getLogger("com.foo.Bar");
>> > - String msg = "Additive logging: 2 for the price of 1!";
>> > + final Logger log = LogManager.getLogger("com.foo.Bar");
>> > + final String msg = "Additive logging: 2 for the price of 1!";
>> > log.info(msg);
>> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>> >
>> > - BufferedReader reader = new BufferedReader(new FileReader(f));
>> > - String line1 = reader.readLine();
>> > - String line2 = reader.readLine();
>> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
>> > + final String line1 = reader.readLine();
>> > + final String line2 = reader.readLine();
>> > reader.close();
>> > f.delete();
>> > assertNotNull("line1", line1);
>> > @@ -57,7 +57,7 @@ public class AsyncLoggerConfigTest {
>> > assertTrue("line1 correct", line1.contains(msg));
>> > assertTrue("line2 correct", line2.contains(msg));
>> >
>> > - String location = "testAdditivity";
>> > + final String location = "testAdditivity";
>> > assertTrue("location",
>> > line1.contains(location) || line2.contains(location));
>> > }
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java Tue Jul 9 06:08:25 2013
>> > @@ -29,24 +29,24 @@ public class AsyncLoggerContextSelectorT
>> >
>> > @Test
>> > public void testContextReturnsAsyncLoggerContext() {
>> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>> > - LoggerContext context = selector.getContext(null, null, false);
>> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>> > + final LoggerContext context = selector.getContext(null, null, false);
>> >
>> > assertTrue(context instanceof AsyncLoggerContext);
>> > }
>> >
>> > @Test
>> > public void testContext2ReturnsAsyncLoggerContext() {
>> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>> > - LoggerContext context = selector.getContext(null, null, false, null);
>> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>> > + final LoggerContext context = selector.getContext(null, null, false, null);
>> >
>> > assertTrue(context instanceof AsyncLoggerContext);
>> > }
>> >
>> > @Test
>> > public void testLoggerContextsReturnsAsyncLoggerContext() {
>> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>> > - List<LoggerContext> list = selector.getLoggerContexts();
>> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>> > + final List<LoggerContext> list = selector.getLoggerContexts();
>> >
>> > assertEquals(1, list.size());
>> > assertTrue(list.get(0) instanceof AsyncLoggerContext);
>> > @@ -54,8 +54,8 @@ public class AsyncLoggerContextSelectorT
>> >
>> > @Test
>> > public void testContextNameIsAsyncLoggerContext() {
>> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>> > - LoggerContext context = selector.getContext(null, null, false);
>> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
>> > + final LoggerContext context = selector.getContext(null, null, false);
>> >
>> > assertEquals("AsyncLoggerContext", context.getName());
>> > }
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java Tue Jul 9 06:08:25 2013
>> > @@ -30,7 +30,7 @@ public class AsyncLoggerContextTest {
>> >
>> > @Test
>> > public void testNewInstanceReturnsAsyncLogger() {
>> > - Logger logger = new AsyncLoggerContext("a").newInstance(
>> > + final Logger logger = new AsyncLoggerContext("a").newInstance(
>> > new LoggerContext("a"), "a", null);
>> > assertTrue(logger instanceof AsyncLogger);
>> >
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java Tue Jul 9 06:08:25 2013
>> > @@ -49,22 +49,22 @@ public class AsyncLoggerLocationTest {
>> >
>> > @Test
>> > public void testAsyncLogWritesToLog() throws Exception {
>> > - File f = new File("target", "AsyncLoggerLocationTest.log");
>> > + final File f = new File("target", "AsyncLoggerLocationTest.log");
>> > // System.out.println(f.getAbsolutePath());
>> > f.delete();
>> > - Logger log = LogManager.getLogger("com.foo.Bar");
>> > - String msg = "Async logger msg with location";
>> > + final Logger log = LogManager.getLogger("com.foo.Bar");
>> > + final String msg = "Async logger msg with location";
>> > log.info(msg);
>> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>> >
>> > - BufferedReader reader = new BufferedReader(new FileReader(f));
>> > - String line1 = reader.readLine();
>> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
>> > + final String line1 = reader.readLine();
>> > reader.close();
>> > f.delete();
>> > assertNotNull("line1", line1);
>> > assertTrue("line1 correct", line1.contains(msg));
>> >
>> > - String location = "testAsyncLogWritesToLog";
>> > + final String location = "testAsyncLogWritesToLog";
>> > assertTrue("has location", line1.contains(location));
>> > }
>> >
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java Tue Jul 9 06:08:25 2013
>> > @@ -49,22 +49,22 @@ public class AsyncLoggerTest {
>> >
>> > @Test
>> > public void testAsyncLogWritesToLog() throws Exception {
>> > - File f = new File("target", "AsyncLoggerTest.log");
>> > + final File f = new File("target", "AsyncLoggerTest.log");
>> > // System.out.println(f.getAbsolutePath());
>> > f.delete();
>> > - Logger log = LogManager.getLogger("com.foo.Bar");
>> > - String msg = "Async logger msg";
>> > + final Logger log = LogManager.getLogger("com.foo.Bar");
>> > + final String msg = "Async logger msg";
>> > log.info(msg);
>> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>> >
>> > - BufferedReader reader = new BufferedReader(new FileReader(f));
>> > - String line1 = reader.readLine();
>> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
>> > + final String line1 = reader.readLine();
>> > reader.close();
>> > f.delete();
>> > assertNotNull("line1", line1);
>> > assertTrue("line1 correct", line1.contains(msg));
>> >
>> > - String location = "testAsyncLogWritesToLog";
>> > + final String location = "testAsyncLogWritesToLog";
>> > assertTrue("no location", !line1.contains(location));
>> > }
>> >
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java Tue Jul 9 06:08:25 2013
>> > @@ -22,23 +22,23 @@ import com.lmax.disruptor.collections.Hi
>> >
>> > public class MTPerfTest extends PerfTest {
>> >
>> > - public static void main(String[] args) throws Exception {
>> > + public static void main(final String[] args) throws Exception {
>> > new MTPerfTest().doMain(args);
>> > }
>> >
>> > @Override
>> > public void runTestAndPrintResult(final IPerfTestRunner runner,
>> > - final String name, final int threadCount, String resultFile)
>> > + final String name, final int threadCount, final String resultFile)
>> > throws Exception {
>> >
>> > // ThreadContext.put("aKey", "mdcVal");
>> > PerfTest.println("Warming up the JVM...");
>> > - long t1 = System.nanoTime();
>> > + final long t1 = System.nanoTime();
>> >
>> > // warmup at least 2 rounds and at most 1 minute
>> > final Histogram warmupHist = PerfTest.createHistogram();
>> > final long stop = System.currentTimeMillis() + (60 * 1000);
>> > - Runnable run1 = new Runnable() {
>> > + final Runnable run1 = new Runnable() {
>> > @Override
>> > public void run() {
>> > for (int i = 0; i < 10; i++) {
>> > @@ -50,8 +50,8 @@ public class MTPerfTest extends PerfTest
>> > }
>> > }
>> > };
>> > - Thread thread1 = new Thread(run1);
>> > - Thread thread2 = new Thread(run1);
>> > + final Thread thread1 = new Thread(run1);
>> > + final Thread thread2 = new Thread(run1);
>> > thread1.start();
>> > thread2.start();
>> > thread1.join();
>> > @@ -74,7 +74,7 @@ public class MTPerfTest extends PerfTest
>> > }
>> >
>> > private void multiThreadedTestRun(final IPerfTestRunner runner,
>> > - final String name, final int threadCount, String resultFile)
>> > + final String name, final int threadCount, final String resultFile)
>> > throws Exception {
>> >
>> > final Histogram[] histograms = new Histogram[threadCount];
>> > @@ -83,28 +83,28 @@ public class MTPerfTest extends PerfTest
>> > }
>> > final int LINES = 256 * 1024;
>> >
>> > - Thread[] threads = new Thread[threadCount];
>> > + final Thread[] threads = new Thread[threadCount];
>> > for (int i = 0; i < threads.length; i++) {
>> > final Histogram histogram = histograms[i];
>> > threads[i] = new Thread() {
>> > @Override
>> > public void run() {
>> > // int latencyCount = threadCount >= 16 ? 1000000 : 5000000;
>> > - int latencyCount = 5000000;
>> > - int count = PerfTest.throughput ? LINES / threadCount
>> > + final int latencyCount = 5000000;
>> > + final int count = PerfTest.throughput ? LINES / threadCount
>> > : latencyCount;
>> > runTest(runner, count, "end", histogram, threadCount);
>> > }
>> > };
>> > }
>> > - for (Thread thread : threads) {
>> > + for (final Thread thread : threads) {
>> > thread.start();
>> > }
>> > - for (Thread thread : threads) {
>> > + for (final Thread thread : threads) {
>> > thread.join();
>> > }
>> >
>> > - for (Histogram histogram : histograms) {
>> > + for (final Histogram histogram : histograms) {
>> > PerfTest.reportResult(resultFile, name, histogram);
>> > }
>> > }
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java Tue Jul 9 06:08:25 2013
>> > @@ -33,7 +33,7 @@ public class PerfTest {
>> > // determine how long it takes to call System.nanoTime() (on average)
>> > static long calcNanoTimeCost() {
>> > final long iterations = 10000000;
>> > - long start = System.nanoTime();
>> > + final long start = System.nanoTime();
>> > long finish = start;
>> >
>> > for (int i = 0; i < iterations; i++) {
>> > @@ -49,7 +49,7 @@ public class PerfTest {
>> > }
>> >
>> > static Histogram createHistogram() {
>> > - long[] intervals = new long[31];
>> > + final long[] intervals = new long[31];
>> > long intervalUpperBound = 1L;
>> > for (int i = 0, size = intervals.length - 1; i < size; i++) {
>> > intervalUpperBound *= 2;
>> > @@ -60,17 +60,17 @@ public class PerfTest {
>> > return new Histogram(intervals);
>> > }
>> >
>> > - public static void main(String[] args) throws Exception {
>> > + public static void main(final String[] args) throws Exception {
>> > new PerfTest().doMain(args);
>> > }
>> >
>> > - public void doMain(String[] args) throws Exception {
>> > - String runnerClass = args[0];
>> > - IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
>> > + public void doMain(final String[] args) throws Exception {
>> > + final String runnerClass = args[0];
>> > + final IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
>> > .newInstance();
>> > - String name = args[1];
>> > - String resultFile = args.length > 2 ? args[2] : null;
>> > - for (String arg : args) {
>> > + final String name = args[1];
>> > + final String resultFile = args.length > 2 ? args[2] : null;
>> > + for (final String arg : args) {
>> > if (verbose && throughput) {
>> > break;
>> > }
>> > @@ -81,7 +81,7 @@ public class PerfTest {
>> > throughput = true;
>> > }
>> > }
>> > - int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
>> > + final int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
>> > printf("Starting %s %s (%d)...%n", getClass().getSimpleName(), name,
>> > threadCount);
>> > runTestAndPrintResult(runner, name, threadCount, resultFile);
>> > @@ -89,14 +89,14 @@ public class PerfTest {
>> > System.exit(0);
>> > }
>> >
>> > - public void runTestAndPrintResult(IPerfTestRunner runner,
>> > - final String name, int threadCount, String resultFile)
>> > + public void runTestAndPrintResult(final IPerfTestRunner runner,
>> > + final String name, final int threadCount, final String resultFile)
>> > throws Exception {
>> > - Histogram warmupHist = createHistogram();
>> > + final Histogram warmupHist = createHistogram();
>> >
>> > // ThreadContext.put("aKey", "mdcVal");
>> > println("Warming up the JVM...");
>> > - long t1 = System.nanoTime();
>> > + final long t1 = System.nanoTime();
>> >
>> > // warmup at least 2 rounds and at most 1 minute
>> > final long stop = System.currentTimeMillis() + (60 * 1000);
>> > @@ -124,46 +124,46 @@ public class PerfTest {
>> > runSingleThreadedTest(runner, name, resultFile);
>> > }
>> >
>> > - private int runSingleThreadedTest(IPerfTestRunner runner, String name,
>> > - String resultFile) throws IOException {
>> > - Histogram latency = createHistogram();
>> > + private int runSingleThreadedTest(final IPerfTestRunner runner, final String name,
>> > + final String resultFile) throws IOException {
>> > + final Histogram latency = createHistogram();
>> > final int LINES = throughput ? 50000 : 5000000;
>> > runTest(runner, LINES, "end", latency, 1);
>> > reportResult(resultFile, name, latency);
>> > return LINES;
>> > }
>> >
>> > - static void reportResult(String file, String name, Histogram histogram)
>> > + static void reportResult(final String file, final String name, final Histogram histogram)
>> > throws IOException {
>> > - String result = createSamplingReport(name, histogram);
>> > + final String result = createSamplingReport(name, histogram);
>> > println(result);
>> >
>> > if (file != null) {
>> > - FileWriter writer = new FileWriter(file, true);
>> > + final FileWriter writer = new FileWriter(file, true);
>> > writer.write(result);
>> > writer.write(System.getProperty("line.separator"));
>> > writer.close();
>> > }
>> > }
>> >
>> > - static void printf(String msg, Object... objects) {
>> > + static void printf(final String msg, final Object... objects) {
>> > if (verbose) {
>> > System.out.printf(msg, objects);
>> > }
>> > }
>> >
>> > - static void println(String msg) {
>> > + static void println(final String msg) {
>> > if (verbose) {
>> > System.out.println(msg);
>> > }
>> > }
>> >
>> > - static String createSamplingReport(String name, Histogram histogram) {
>> > - Histogram data = histogram;
>> > + static String createSamplingReport(final String name, final Histogram histogram) {
>> > + final Histogram data = histogram;
>> > if (throughput) {
>> > return data.getMax() + " operations/second";
>> > }
>> > - String result = String.format(
>> > + final String result = String.format(
>> > "avg=%.0f 99%%=%d 99.99%%=%d sampleCount=%d", data.getMean(), //
>> > data.getTwoNinesUpperBound(), //
>> > data.getFourNinesUpperBound(), //
>> > @@ -172,12 +172,12 @@ public class PerfTest {
>> > return result;
>> > }
>> >
>> > - public void runTest(IPerfTestRunner runner, int lines, String finalMessage,
>> > - Histogram histogram, int threadCount) {
>> > + public void runTest(final IPerfTestRunner runner, final int lines, final String finalMessage,
>> > + final Histogram histogram, final int threadCount) {
>> > if (throughput) {
>> > runner.runThroughputTest(lines, histogram);
>> > } else {
>> > - long nanoTimeCost = calcNanoTimeCost();
>> > + final long nanoTimeCost = calcNanoTimeCost();
>> > runner.runLatencyTest(lines, histogram, nanoTimeCost, threadCount);
>> > }
>> > if (finalMessage != null) {
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java Tue Jul 9 06:08:25 2013
>> > @@ -41,19 +41,19 @@ public class PerfTestDriver {
>> > * Defines the setup for a java process running a performance test.
>> > */
>> > static class Setup implements Comparable<Setup> {
>> > - private Class<?> _class;
>> > - private String _log4jConfig;
>> > - private String _name;
>> > - private String[] _systemProperties;
>> > - private int _threadCount;
>> > - private File _temp;
>> > + private final Class<?> _class;
>> > + private final String _log4jConfig;
>> > + private final String _name;
>> > + private final String[] _systemProperties;
>> > + private final int _threadCount;
>> > + private final File _temp;
>> > public Stats _stats;
>> > - private WaitStrategy _wait;
>> > - private String _runner;
>> > + private final WaitStrategy _wait;
>> > + private final String _runner;
>> >
>> > - public Setup(Class<?> klass, String runner, String name,
>> > - String log4jConfig, int threadCount, WaitStrategy wait,
>> > - String... systemProperties) throws IOException {
>> > + public Setup(final Class<?> klass, final String runner, final String name,
>> > + final String log4jConfig, final int threadCount, final WaitStrategy wait,
>> > + final String... systemProperties) throws IOException {
>> > _class = klass;
>> > _runner = runner;
>> > _name = name;
>> > @@ -64,8 +64,8 @@ public class PerfTestDriver {
>> > _temp = File.createTempFile("log4jperformance", ".txt");
>> > }
>> >
>> > - List<String> processArguments(String java) {
>> > - List<String> args = new ArrayList<String>();
>> > + List<String> processArguments(final String java) {
>> > + final List<String> args = new ArrayList<String>();
>> > args.add(java);
>> > args.add("-server");
>> > args.add("-Xms1g");
>> > @@ -84,7 +84,7 @@ public class PerfTestDriver {
>> > args.add("-Dlog4j.configurationFile=" + _log4jConfig); // log4j 2
>> > args.add("-Dlogback.configurationFile=" + _log4jConfig);// logback
>> >
>> > - int ringBufferSize = getUserSpecifiedRingBufferSize();
>> > + final int ringBufferSize = getUserSpecifiedRingBufferSize();
>> > if (ringBufferSize >= 128) {
>> > args.add("-DAsyncLoggerConfig.RingBufferSize=" + ringBufferSize);
>> > args.add("-DAsyncLogger.RingBufferSize=" + ringBufferSize);
>> > @@ -108,23 +108,23 @@ public class PerfTestDriver {
>> > try {
>> > return Integer.parseInt(System.getProperty("RingBufferSize",
>> > "-1"));
>> > - } catch (Exception ignored) {
>> > + } catch (final Exception ignored) {
>> > return -1;
>> > }
>> > }
>> >
>> > - ProcessBuilder latencyTest(String java) {
>> > + ProcessBuilder latencyTest(final String java) {
>> > return new ProcessBuilder(processArguments(java));
>> > }
>> >
>> > - ProcessBuilder throughputTest(String java) {
>> > - List<String> args = processArguments(java);
>> > + ProcessBuilder throughputTest(final String java) {
>> > + final List<String> args = processArguments(java);
>> > args.add("-throughput");
>> > return new ProcessBuilder(args);
>> > }
>> >
>> > @Override
>> > - public int compareTo(Setup other) {
>> > + public int compareTo(final Setup other) {
>> > // largest ops/sec first
>> > return (int) Math.signum(other._stats._averageOpsPerSec
>> > - _stats._averageOpsPerSec);
>> > @@ -137,7 +137,7 @@ public class PerfTestDriver {
>> > } else if (MTPerfTest.class == _class) {
>> > detail = _threadCount + " threads";
>> > }
>> > - String target = _runner.substring(_runner.indexOf(".Run") + 4);
>> > + final String target = _runner.substring(_runner.indexOf(".Run") + 4);
>> > return target + ": " + _name + " (" + detail + ")";
>> > }
>> > }
>> > @@ -152,16 +152,16 @@ public class PerfTestDriver {
>> > long _pct99_99;
>> > double _latencyRowCount;
>> > int _throughputRowCount;
>> > - private long _averageOpsPerSec;
>> > + private final long _averageOpsPerSec;
>> >
>> > // example line: avg=828 99%=1118 99.99%=5028 Count=3125
>> > - public Stats(String raw) {
>> > - String[] lines = raw.split("[\\r\\n]+");
>> > + public Stats(final String raw) {
>> > + final String[] lines = raw.split("[\\r\\n]+");
>> > long totalOps = 0;
>> > - for (String line : lines) {
>> > + for (final String line : lines) {
>> > if (line.startsWith("avg")) {
>> > _latencyRowCount++;
>> > - String[] parts = line.split(" ");
>> > + final String[] parts = line.split(" ");
>> > int i = 0;
>> > _average += Long.parseLong(parts[i++].split("=")[1]);
>> > _pct99 += Long.parseLong(parts[i++].split("=")[1]);
>> > @@ -169,8 +169,8 @@ public class PerfTestDriver {
>> > _count += Integer.parseInt(parts[i].split("=")[1]);
>> > } else {
>> > _throughputRowCount++;
>> > - String number = line.substring(0, line.indexOf(' '));
>> > - long opsPerSec = Long.parseLong(number);
>> > + final String number = line.substring(0, line.indexOf(' '));
>> > + final long opsPerSec = Long.parseLong(number);
>> > totalOps += opsPerSec;
>> > }
>> > }
>> > @@ -179,7 +179,7 @@ public class PerfTestDriver {
>> >
>> > @Override
>> > public String toString() {
>> > - String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
>> > + final String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
>> > return String.format(fmt, _averageOpsPerSec, //
>> > _average / _latencyRowCount, // mean latency
>> > _pct99 / _latencyRowCount, // 99% observations less than
>> > @@ -189,24 +189,24 @@ public class PerfTestDriver {
>> > }
>> >
>> > // single-threaded performance test
>> > - private static Setup s(String config, String runner, String name,
>> > - String... systemProperties) throws IOException {
>> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>> > + private static Setup s(final String config, final String runner, final String name,
>> > + final String... systemProperties) throws IOException {
>> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>> > "WaitStrategy", "Sleep"));
>> > return new Setup(PerfTest.class, runner, name, config, 1, wait,
>> > systemProperties);
>> > }
>> >
>> > // multi-threaded performance test
>> > - private static Setup m(String config, String runner, String name,
>> > - int threadCount, String... systemProperties) throws IOException {
>> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>> > + private static Setup m(final String config, final String runner, final String name,
>> > + final int threadCount, final String... systemProperties) throws IOException {
>> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>> > "WaitStrategy", "Sleep"));
>> > return new Setup(MTPerfTest.class, runner, name, config, threadCount,
>> > wait, systemProperties);
>> > }
>> >
>> > - public static void main(String[] args) throws Exception {
>> > + public static void main(final String[] args) throws Exception {
>> > final String ALL_ASYNC = "-DLog4jContextSelector="
>> > + AsyncLoggerContextSelector.class.getName();
>> > final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
>> > @@ -215,8 +215,8 @@ public class PerfTestDriver {
>> > final String LOG20 = RunLog4j2.class.getName();
>> > final String LOGBK = RunLogback.class.getName();
>> >
>> > - long start = System.nanoTime();
>> > - List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
>> > + final long start = System.nanoTime();
>> > + final List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
>> > // includeLocation=false
>> > tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
>> > ALL_ASYNC, SYSCLOCK));
>> > @@ -285,29 +285,29 @@ public class PerfTestDriver {
>> > // "RollFastFileAppender", i));
>> > }
>> >
>> > - String java = args.length > 0 ? args[0] : "java";
>> > - int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
>> > + final String java = args.length > 0 ? args[0] : "java";
>> > + final int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
>> > int x = 0;
>> > - for (Setup config : tests) {
>> > + for (final Setup config : tests) {
>> > System.out.print(config.description());
>> > - ProcessBuilder pb = config.throughputTest(java);
>> > + final ProcessBuilder pb = config.throughputTest(java);
>> > pb.redirectErrorStream(true); // merge System.out and System.err
>> > - long t1 = System.nanoTime();
>> > + final long t1 = System.nanoTime();
>> > // int count = config._threadCount >= 16 ? 2 : repeat;
>> > runPerfTest(repeat, x++, config, pb);
>> > System.out.printf(" took %.1f seconds%n", (System.nanoTime() - t1)
>> > / (1000.0 * 1000.0 * 1000.0));
>> >
>> > - FileReader reader = new FileReader(config._temp);
>> > - CharBuffer buffer = CharBuffer.allocate(256 * 1024);
>> > + final FileReader reader = new FileReader(config._temp);
>> > + final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
>> > reader.read(buffer);
>> > reader.close();
>> > config._temp.delete();
>> > buffer.flip();
>> >
>> > - String raw = buffer.toString();
>> > + final String raw = buffer.toString();
>> > System.out.print(raw);
>> > - Stats stats = new Stats(raw);
>> > + final Stats stats = new Stats(raw);
>> > System.out.println(stats);
>> > System.out.println("-----");
>> > config._stats = stats;
>> > @@ -321,19 +321,19 @@ public class PerfTestDriver {
>> > printRanking(tests.toArray(new Setup[tests.size()]));
>> > }
>> >
>> > - private static void printRanking(Setup[] tests) {
>> > + private static void printRanking(final Setup[] tests) {
>> > System.out.println();
>> > System.out.println("Ranking:");
>> > Arrays.sort(tests);
>> > for (int i = 0; i < tests.length; i++) {
>> > - Setup setup = tests[i];
>> > + final Setup setup = tests[i];
>> > System.out.println((i + 1) + ". " + setup.description() + ": "
>> > + setup._stats);
>> > }
>> > }
>> >
>> > - private static void runPerfTest(int repeat, int setupIndex, Setup config,
>> > - ProcessBuilder pb) throws IOException, InterruptedException {
>> > + private static void runPerfTest(final int repeat, final int setupIndex, final Setup config,
>> > + final ProcessBuilder pb) throws IOException, InterruptedException {
>> > for (int i = 0; i < repeat; i++) {
>> > System.out.print(" (" + (i + 1) + "/" + repeat + ")...");
>> > final Process process = pb.start();
>> > @@ -343,7 +343,7 @@ public class PerfTestDriver {
>> > process.waitFor();
>> > stop[0] = true;
>> >
>> > - File gc = new File("gc" + setupIndex + "_" + i
>> > + final File gc = new File("gc" + setupIndex + "_" + i
>> > + config._log4jConfig + ".log");
>> > if (gc.exists()) {
>> > gc.delete();
>> > @@ -355,17 +355,17 @@ public class PerfTestDriver {
>> > private static Thread printProcessOutput(final Process process,
>> > final boolean[] stop) {
>> >
>> > - Thread t = new Thread("OutputWriter") {
>> > + final Thread t = new Thread("OutputWriter") {
>> > @Override
>> > public void run() {
>> > - BufferedReader in = new BufferedReader(new InputStreamReader(
>> > + final BufferedReader in = new BufferedReader(new InputStreamReader(
>> > process.getInputStream()));
>> > try {
>> > String line = null;
>> > while (!stop[0] && (line = in.readLine()) != null) {
>> > System.out.println(line);
>> > }
>> > - } catch (Exception ignored) {
>> > + } catch (final Exception ignored) {
>> > }
>> > }
>> > };
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java Tue Jul 9 06:08:25 2013
>> > @@ -42,7 +42,7 @@ class PerfTestResultFormatter {
>> > double latency99Pct;
>> > double latency99_99Pct;
>> >
>> > - Stats(String throughput, String avg, String lat99, String lat99_99)
>> > + Stats(final String throughput, final String avg, final String lat99, final String lat99_99)
>> > throws ParseException {
>> > this.throughput = NUM.parse(throughput.trim()).longValue();
>> > this.avgLatency = Double.parseDouble(avg.trim());
>> > @@ -51,40 +51,40 @@ class PerfTestResultFormatter {
>> > }
>> > }
>> >
>> > - private Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
>> > + private final Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
>> >
>> > public PerfTestResultFormatter() {
>> > }
>> >
>> > - public String format(String text) throws ParseException {
>> > + public String format(final String text) throws ParseException {
>> > results.clear();
>> > - String[] lines = text.split("[\\r\\n]+");
>> > - for (String line : lines) {
>> > + final String[] lines = text.split("[\\r\\n]+");
>> > + for (final String line : lines) {
>> > process(line);
>> > }
>> > return latencyTable() + LF + throughputTable();
>> > }
>> >
>> > private String latencyTable() {
>> > - StringBuilder sb = new StringBuilder(4 * 1024);
>> > - Set<String> subKeys = results.values().iterator().next().keySet();
>> > - char[] tabs = new char[subKeys.size()];
>> > + final StringBuilder sb = new StringBuilder(4 * 1024);
>> > + final Set<String> subKeys = results.values().iterator().next().keySet();
>> > + final char[] tabs = new char[subKeys.size()];
>> > Arrays.fill(tabs, '\t');
>> > - String sep = new String(tabs);
>> > + final String sep = new String(tabs);
>> > sb.append("\tAverage latency").append(sep).append("99% less than").append(sep).append("99.99% less than");
>> > sb.append(LF);
>> > for (int i = 0; i < 3; i++) {
>> > - for (String subKey : subKeys) {
>> > + for (final String subKey : subKeys) {
>> > sb.append("\t").append(subKey);
>> > }
>> > }
>> > sb.append(LF);
>> > - for (String key : results.keySet()) {
>> > + for (final String key : results.keySet()) {
>> > sb.append(key);
>> > for (int i = 0; i < 3; i++) {
>> > - Map<String, Stats> sub = results.get(key);
>> > - for (String subKey : sub.keySet()) {
>> > - Stats stats = sub.get(subKey);
>> > + final Map<String, Stats> sub = results.get(key);
>> > + for (final String subKey : sub.keySet()) {
>> > + final Stats stats = sub.get(subKey);
>> > switch (i) {
>> > case 0:
>> > sb.append("\t").append((long) stats.avgLatency);
>> > @@ -104,19 +104,19 @@ class PerfTestResultFormatter {
>> > }
>> >
>> > private String throughputTable() {
>> > - StringBuilder sb = new StringBuilder(4 * 1024);
>> > - Set<String> subKeys = results.values().iterator().next().keySet();
>> > + final StringBuilder sb = new StringBuilder(4 * 1024);
>> > + final Set<String> subKeys = results.values().iterator().next().keySet();
>> > sb.append("\tThroughput per thread (msg/sec)");
>> > sb.append(LF);
>> > - for (String subKey : subKeys) {
>> > + for (final String subKey : subKeys) {
>> > sb.append("\t").append(subKey);
>> > }
>> > sb.append(LF);
>> > - for (String key : results.keySet()) {
>> > + for (final String key : results.keySet()) {
>> > sb.append(key);
>> > - Map<String, Stats> sub = results.get(key);
>> > - for (String subKey : sub.keySet()) {
>> > - Stats stats = sub.get(subKey);
>> > + final Map<String, Stats> sub = results.get(key);
>> > + for (final String subKey : sub.keySet()) {
>> > + final Stats stats = sub.get(subKey);
>> > sb.append("\t").append(stats.throughput);
>> > }
>> > sb.append(LF);
>> > @@ -124,19 +124,19 @@ class PerfTestResultFormatter {
>> > return sb.toString();
>> > }
>> >
>> > - private void process(String line) throws ParseException {
>> > - String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
>> > - String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
>> > - String throughput = line.substring(line.indexOf("throughput: ")
>> > + private void process(final String line) throws ParseException {
>> > + final String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
>> > + final String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
>> > + final String throughput = line.substring(line.indexOf("throughput: ")
>> > + "throughput: ".length(), line.indexOf(" ops"));
>> > - String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
>> > + final String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
>> > line.indexOf(" 99%"));
>> > - String pct99 = line.substring(
>> > + final String pct99 = line.substring(
>> > line.indexOf("99% < ") + "99% < ".length(),
>> > line.indexOf(" 99.99%"));
>> > - String pct99_99 = line.substring(line.indexOf("99.99% < ")
>> > + final String pct99_99 = line.substring(line.indexOf("99.99% < ")
>> > + "99.99% < ".length(), line.lastIndexOf('(') - 1);
>> > - Stats stats = new Stats(throughput, avg, pct99, pct99_99);
>> > + final Stats stats = new Stats(throughput, avg, pct99, pct99_99);
>> > Map<String, Stats> map = results.get(key.trim());
>> > if (map == null) {
>> > map = new TreeMap<String, Stats>(sort());
>> > @@ -156,9 +156,9 @@ class PerfTestResultFormatter {
>> > "64 threads");
>> >
>> > @Override
>> > - public int compare(String o1, String o2) {
>> > - int i1 = expected.indexOf(o1);
>> > - int i2 = expected.indexOf(o2);
>> > + public int compare(final String o1, final String o2) {
>> > + final int i1 = expected.indexOf(o1);
>> > + final int i2 = expected.indexOf(o2);
>> > if (i1 < 0 || i2 < 0) {
>> > return o1.compareTo(o2);
>> > }
>> > @@ -167,9 +167,9 @@ class PerfTestResultFormatter {
>> > };
>> > }
>> >
>> > - public static void main(String[] args) throws Exception {
>> > - PerfTestResultFormatter fmt = new PerfTestResultFormatter();
>> > - BufferedReader reader = new BufferedReader(new InputStreamReader(
>> > + public static void main(final String[] args) throws Exception {
>> > + final PerfTestResultFormatter fmt = new PerfTestResultFormatter();
>> > + final BufferedReader reader = new BufferedReader(new InputStreamReader(
>> > System.in));
>> > String line;
>> > while ((line = reader.readLine()) != null) {
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java Tue Jul 9 06:08:25 2013
>> > @@ -24,32 +24,32 @@ import com.lmax.disruptor.collections.Hi
>> > public class RunLog4j1 implements IPerfTestRunner {
>> >
>> > @Override
>> > - public void runThroughputTest(int lines, Histogram histogram) {
>> > - long s1 = System.nanoTime();
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void runThroughputTest(final int lines, final Histogram histogram) {
>> > + final long s1 = System.nanoTime();
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > for (int j = 0; j < lines; j++) {
>> > logger.info(THROUGHPUT_MSG);
>> > }
>> > - long s2 = System.nanoTime();
>> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>> > + final long s2 = System.nanoTime();
>> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>> > histogram.addObservation(opsPerSec);
>> > }
>> >
>> > @Override
>> > - public void runLatencyTest(int samples, Histogram histogram,
>> > - long nanoTimeCost, int threadCount) {
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void runLatencyTest(final int samples, final Histogram histogram,
>> > + final long nanoTimeCost, final int threadCount) {
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > for (int i = 0; i < samples; i++) {
>> > - long s1 = System.nanoTime();
>> > + final long s1 = System.nanoTime();
>> > logger.info(LATENCY_MSG);
>> > - long s2 = System.nanoTime();
>> > - long value = s2 - s1 - nanoTimeCost;
>> > + final long s2 = System.nanoTime();
>> > + final long value = s2 - s1 - nanoTimeCost;
>> > if (value > 0) {
>> > histogram.addObservation(value);
>> > }
>> > // wait 1 microsec
>> > final long PAUSE_NANOS = 10000 * threadCount;
>> > - long pauseStart = System.nanoTime();
>> > + final long pauseStart = System.nanoTime();
>> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
>> > // busy spin
>> > }
>> > @@ -62,8 +62,8 @@ public class RunLog4j1 implements IPerfT
>> > }
>> >
>> > @Override
>> > - public void log(String finalMessage) {
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void log(final String finalMessage) {
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > logger.info(finalMessage);
>> > }
>> > }
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java Tue Jul 9 06:08:25 2013
>> > @@ -25,33 +25,33 @@ import com.lmax.disruptor.collections.Hi
>> > public class RunLog4j2 implements IPerfTestRunner {
>> >
>> > @Override
>> > - public void runThroughputTest(int lines, Histogram histogram) {
>> > - long s1 = System.nanoTime();
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void runThroughputTest(final int lines, final Histogram histogram) {
>> > + final long s1 = System.nanoTime();
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > for (int j = 0; j < lines; j++) {
>> > logger.info(THROUGHPUT_MSG);
>> > }
>> > - long s2 = System.nanoTime();
>> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>> > + final long s2 = System.nanoTime();
>> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>> > histogram.addObservation(opsPerSec);
>> > }
>> >
>> >
>> > @Override
>> > - public void runLatencyTest(int samples, Histogram histogram,
>> > - long nanoTimeCost, int threadCount) {
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void runLatencyTest(final int samples, final Histogram histogram,
>> > + final long nanoTimeCost, final int threadCount) {
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > for (int i = 0; i < samples; i++) {
>> > - long s1 = System.nanoTime();
>> > + final long s1 = System.nanoTime();
>> > logger.info(LATENCY_MSG);
>> > - long s2 = System.nanoTime();
>> > - long value = s2 - s1 - nanoTimeCost;
>> > + final long s2 = System.nanoTime();
>> > + final long value = s2 - s1 - nanoTimeCost;
>> > if (value > 0) {
>> > histogram.addObservation(value);
>> > }
>> > // wait 1 microsec
>> > final long PAUSE_NANOS = 10000 * threadCount;
>> > - long pauseStart = System.nanoTime();
>> > + final long pauseStart = System.nanoTime();
>> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
>> > // busy spin
>> > }
>> > @@ -66,8 +66,8 @@ public class RunLog4j2 implements IPerfT
>> >
>> >
>> > @Override
>> > - public void log(String finalMessage) {
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void log(final String finalMessage) {
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > logger.info(finalMessage);
>> > }
>> > }
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java Tue Jul 9 06:08:25 2013
>> > @@ -26,32 +26,32 @@ import com.lmax.disruptor.collections.Hi
>> > public class RunLogback implements IPerfTestRunner {
>> >
>> > @Override
>> > - public void runThroughputTest(int lines, Histogram histogram) {
>> > - long s1 = System.nanoTime();
>> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>> > + public void runThroughputTest(final int lines, final Histogram histogram) {
>> > + final long s1 = System.nanoTime();
>> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>> > for (int j = 0; j < lines; j++) {
>> > logger.info(THROUGHPUT_MSG);
>> > }
>> > - long s2 = System.nanoTime();
>> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>> > + final long s2 = System.nanoTime();
>> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>> > histogram.addObservation(opsPerSec);
>> > }
>> >
>> > @Override
>> > - public void runLatencyTest(int samples, Histogram histogram,
>> > - long nanoTimeCost, int threadCount) {
>> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>> > + public void runLatencyTest(final int samples, final Histogram histogram,
>> > + final long nanoTimeCost, final int threadCount) {
>> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>> > for (int i = 0; i < samples; i++) {
>> > - long s1 = System.nanoTime();
>> > + final long s1 = System.nanoTime();
>> > logger.info(LATENCY_MSG);
>> > - long s2 = System.nanoTime();
>> > - long value = s2 - s1 - nanoTimeCost;
>> > + final long s2 = System.nanoTime();
>> > + final long value = s2 - s1 - nanoTimeCost;
>> > if (value > 0) {
>> > histogram.addObservation(value);
>> > }
>> > // wait 1 microsec
>> > final long PAUSE_NANOS = 10000 * threadCount;
>> > - long pauseStart = System.nanoTime();
>> > + final long pauseStart = System.nanoTime();
>> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
>> > // busy spin
>> > }
>> > @@ -64,8 +64,8 @@ public class RunLogback implements IPerf
>> > }
>> >
>> > @Override
>> > - public void log(String msg) {
>> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>> > + public void log(final String msg) {
>> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
>> > logger.info(msg);
>> > }
>> > }
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java Tue Jul 9 06:08:25 2013
>> > @@ -63,12 +63,12 @@ public class AdvertiserTest {
>> > file.delete();
>> > }
>> >
>> > - private void verifyExpectedEntriesAdvertised(Map<Object, Map<String, String>> entries) {
>> > + private void verifyExpectedEntriesAdvertised(final Map<Object, Map<String, String>> entries) {
>> > boolean foundFile1 = false;
>> > boolean foundFile2 = false;
>> > boolean foundSocket1 = false;
>> > boolean foundSocket2 = false;
>> > - for (Map<String, String>entry:entries.values()) {
>> > + for (final Map<String, String>entry:entries.values()) {
>> > if (foundFile1 && foundFile2 && foundSocket1 && foundSocket2) {
>> > break;
>> > }
>> > @@ -103,7 +103,7 @@ public class AdvertiserTest {
>> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
>> > ctx.stop();
>> >
>> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
>> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
>> > assertTrue("Entries found: " + entries, entries.isEmpty());
>> >
>> > //reconfigure for subsequent testing
>> > @@ -117,7 +117,7 @@ public class AdvertiserTest {
>> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
>> > ctx.stop();
>> >
>> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
>> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
>> > assertTrue("Entries found: " + entries, entries.isEmpty());
>> >
>> > ctx.start();
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java Tue Jul 9 06:08:25 2013
>> > @@ -34,9 +34,9 @@ public class BaseConfigurationTest {
>> > @Test
>> > public void testMissingRootLogger() throws Exception {
>> > PluginManager.addPackage("org.apache.logging.log4j.test.appender");
>> > - LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
>> > + final LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
>> > final Logger logger = LogManager.getLogger("sample.Logger1");
>> > - Configuration config = ctx.getConfiguration();
>> > + final Configuration config = ctx.getConfiguration();
>> > assertNotNull("Config not null", config);
>> > // final String MISSINGROOT = "MissingRootTest";
>> > // assertTrue("Incorrect Configuration. Expected " + MISSINGROOT + " but found " + config.getName(),
>> > @@ -53,15 +53,15 @@ public class BaseConfigurationTest {
>> > // only the sample logger, no root logger in loggerMap!
>> > assertTrue("contains key=sample", loggerMap.containsKey("sample"));
>> >
>> > - LoggerConfig sample = loggerMap.get("sample");
>> > - Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
>> > + final LoggerConfig sample = loggerMap.get("sample");
>> > + final Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
>> > assertEquals("sampleAppenders Size", 1, sampleAppenders.size());
>> > // sample only has List appender, not Console!
>> > assertTrue("sample has appender List", sampleAppenders.containsKey("List"));
>> >
>> > - BaseConfiguration baseConfig = (BaseConfiguration) config;
>> > - LoggerConfig root = baseConfig.getRootLogger();
>> > - Map<String, Appender<?>> rootAppenders = root.getAppenders();
>> > + final BaseConfiguration baseConfig = (BaseConfiguration) config;
>> > + final LoggerConfig root = baseConfig.getRootLogger();
>> > + final Map<String, Appender<?>> rootAppenders = root.getAppenders();
>> > assertEquals("rootAppenders Size", 1, rootAppenders.size());
>> > // root only has Console appender!
>> > assertTrue("root has appender Console", rootAppenders.containsKey("Console"));
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java Tue Jul 9 06:08:25 2013
>> > @@ -28,20 +28,20 @@ public class InMemoryAdvertiser implemen
>> >
>> > public static Map<Object, Map<String, String>> getAdvertisedEntries()
>> > {
>> > - Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
>> > + final Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
>> > result.putAll(properties);
>> > return result;
>> > }
>> >
>> > @Override
>> > - public Object advertise(Map<String, String> newEntry) {
>> > - Object object = new Object();
>> > + public Object advertise(final Map<String, String> newEntry) {
>> > + final Object object = new Object();
>> > properties.put(object, new HashMap<String, String>(newEntry));
>> > return object;
>> > }
>> >
>> > @Override
>> > - public void unadvertise(Object advertisedObject) {
>> > + public void unadvertise(final Object advertisedObject) {
>> > properties.remove(advertisedObject);
>> > }
>> > }
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java Tue Jul 9 06:08:25 2013
>> > @@ -189,24 +189,24 @@ public class TestConfigurator {
>> > public void testEnvironment() throws Exception {
>> > final LoggerContext ctx = Configurator.initialize("-config", null, (String) null);
>> > final Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
>> > - Configuration config = ctx.getConfiguration();
>> > + final Configuration config = ctx.getConfiguration();
>> > assertNotNull("No configuration", config);
>> > assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
>> > CONFIG_NAME.equals(config.getName()));
>> > final Map<String, Appender<?>> map = config.getAppenders();
>> > assertNotNull("No Appenders", map != null && map.size() > 0);
>> > Appender<?> app = null;
>> > - for (Map.Entry<String, Appender<?>> entry: map.entrySet()) {
>> > + for (final Map.Entry<String, Appender<?>> entry: map.entrySet()) {
>> > if (entry.getKey().equals("List2")) {
>> > app = entry.getValue();
>> > break;
>> > }
>> > }
>> > assertNotNull("No ListAppender named List2", app);
>> > - Layout layout = app.getLayout();
>> > + final Layout layout = app.getLayout();
>> > assertNotNull("Appender List2 does not have a Layout", layout);
>> > assertTrue("Appender List2 is not configured with a PatternLayout", layout instanceof PatternLayout);
>> > - String pattern = ((PatternLayout) layout).getConversionPattern();
>> > + final String pattern = ((PatternLayout) layout).getConversionPattern();
>> > assertNotNull("No conversion pattern for List2 PatternLayout", pattern);
>> > assertFalse("Environment variable was not substituted", pattern.startsWith("${env:PATH}"));
>> > }
>> >
>> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
>> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> > ==============================================================================
>> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java (original)
>> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java Tue Jul 9 06:08:25 2013
>> > @@ -55,7 +55,7 @@ public class RegexFilterTest {
>> >
>> > @Test
>> > public void TestNoMsg() {
>> > - RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
>> > + final RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
>> > filter.start();
>> > assertTrue(filter.isStarted());
>> > assertTrue(filter.filter(null, Level.DEBUG, null, (String)null, (Throwable)null) == Filter.Result.DENY);
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> JUnit in Action, Second Edition
>> Spring Batch in Action
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>
Re: svn commit: r1501104 [4/5] - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/ api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j/s...
Posted by Nick Williams <ni...@nicholaswilliams.net>.
Ralph already committed a change a few minutes ago that removed the @Override from that method that can't have it.
N
On Jul 9, 2013, at 3:20 PM, Gary Gregory wrote:
> Everything is compiling in Eclipse (Java 6) and Maven (Java 7) but I just read Nick's comment. I am running Maven on Java 6 as I write this...
>
> Gary
>
>
> On Tue, Jul 9, 2013 at 4:10 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> After fixing the prior compiler error I then ran into this one:
>
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project log4j-core: Compilation failure
> [ERROR] /Users/rgoers/projects/apache/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java:[177,13] variable _averageOpsPerSec might already have been assigned
>
> Can you please compile and test before committing?
>
> Ralph
>
> On Jul 8, 2013, at 11:08 PM, ggregory@apache.org wrote:
>
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -41,7 +41,7 @@ public class ContextStackAttributeConver
> >
> > @Test
> > public void testConvertToDatabaseColumn01() {
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("value1", "another2"));
> >
> > assertEquals("The converted value is not correct.", "value1\nanother2",
> > @@ -50,7 +50,7 @@ public class ContextStackAttributeConver
> >
> > @Test
> > public void testConvertToDatabaseColumn02() {
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("key1", "value2", "my3"));
> >
> > assertEquals("The converted value is not correct.",
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -42,14 +42,14 @@ public class ContextStackJsonAttributeCo
> > @Test
> > public void testConvert01() {
> > ThreadContext.clearStack();
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("value1", "another2"));
> >
> > - String converted = this.converter.convertToDatabaseColumn(stack);
> > + final String converted = this.converter.convertToDatabaseColumn(stack);
> >
> > assertNotNull("The converted value should not be null.", converted);
> >
> > - ThreadContext.ContextStack reversed = this.converter
> > + final ThreadContext.ContextStack reversed = this.converter
> > .convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > @@ -60,14 +60,14 @@ public class ContextStackJsonAttributeCo
> > @Test
> > public void testConvert02() {
> > ThreadContext.clearStack();
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("key1", "value2", "my3"));
> >
> > - String converted = this.converter.convertToDatabaseColumn(stack);
> > + final String converted = this.converter.convertToDatabaseColumn(stack);
> >
> > assertNotNull("The converted value should not be null.", converted);
> >
> > - ThreadContext.ContextStack reversed = this.converter
> > + final ThreadContext.ContextStack reversed = this.converter
> > .convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -39,14 +39,14 @@ public class MarkerAttributeConverterTes
> >
> > @Test
> > public void testConvert01() {
> > - Marker marker = MarkerManager.getMarker("testConvert01");
> > + final Marker marker = MarkerManager.getMarker("testConvert01");
> >
> > - String converted = this.converter.convertToDatabaseColumn(marker);
> > + final String converted = this.converter.convertToDatabaseColumn(marker);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "testConvert01", converted);
> >
> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "testConvert01", marker.getName());
> > @@ -54,19 +54,19 @@ public class MarkerAttributeConverterTes
> >
> > @Test
> > public void testConvert02() {
> > - Marker marker = MarkerManager.getMarker("testConvert02",
> > + final Marker marker = MarkerManager.getMarker("testConvert02",
> > MarkerManager.getMarker("anotherConvert02",
> > MarkerManager.getMarker("finalConvert03")
> > )
> > );
> >
> > - String converted = this.converter.convertToDatabaseColumn(marker);
> > + final String converted = this.converter.convertToDatabaseColumn(marker);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "testConvert02[ anotherConvert02[ finalConvert03 ] ] ]",
> > converted);
> >
> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "testConvert02", marker.getName());
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -41,14 +41,14 @@ public class MessageAttributeConverterTe
> >
> > @Test
> > public void testConvert01() {
> > - Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
> > + final Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
> >
> > - String converted = this.converter.convertToDatabaseColumn(message);
> > + final String converted = this.converter.convertToDatabaseColumn(message);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "Message #3 said [Hello].", converted);
> >
> > - Message reversed = this.converter.convertToEntityAttribute(converted);
> > + final Message reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "Message #3 said [Hello].", reversed.getFormattedMessage());
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -37,15 +37,15 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert01() {
> > - StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
> > + final StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "TestNoPackage", reversed.getClassName());
> > @@ -57,17 +57,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert02() {
> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
> > "testConvert02", "TestWithPackage.java", -1);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "org.apache.logging.TestWithPackage", reversed.getClassName());
> > @@ -79,17 +79,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert03() {
> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
> > "testConvert03", null, -1);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestNoSource.testConvert03(Unknown Source)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "org.apache.logging.TestNoSource", reversed.getClassName());
> > @@ -101,17 +101,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert04() {
> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
> > "testConvert04", null, -2);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "org.apache.logging.TestIsNativeMethod",
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -39,16 +39,16 @@ public class ThrowableAttributeConverter
> >
> > @Test
> > public void testConvert01() {
> > - RuntimeException exception = new RuntimeException("My message 01.");
> > + final RuntimeException exception = new RuntimeException("My message 01.");
> >
> > - String stackTrace = getStackTrace(exception);
> > + final String stackTrace = getStackTrace(exception);
> >
> > - String converted = this.converter.convertToDatabaseColumn(exception);
> > + final String converted = this.converter.convertToDatabaseColumn(exception);
> >
> > assertNotNull("The converted value is not correct.", converted);
> > assertEquals("The converted value is not correct.", stackTrace, converted);
> >
> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
> > @@ -56,18 +56,18 @@ public class ThrowableAttributeConverter
> >
> > @Test
> > public void testConvert02() {
> > - SQLException cause2 = new SQLException("This is a test cause.");
> > - Error cause1 = new Error(cause2);
> > - RuntimeException exception = new RuntimeException("My message 01.", cause1);
> > + final SQLException cause2 = new SQLException("This is a test cause.");
> > + final Error cause1 = new Error(cause2);
> > + final RuntimeException exception = new RuntimeException("My message 01.", cause1);
> >
> > - String stackTrace = getStackTrace(exception);
> > + final String stackTrace = getStackTrace(exception);
> >
> > - String converted = this.converter.convertToDatabaseColumn(exception);
> > + final String converted = this.converter.convertToDatabaseColumn(exception);
> >
> > assertNotNull("The converted value is not correct.", converted);
> > assertEquals("The converted value is not correct.", stackTrace, converted);
> >
> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
> > @@ -84,10 +84,10 @@ public class ThrowableAttributeConverter
> > assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
> > }
> >
> > - private static String getStackTrace(Throwable throwable) {
> > + private static String getStackTrace(final Throwable throwable) {
> > String returnValue = throwable.toString() + "\n";
> >
> > - for (StackTraceElement element : throwable.getStackTrace()) {
> > + for (final StackTraceElement element : throwable.getStackTrace()) {
> > returnValue += "\tat " + element.toString() + "\n";
> > }
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java Tue Jul 9 06:08:25 2013
> > @@ -51,7 +51,7 @@ public class MapRewritePolicyTest {
> > logEvent1 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ERROR,
> > new MapMessage(map), null, map, null, "none",
> > new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 29), 2);
> > - ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
> > + final ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
> > logEvent2 = new Log4jLogEvent("test", MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
> > Level.TRACE, new StructuredDataMessage("test", "Nothing", "test", map), new RuntimeException("test"), null,
> > stack, "none", new StackTraceElement("MapRewritePolicyTest",
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java Tue Jul 9 06:08:25 2013
> > @@ -112,7 +112,7 @@ public class RewriteAppenderTest {
> > StructuredDataMessage msg = new StructuredDataMessage("Test", "This is a test", "Service");
> > msg.put("Key1", "Value2");
> > msg.put("Key2", "Value1");
> > - Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> > + final Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> > logger.debug(msg);
> > msg = new StructuredDataMessage("Test", "This is a test", "Service");
> > msg.put("Key1", "Value1");
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java Tue Jul 9 06:08:25 2013
> > @@ -40,23 +40,23 @@ public class FastRollingFileManagerTest
> > */
> > @Test
> > public void testWrite_multiplesOfBufferSize() throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > - boolean append = false;
> > - boolean flushNow = false;
> > - long triggerSize = Long.MAX_VALUE;
> > - long time = System.currentTimeMillis();
> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > + final boolean append = false;
> > + final boolean flushNow = false;
> > + final long triggerSize = Long.MAX_VALUE;
> > + final long time = System.currentTimeMillis();
> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > triggerSize);
> > - RolloverStrategy rolloverStrategy = null;
> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
> > + final RolloverStrategy rolloverStrategy = null;
> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
> > file.getName(), "", os, append, flushNow, triggerSize, time,
> > triggerPolicy, rolloverStrategy, null, null);
> >
> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> > - byte[] data = new byte[size];
> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> > + final byte[] data = new byte[size];
> > manager.write(data, 0, data.length); // no buffer overflow exception
> >
> > // buffer is full but not flushed yet
> > @@ -71,23 +71,23 @@ public class FastRollingFileManagerTest
> > */
> > @Test
> > public void testWrite_dataExceedingBufferSize() throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > - boolean append = false;
> > - boolean flushNow = false;
> > - long triggerSize = 0;
> > - long time = System.currentTimeMillis();
> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > + final boolean append = false;
> > + final boolean flushNow = false;
> > + final long triggerSize = 0;
> > + final long time = System.currentTimeMillis();
> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > triggerSize);
> > - RolloverStrategy rolloverStrategy = null;
> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
> > + final RolloverStrategy rolloverStrategy = null;
> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
> > file.getName(), "", os, append, flushNow, triggerSize, time,
> > triggerPolicy, rolloverStrategy, null, null);
> >
> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
> > - byte[] data = new byte[size];
> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
> > + final byte[] data = new byte[size];
> > manager.write(data, 0, data.length); // no exception
> > assertEquals(FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3,
> > raf.length());
> > @@ -98,12 +98,12 @@ public class FastRollingFileManagerTest
> >
> > @Test
> > public void testAppendDoesNotOverwriteExistingFile() throws IOException {
> > - boolean isAppend = true;
> > - File file = File.createTempFile("log4j2", "test");
> > + final boolean isAppend = true;
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > assertEquals(0, file.length());
> >
> > - byte[] bytes = new byte[4 * 1024];
> > + final byte[] bytes = new byte[4 * 1024];
> >
> > // create existing file
> > FileOutputStream fos = null;
> > @@ -116,31 +116,31 @@ public class FastRollingFileManagerTest
> > }
> > assertEquals("all flushed to disk", bytes.length, file.length());
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> > new SizeBasedTriggeringPolicy(Long.MAX_VALUE), //
> > null, null, null);
> > manager.write(bytes, 0, bytes.length);
> > - int expected = bytes.length * 2;
> > + final int expected = bytes.length * 2;
> > assertEquals("appended, not overwritten", expected, file.length());
> > }
> >
> > @Test
> > public void testFileTimeBasedOnSystemClockWhenAppendIsFalse()
> > throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > LockSupport.parkNanos(1000000); // 1 millisec
> >
> > // append is false deletes the file if it exists
> > - boolean isAppend = false;
> > - long expectedMin = System.currentTimeMillis();
> > - long expectedMax = expectedMin + 50;
> > + final boolean isAppend = false;
> > + final long expectedMin = System.currentTimeMillis();
> > + final long expectedMax = expectedMin + 50;
> > assertTrue(file.lastModified() < expectedMin);
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> > @@ -153,14 +153,14 @@ public class FastRollingFileManagerTest
> > @Test
> > public void testFileTimeBasedOnFileModifiedTimeWhenAppendIsTrue()
> > throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > LockSupport.parkNanos(1000000); // 1 millisec
> >
> > - boolean isAppend = true;
> > + final boolean isAppend = true;
> > assertTrue(file.lastModified() < System.currentTimeMillis());
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java Tue Jul 9 06:08:25 2013
> > @@ -35,7 +35,7 @@ public class FileRenameActionTest {
> >
> > @BeforeClass
> > public static void beforeClass() throws Exception {
> > - File file = new File(DIR);
> > + final File file = new File(DIR);
> > file.mkdirs();
> > }
> >
> > @@ -51,15 +51,15 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testRename1() throws Exception {
> > - File file = new File("target/fileRename/fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("target/fileRename/fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > for (int i = 0; i < 100; ++i) {
> > pos.println("This is line " + i);
> > }
> > pos.close();
> >
> > - File dest = new File("target/fileRename/newFile.log");
> > - FileRenameAction action = new FileRenameAction(file, dest, false);
> > + final File dest = new File("target/fileRename/newFile.log");
> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", dest.exists());
> > assertTrue("Old file exists", !file.exists());
> > @@ -67,12 +67,12 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testEmpty() throws Exception {
> > - File file = new File("target/fileRename/fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("target/fileRename/fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > pos.close();
> >
> > - File dest = new File("target/fileRename/newFile.log");
> > - FileRenameAction action = new FileRenameAction(file, dest, false);
> > + final File dest = new File("target/fileRename/newFile.log");
> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", !dest.exists());
> > assertTrue("Old file does not exist", !file.exists());
> > @@ -81,16 +81,16 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testNoParent() throws Exception {
> > - File file = new File("fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > for (int i = 0; i < 100; ++i) {
> > pos.println("This is line " + i);
> > }
> > pos.close();
> >
> > - File dest = new File("newFile.log");
> > + final File dest = new File("newFile.log");
> > try {
> > - FileRenameAction action = new FileRenameAction(file, dest, false);
> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", dest.exists());
> > assertTrue("Old file exists", !file.exists());
> > @@ -98,7 +98,7 @@ public class FileRenameActionTest {
> > try {
> > dest.delete();
> > file.delete();
> > - } catch (Exception ex) {
> > + } catch (final Exception ex) {
> > System.out.println("Unable to cleanup files written to main directory");
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java Tue Jul 9 06:08:25 2013
> > @@ -39,17 +39,17 @@ public class AsyncLoggerConfigTest {
> >
> > @Test
> > public void testAdditivity() throws Exception {
> > - File f = new File("target", "AsyncLoggerConfigTest.log");
> > + final File f = new File("target", "AsyncLoggerConfigTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Additive logging: 2 for the price of 1!";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Additive logging: 2 for the price of 1!";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > - String line2 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
> > + final String line1 = reader.readLine();
> > + final String line2 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > @@ -57,7 +57,7 @@ public class AsyncLoggerConfigTest {
> > assertTrue("line1 correct", line1.contains(msg));
> > assertTrue("line2 correct", line2.contains(msg));
> >
> > - String location = "testAdditivity";
> > + final String location = "testAdditivity";
> > assertTrue("location",
> > line1.contains(location) || line2.contains(location));
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java Tue Jul 9 06:08:25 2013
> > @@ -29,24 +29,24 @@ public class AsyncLoggerContextSelectorT
> >
> > @Test
> > public void testContextReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false);
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null, false);
> >
> > assertTrue(context instanceof AsyncLoggerContext);
> > }
> >
> > @Test
> > public void testContext2ReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false, null);
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null, false, null);
> >
> > assertTrue(context instanceof AsyncLoggerContext);
> > }
> >
> > @Test
> > public void testLoggerContextsReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - List<LoggerContext> list = selector.getLoggerContexts();
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final List<LoggerContext> list = selector.getLoggerContexts();
> >
> > assertEquals(1, list.size());
> > assertTrue(list.get(0) instanceof AsyncLoggerContext);
> > @@ -54,8 +54,8 @@ public class AsyncLoggerContextSelectorT
> >
> > @Test
> > public void testContextNameIsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false);
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null, false);
> >
> > assertEquals("AsyncLoggerContext", context.getName());
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java Tue Jul 9 06:08:25 2013
> > @@ -30,7 +30,7 @@ public class AsyncLoggerContextTest {
> >
> > @Test
> > public void testNewInstanceReturnsAsyncLogger() {
> > - Logger logger = new AsyncLoggerContext("a").newInstance(
> > + final Logger logger = new AsyncLoggerContext("a").newInstance(
> > new LoggerContext("a"), "a", null);
> > assertTrue(logger instanceof AsyncLogger);
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java Tue Jul 9 06:08:25 2013
> > @@ -49,22 +49,22 @@ public class AsyncLoggerLocationTest {
> >
> > @Test
> > public void testAsyncLogWritesToLog() throws Exception {
> > - File f = new File("target", "AsyncLoggerLocationTest.log");
> > + final File f = new File("target", "AsyncLoggerLocationTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Async logger msg with location";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Async logger msg with location";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
> > + final String line1 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > assertTrue("line1 correct", line1.contains(msg));
> >
> > - String location = "testAsyncLogWritesToLog";
> > + final String location = "testAsyncLogWritesToLog";
> > assertTrue("has location", line1.contains(location));
> > }
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java Tue Jul 9 06:08:25 2013
> > @@ -49,22 +49,22 @@ public class AsyncLoggerTest {
> >
> > @Test
> > public void testAsyncLogWritesToLog() throws Exception {
> > - File f = new File("target", "AsyncLoggerTest.log");
> > + final File f = new File("target", "AsyncLoggerTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Async logger msg";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Async logger msg";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
> > + final String line1 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > assertTrue("line1 correct", line1.contains(msg));
> >
> > - String location = "testAsyncLogWritesToLog";
> > + final String location = "testAsyncLogWritesToLog";
> > assertTrue("no location", !line1.contains(location));
> > }
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java Tue Jul 9 06:08:25 2013
> > @@ -22,23 +22,23 @@ import com.lmax.disruptor.collections.Hi
> >
> > public class MTPerfTest extends PerfTest {
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > new MTPerfTest().doMain(args);
> > }
> >
> > @Override
> > public void runTestAndPrintResult(final IPerfTestRunner runner,
> > - final String name, final int threadCount, String resultFile)
> > + final String name, final int threadCount, final String resultFile)
> > throws Exception {
> >
> > // ThreadContext.put("aKey", "mdcVal");
> > PerfTest.println("Warming up the JVM...");
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> >
> > // warmup at least 2 rounds and at most 1 minute
> > final Histogram warmupHist = PerfTest.createHistogram();
> > final long stop = System.currentTimeMillis() + (60 * 1000);
> > - Runnable run1 = new Runnable() {
> > + final Runnable run1 = new Runnable() {
> > @Override
> > public void run() {
> > for (int i = 0; i < 10; i++) {
> > @@ -50,8 +50,8 @@ public class MTPerfTest extends PerfTest
> > }
> > }
> > };
> > - Thread thread1 = new Thread(run1);
> > - Thread thread2 = new Thread(run1);
> > + final Thread thread1 = new Thread(run1);
> > + final Thread thread2 = new Thread(run1);
> > thread1.start();
> > thread2.start();
> > thread1.join();
> > @@ -74,7 +74,7 @@ public class MTPerfTest extends PerfTest
> > }
> >
> > private void multiThreadedTestRun(final IPerfTestRunner runner,
> > - final String name, final int threadCount, String resultFile)
> > + final String name, final int threadCount, final String resultFile)
> > throws Exception {
> >
> > final Histogram[] histograms = new Histogram[threadCount];
> > @@ -83,28 +83,28 @@ public class MTPerfTest extends PerfTest
> > }
> > final int LINES = 256 * 1024;
> >
> > - Thread[] threads = new Thread[threadCount];
> > + final Thread[] threads = new Thread[threadCount];
> > for (int i = 0; i < threads.length; i++) {
> > final Histogram histogram = histograms[i];
> > threads[i] = new Thread() {
> > @Override
> > public void run() {
> > // int latencyCount = threadCount >= 16 ? 1000000 : 5000000;
> > - int latencyCount = 5000000;
> > - int count = PerfTest.throughput ? LINES / threadCount
> > + final int latencyCount = 5000000;
> > + final int count = PerfTest.throughput ? LINES / threadCount
> > : latencyCount;
> > runTest(runner, count, "end", histogram, threadCount);
> > }
> > };
> > }
> > - for (Thread thread : threads) {
> > + for (final Thread thread : threads) {
> > thread.start();
> > }
> > - for (Thread thread : threads) {
> > + for (final Thread thread : threads) {
> > thread.join();
> > }
> >
> > - for (Histogram histogram : histograms) {
> > + for (final Histogram histogram : histograms) {
> > PerfTest.reportResult(resultFile, name, histogram);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java Tue Jul 9 06:08:25 2013
> > @@ -33,7 +33,7 @@ public class PerfTest {
> > // determine how long it takes to call System.nanoTime() (on average)
> > static long calcNanoTimeCost() {
> > final long iterations = 10000000;
> > - long start = System.nanoTime();
> > + final long start = System.nanoTime();
> > long finish = start;
> >
> > for (int i = 0; i < iterations; i++) {
> > @@ -49,7 +49,7 @@ public class PerfTest {
> > }
> >
> > static Histogram createHistogram() {
> > - long[] intervals = new long[31];
> > + final long[] intervals = new long[31];
> > long intervalUpperBound = 1L;
> > for (int i = 0, size = intervals.length - 1; i < size; i++) {
> > intervalUpperBound *= 2;
> > @@ -60,17 +60,17 @@ public class PerfTest {
> > return new Histogram(intervals);
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > new PerfTest().doMain(args);
> > }
> >
> > - public void doMain(String[] args) throws Exception {
> > - String runnerClass = args[0];
> > - IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
> > + public void doMain(final String[] args) throws Exception {
> > + final String runnerClass = args[0];
> > + final IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
> > .newInstance();
> > - String name = args[1];
> > - String resultFile = args.length > 2 ? args[2] : null;
> > - for (String arg : args) {
> > + final String name = args[1];
> > + final String resultFile = args.length > 2 ? args[2] : null;
> > + for (final String arg : args) {
> > if (verbose && throughput) {
> > break;
> > }
> > @@ -81,7 +81,7 @@ public class PerfTest {
> > throughput = true;
> > }
> > }
> > - int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
> > + final int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
> > printf("Starting %s %s (%d)...%n", getClass().getSimpleName(), name,
> > threadCount);
> > runTestAndPrintResult(runner, name, threadCount, resultFile);
> > @@ -89,14 +89,14 @@ public class PerfTest {
> > System.exit(0);
> > }
> >
> > - public void runTestAndPrintResult(IPerfTestRunner runner,
> > - final String name, int threadCount, String resultFile)
> > + public void runTestAndPrintResult(final IPerfTestRunner runner,
> > + final String name, final int threadCount, final String resultFile)
> > throws Exception {
> > - Histogram warmupHist = createHistogram();
> > + final Histogram warmupHist = createHistogram();
> >
> > // ThreadContext.put("aKey", "mdcVal");
> > println("Warming up the JVM...");
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> >
> > // warmup at least 2 rounds and at most 1 minute
> > final long stop = System.currentTimeMillis() + (60 * 1000);
> > @@ -124,46 +124,46 @@ public class PerfTest {
> > runSingleThreadedTest(runner, name, resultFile);
> > }
> >
> > - private int runSingleThreadedTest(IPerfTestRunner runner, String name,
> > - String resultFile) throws IOException {
> > - Histogram latency = createHistogram();
> > + private int runSingleThreadedTest(final IPerfTestRunner runner, final String name,
> > + final String resultFile) throws IOException {
> > + final Histogram latency = createHistogram();
> > final int LINES = throughput ? 50000 : 5000000;
> > runTest(runner, LINES, "end", latency, 1);
> > reportResult(resultFile, name, latency);
> > return LINES;
> > }
> >
> > - static void reportResult(String file, String name, Histogram histogram)
> > + static void reportResult(final String file, final String name, final Histogram histogram)
> > throws IOException {
> > - String result = createSamplingReport(name, histogram);
> > + final String result = createSamplingReport(name, histogram);
> > println(result);
> >
> > if (file != null) {
> > - FileWriter writer = new FileWriter(file, true);
> > + final FileWriter writer = new FileWriter(file, true);
> > writer.write(result);
> > writer.write(System.getProperty("line.separator"));
> > writer.close();
> > }
> > }
> >
> > - static void printf(String msg, Object... objects) {
> > + static void printf(final String msg, final Object... objects) {
> > if (verbose) {
> > System.out.printf(msg, objects);
> > }
> > }
> >
> > - static void println(String msg) {
> > + static void println(final String msg) {
> > if (verbose) {
> > System.out.println(msg);
> > }
> > }
> >
> > - static String createSamplingReport(String name, Histogram histogram) {
> > - Histogram data = histogram;
> > + static String createSamplingReport(final String name, final Histogram histogram) {
> > + final Histogram data = histogram;
> > if (throughput) {
> > return data.getMax() + " operations/second";
> > }
> > - String result = String.format(
> > + final String result = String.format(
> > "avg=%.0f 99%%=%d 99.99%%=%d sampleCount=%d", data.getMean(), //
> > data.getTwoNinesUpperBound(), //
> > data.getFourNinesUpperBound(), //
> > @@ -172,12 +172,12 @@ public class PerfTest {
> > return result;
> > }
> >
> > - public void runTest(IPerfTestRunner runner, int lines, String finalMessage,
> > - Histogram histogram, int threadCount) {
> > + public void runTest(final IPerfTestRunner runner, final int lines, final String finalMessage,
> > + final Histogram histogram, final int threadCount) {
> > if (throughput) {
> > runner.runThroughputTest(lines, histogram);
> > } else {
> > - long nanoTimeCost = calcNanoTimeCost();
> > + final long nanoTimeCost = calcNanoTimeCost();
> > runner.runLatencyTest(lines, histogram, nanoTimeCost, threadCount);
> > }
> > if (finalMessage != null) {
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java Tue Jul 9 06:08:25 2013
> > @@ -41,19 +41,19 @@ public class PerfTestDriver {
> > * Defines the setup for a java process running a performance test.
> > */
> > static class Setup implements Comparable<Setup> {
> > - private Class<?> _class;
> > - private String _log4jConfig;
> > - private String _name;
> > - private String[] _systemProperties;
> > - private int _threadCount;
> > - private File _temp;
> > + private final Class<?> _class;
> > + private final String _log4jConfig;
> > + private final String _name;
> > + private final String[] _systemProperties;
> > + private final int _threadCount;
> > + private final File _temp;
> > public Stats _stats;
> > - private WaitStrategy _wait;
> > - private String _runner;
> > + private final WaitStrategy _wait;
> > + private final String _runner;
> >
> > - public Setup(Class<?> klass, String runner, String name,
> > - String log4jConfig, int threadCount, WaitStrategy wait,
> > - String... systemProperties) throws IOException {
> > + public Setup(final Class<?> klass, final String runner, final String name,
> > + final String log4jConfig, final int threadCount, final WaitStrategy wait,
> > + final String... systemProperties) throws IOException {
> > _class = klass;
> > _runner = runner;
> > _name = name;
> > @@ -64,8 +64,8 @@ public class PerfTestDriver {
> > _temp = File.createTempFile("log4jperformance", ".txt");
> > }
> >
> > - List<String> processArguments(String java) {
> > - List<String> args = new ArrayList<String>();
> > + List<String> processArguments(final String java) {
> > + final List<String> args = new ArrayList<String>();
> > args.add(java);
> > args.add("-server");
> > args.add("-Xms1g");
> > @@ -84,7 +84,7 @@ public class PerfTestDriver {
> > args.add("-Dlog4j.configurationFile=" + _log4jConfig); // log4j 2
> > args.add("-Dlogback.configurationFile=" + _log4jConfig);// logback
> >
> > - int ringBufferSize = getUserSpecifiedRingBufferSize();
> > + final int ringBufferSize = getUserSpecifiedRingBufferSize();
> > if (ringBufferSize >= 128) {
> > args.add("-DAsyncLoggerConfig.RingBufferSize=" + ringBufferSize);
> > args.add("-DAsyncLogger.RingBufferSize=" + ringBufferSize);
> > @@ -108,23 +108,23 @@ public class PerfTestDriver {
> > try {
> > return Integer.parseInt(System.getProperty("RingBufferSize",
> > "-1"));
> > - } catch (Exception ignored) {
> > + } catch (final Exception ignored) {
> > return -1;
> > }
> > }
> >
> > - ProcessBuilder latencyTest(String java) {
> > + ProcessBuilder latencyTest(final String java) {
> > return new ProcessBuilder(processArguments(java));
> > }
> >
> > - ProcessBuilder throughputTest(String java) {
> > - List<String> args = processArguments(java);
> > + ProcessBuilder throughputTest(final String java) {
> > + final List<String> args = processArguments(java);
> > args.add("-throughput");
> > return new ProcessBuilder(args);
> > }
> >
> > @Override
> > - public int compareTo(Setup other) {
> > + public int compareTo(final Setup other) {
> > // largest ops/sec first
> > return (int) Math.signum(other._stats._averageOpsPerSec
> > - _stats._averageOpsPerSec);
> > @@ -137,7 +137,7 @@ public class PerfTestDriver {
> > } else if (MTPerfTest.class == _class) {
> > detail = _threadCount + " threads";
> > }
> > - String target = _runner.substring(_runner.indexOf(".Run") + 4);
> > + final String target = _runner.substring(_runner.indexOf(".Run") + 4);
> > return target + ": " + _name + " (" + detail + ")";
> > }
> > }
> > @@ -152,16 +152,16 @@ public class PerfTestDriver {
> > long _pct99_99;
> > double _latencyRowCount;
> > int _throughputRowCount;
> > - private long _averageOpsPerSec;
> > + private final long _averageOpsPerSec;
> >
> > // example line: avg=828 99%=1118 99.99%=5028 Count=3125
> > - public Stats(String raw) {
> > - String[] lines = raw.split("[\\r\\n]+");
> > + public Stats(final String raw) {
> > + final String[] lines = raw.split("[\\r\\n]+");
> > long totalOps = 0;
> > - for (String line : lines) {
> > + for (final String line : lines) {
> > if (line.startsWith("avg")) {
> > _latencyRowCount++;
> > - String[] parts = line.split(" ");
> > + final String[] parts = line.split(" ");
> > int i = 0;
> > _average += Long.parseLong(parts[i++].split("=")[1]);
> > _pct99 += Long.parseLong(parts[i++].split("=")[1]);
> > @@ -169,8 +169,8 @@ public class PerfTestDriver {
> > _count += Integer.parseInt(parts[i].split("=")[1]);
> > } else {
> > _throughputRowCount++;
> > - String number = line.substring(0, line.indexOf(' '));
> > - long opsPerSec = Long.parseLong(number);
> > + final String number = line.substring(0, line.indexOf(' '));
> > + final long opsPerSec = Long.parseLong(number);
> > totalOps += opsPerSec;
> > }
> > }
> > @@ -179,7 +179,7 @@ public class PerfTestDriver {
> >
> > @Override
> > public String toString() {
> > - String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> > + final String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> > return String.format(fmt, _averageOpsPerSec, //
> > _average / _latencyRowCount, // mean latency
> > _pct99 / _latencyRowCount, // 99% observations less than
> > @@ -189,24 +189,24 @@ public class PerfTestDriver {
> > }
> >
> > // single-threaded performance test
> > - private static Setup s(String config, String runner, String name,
> > - String... systemProperties) throws IOException {
> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > + private static Setup s(final String config, final String runner, final String name,
> > + final String... systemProperties) throws IOException {
> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > "WaitStrategy", "Sleep"));
> > return new Setup(PerfTest.class, runner, name, config, 1, wait,
> > systemProperties);
> > }
> >
> > // multi-threaded performance test
> > - private static Setup m(String config, String runner, String name,
> > - int threadCount, String... systemProperties) throws IOException {
> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > + private static Setup m(final String config, final String runner, final String name,
> > + final int threadCount, final String... systemProperties) throws IOException {
> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > "WaitStrategy", "Sleep"));
> > return new Setup(MTPerfTest.class, runner, name, config, threadCount,
> > wait, systemProperties);
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > final String ALL_ASYNC = "-DLog4jContextSelector="
> > + AsyncLoggerContextSelector.class.getName();
> > final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
> > @@ -215,8 +215,8 @@ public class PerfTestDriver {
> > final String LOG20 = RunLog4j2.class.getName();
> > final String LOGBK = RunLogback.class.getName();
> >
> > - long start = System.nanoTime();
> > - List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> > + final long start = System.nanoTime();
> > + final List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> > // includeLocation=false
> > tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
> > ALL_ASYNC, SYSCLOCK));
> > @@ -285,29 +285,29 @@ public class PerfTestDriver {
> > // "RollFastFileAppender", i));
> > }
> >
> > - String java = args.length > 0 ? args[0] : "java";
> > - int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
> > + final String java = args.length > 0 ? args[0] : "java";
> > + final int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
> > int x = 0;
> > - for (Setup config : tests) {
> > + for (final Setup config : tests) {
> > System.out.print(config.description());
> > - ProcessBuilder pb = config.throughputTest(java);
> > + final ProcessBuilder pb = config.throughputTest(java);
> > pb.redirectErrorStream(true); // merge System.out and System.err
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> > // int count = config._threadCount >= 16 ? 2 : repeat;
> > runPerfTest(repeat, x++, config, pb);
> > System.out.printf(" took %.1f seconds%n", (System.nanoTime() - t1)
> > / (1000.0 * 1000.0 * 1000.0));
> >
> > - FileReader reader = new FileReader(config._temp);
> > - CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> > + final FileReader reader = new FileReader(config._temp);
> > + final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> > reader.read(buffer);
> > reader.close();
> > config._temp.delete();
> > buffer.flip();
> >
> > - String raw = buffer.toString();
> > + final String raw = buffer.toString();
> > System.out.print(raw);
> > - Stats stats = new Stats(raw);
> > + final Stats stats = new Stats(raw);
> > System.out.println(stats);
> > System.out.println("-----");
> > config._stats = stats;
> > @@ -321,19 +321,19 @@ public class PerfTestDriver {
> > printRanking(tests.toArray(new Setup[tests.size()]));
> > }
> >
> > - private static void printRanking(Setup[] tests) {
> > + private static void printRanking(final Setup[] tests) {
> > System.out.println();
> > System.out.println("Ranking:");
> > Arrays.sort(tests);
> > for (int i = 0; i < tests.length; i++) {
> > - Setup setup = tests[i];
> > + final Setup setup = tests[i];
> > System.out.println((i + 1) + ". " + setup.description() + ": "
> > + setup._stats);
> > }
> > }
> >
> > - private static void runPerfTest(int repeat, int setupIndex, Setup config,
> > - ProcessBuilder pb) throws IOException, InterruptedException {
> > + private static void runPerfTest(final int repeat, final int setupIndex, final Setup config,
> > + final ProcessBuilder pb) throws IOException, InterruptedException {
> > for (int i = 0; i < repeat; i++) {
> > System.out.print(" (" + (i + 1) + "/" + repeat + ")...");
> > final Process process = pb.start();
> > @@ -343,7 +343,7 @@ public class PerfTestDriver {
> > process.waitFor();
> > stop[0] = true;
> >
> > - File gc = new File("gc" + setupIndex + "_" + i
> > + final File gc = new File("gc" + setupIndex + "_" + i
> > + config._log4jConfig + ".log");
> > if (gc.exists()) {
> > gc.delete();
> > @@ -355,17 +355,17 @@ public class PerfTestDriver {
> > private static Thread printProcessOutput(final Process process,
> > final boolean[] stop) {
> >
> > - Thread t = new Thread("OutputWriter") {
> > + final Thread t = new Thread("OutputWriter") {
> > @Override
> > public void run() {
> > - BufferedReader in = new BufferedReader(new InputStreamReader(
> > + final BufferedReader in = new BufferedReader(new InputStreamReader(
> > process.getInputStream()));
> > try {
> > String line = null;
> > while (!stop[0] && (line = in.readLine()) != null) {
> > System.out.println(line);
> > }
> > - } catch (Exception ignored) {
> > + } catch (final Exception ignored) {
> > }
> > }
> > };
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java Tue Jul 9 06:08:25 2013
> > @@ -42,7 +42,7 @@ class PerfTestResultFormatter {
> > double latency99Pct;
> > double latency99_99Pct;
> >
> > - Stats(String throughput, String avg, String lat99, String lat99_99)
> > + Stats(final String throughput, final String avg, final String lat99, final String lat99_99)
> > throws ParseException {
> > this.throughput = NUM.parse(throughput.trim()).longValue();
> > this.avgLatency = Double.parseDouble(avg.trim());
> > @@ -51,40 +51,40 @@ class PerfTestResultFormatter {
> > }
> > }
> >
> > - private Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
> > + private final Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
> >
> > public PerfTestResultFormatter() {
> > }
> >
> > - public String format(String text) throws ParseException {
> > + public String format(final String text) throws ParseException {
> > results.clear();
> > - String[] lines = text.split("[\\r\\n]+");
> > - for (String line : lines) {
> > + final String[] lines = text.split("[\\r\\n]+");
> > + for (final String line : lines) {
> > process(line);
> > }
> > return latencyTable() + LF + throughputTable();
> > }
> >
> > private String latencyTable() {
> > - StringBuilder sb = new StringBuilder(4 * 1024);
> > - Set<String> subKeys = results.values().iterator().next().keySet();
> > - char[] tabs = new char[subKeys.size()];
> > + final StringBuilder sb = new StringBuilder(4 * 1024);
> > + final Set<String> subKeys = results.values().iterator().next().keySet();
> > + final char[] tabs = new char[subKeys.size()];
> > Arrays.fill(tabs, '\t');
> > - String sep = new String(tabs);
> > + final String sep = new String(tabs);
> > sb.append("\tAverage latency").append(sep).append("99% less than").append(sep).append("99.99% less than");
> > sb.append(LF);
> > for (int i = 0; i < 3; i++) {
> > - for (String subKey : subKeys) {
> > + for (final String subKey : subKeys) {
> > sb.append("\t").append(subKey);
> > }
> > }
> > sb.append(LF);
> > - for (String key : results.keySet()) {
> > + for (final String key : results.keySet()) {
> > sb.append(key);
> > for (int i = 0; i < 3; i++) {
> > - Map<String, Stats> sub = results.get(key);
> > - for (String subKey : sub.keySet()) {
> > - Stats stats = sub.get(subKey);
> > + final Map<String, Stats> sub = results.get(key);
> > + for (final String subKey : sub.keySet()) {
> > + final Stats stats = sub.get(subKey);
> > switch (i) {
> > case 0:
> > sb.append("\t").append((long) stats.avgLatency);
> > @@ -104,19 +104,19 @@ class PerfTestResultFormatter {
> > }
> >
> > private String throughputTable() {
> > - StringBuilder sb = new StringBuilder(4 * 1024);
> > - Set<String> subKeys = results.values().iterator().next().keySet();
> > + final StringBuilder sb = new StringBuilder(4 * 1024);
> > + final Set<String> subKeys = results.values().iterator().next().keySet();
> > sb.append("\tThroughput per thread (msg/sec)");
> > sb.append(LF);
> > - for (String subKey : subKeys) {
> > + for (final String subKey : subKeys) {
> > sb.append("\t").append(subKey);
> > }
> > sb.append(LF);
> > - for (String key : results.keySet()) {
> > + for (final String key : results.keySet()) {
> > sb.append(key);
> > - Map<String, Stats> sub = results.get(key);
> > - for (String subKey : sub.keySet()) {
> > - Stats stats = sub.get(subKey);
> > + final Map<String, Stats> sub = results.get(key);
> > + for (final String subKey : sub.keySet()) {
> > + final Stats stats = sub.get(subKey);
> > sb.append("\t").append(stats.throughput);
> > }
> > sb.append(LF);
> > @@ -124,19 +124,19 @@ class PerfTestResultFormatter {
> > return sb.toString();
> > }
> >
> > - private void process(String line) throws ParseException {
> > - String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
> > - String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
> > - String throughput = line.substring(line.indexOf("throughput: ")
> > + private void process(final String line) throws ParseException {
> > + final String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
> > + final String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
> > + final String throughput = line.substring(line.indexOf("throughput: ")
> > + "throughput: ".length(), line.indexOf(" ops"));
> > - String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
> > + final String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
> > line.indexOf(" 99%"));
> > - String pct99 = line.substring(
> > + final String pct99 = line.substring(
> > line.indexOf("99% < ") + "99% < ".length(),
> > line.indexOf(" 99.99%"));
> > - String pct99_99 = line.substring(line.indexOf("99.99% < ")
> > + final String pct99_99 = line.substring(line.indexOf("99.99% < ")
> > + "99.99% < ".length(), line.lastIndexOf('(') - 1);
> > - Stats stats = new Stats(throughput, avg, pct99, pct99_99);
> > + final Stats stats = new Stats(throughput, avg, pct99, pct99_99);
> > Map<String, Stats> map = results.get(key.trim());
> > if (map == null) {
> > map = new TreeMap<String, Stats>(sort());
> > @@ -156,9 +156,9 @@ class PerfTestResultFormatter {
> > "64 threads");
> >
> > @Override
> > - public int compare(String o1, String o2) {
> > - int i1 = expected.indexOf(o1);
> > - int i2 = expected.indexOf(o2);
> > + public int compare(final String o1, final String o2) {
> > + final int i1 = expected.indexOf(o1);
> > + final int i2 = expected.indexOf(o2);
> > if (i1 < 0 || i2 < 0) {
> > return o1.compareTo(o2);
> > }
> > @@ -167,9 +167,9 @@ class PerfTestResultFormatter {
> > };
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > - PerfTestResultFormatter fmt = new PerfTestResultFormatter();
> > - BufferedReader reader = new BufferedReader(new InputStreamReader(
> > + public static void main(final String[] args) throws Exception {
> > + final PerfTestResultFormatter fmt = new PerfTestResultFormatter();
> > + final BufferedReader reader = new BufferedReader(new InputStreamReader(
> > System.in));
> > String line;
> > while ((line = reader.readLine()) != null) {
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java Tue Jul 9 06:08:25 2013
> > @@ -24,32 +24,32 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLog4j1 implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -62,8 +62,8 @@ public class RunLog4j1 implements IPerfT
> > }
> >
> > @Override
> > - public void log(String finalMessage) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void log(final String finalMessage) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > logger.info(finalMessage);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java Tue Jul 9 06:08:25 2013
> > @@ -25,33 +25,33 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLog4j2 implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -66,8 +66,8 @@ public class RunLog4j2 implements IPerfT
> >
> >
> > @Override
> > - public void log(String finalMessage) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void log(final String finalMessage) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > logger.info(finalMessage);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java Tue Jul 9 06:08:25 2013
> > @@ -26,32 +26,32 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLogback implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -64,8 +64,8 @@ public class RunLogback implements IPerf
> > }
> >
> > @Override
> > - public void log(String msg) {
> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > + public void log(final String msg) {
> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > logger.info(msg);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java Tue Jul 9 06:08:25 2013
> > @@ -63,12 +63,12 @@ public class AdvertiserTest {
> > file.delete();
> > }
> >
> > - private void verifyExpectedEntriesAdvertised(Map<Object, Map<String, String>> entries) {
> > + private void verifyExpectedEntriesAdvertised(final Map<Object, Map<String, String>> entries) {
> > boolean foundFile1 = false;
> > boolean foundFile2 = false;
> > boolean foundSocket1 = false;
> > boolean foundSocket2 = false;
> > - for (Map<String, String>entry:entries.values()) {
> > + for (final Map<String, String>entry:entries.values()) {
> > if (foundFile1 && foundFile2 && foundSocket1 && foundSocket2) {
> > break;
> > }
> > @@ -103,7 +103,7 @@ public class AdvertiserTest {
> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> > ctx.stop();
> >
> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > assertTrue("Entries found: " + entries, entries.isEmpty());
> >
> > //reconfigure for subsequent testing
> > @@ -117,7 +117,7 @@ public class AdvertiserTest {
> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> > ctx.stop();
> >
> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > assertTrue("Entries found: " + entries, entries.isEmpty());
> >
> > ctx.start();
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java Tue Jul 9 06:08:25 2013
> > @@ -34,9 +34,9 @@ public class BaseConfigurationTest {
> > @Test
> > public void testMissingRootLogger() throws Exception {
> > PluginManager.addPackage("org.apache.logging.log4j.test.appender");
> > - LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
> > + final LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
> > final Logger logger = LogManager.getLogger("sample.Logger1");
> > - Configuration config = ctx.getConfiguration();
> > + final Configuration config = ctx.getConfiguration();
> > assertNotNull("Config not null", config);
> > // final String MISSINGROOT = "MissingRootTest";
> > // assertTrue("Incorrect Configuration. Expected " + MISSINGROOT + " but found " + config.getName(),
> > @@ -53,15 +53,15 @@ public class BaseConfigurationTest {
> > // only the sample logger, no root logger in loggerMap!
> > assertTrue("contains key=sample", loggerMap.containsKey("sample"));
> >
> > - LoggerConfig sample = loggerMap.get("sample");
> > - Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
> > + final LoggerConfig sample = loggerMap.get("sample");
> > + final Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
> > assertEquals("sampleAppenders Size", 1, sampleAppenders.size());
> > // sample only has List appender, not Console!
> > assertTrue("sample has appender List", sampleAppenders.containsKey("List"));
> >
> > - BaseConfiguration baseConfig = (BaseConfiguration) config;
> > - LoggerConfig root = baseConfig.getRootLogger();
> > - Map<String, Appender<?>> rootAppenders = root.getAppenders();
> > + final BaseConfiguration baseConfig = (BaseConfiguration) config;
> > + final LoggerConfig root = baseConfig.getRootLogger();
> > + final Map<String, Appender<?>> rootAppenders = root.getAppenders();
> > assertEquals("rootAppenders Size", 1, rootAppenders.size());
> > // root only has Console appender!
> > assertTrue("root has appender Console", rootAppenders.containsKey("Console"));
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java Tue Jul 9 06:08:25 2013
> > @@ -28,20 +28,20 @@ public class InMemoryAdvertiser implemen
> >
> > public static Map<Object, Map<String, String>> getAdvertisedEntries()
> > {
> > - Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
> > + final Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
> > result.putAll(properties);
> > return result;
> > }
> >
> > @Override
> > - public Object advertise(Map<String, String> newEntry) {
> > - Object object = new Object();
> > + public Object advertise(final Map<String, String> newEntry) {
> > + final Object object = new Object();
> > properties.put(object, new HashMap<String, String>(newEntry));
> > return object;
> > }
> >
> > @Override
> > - public void unadvertise(Object advertisedObject) {
> > + public void unadvertise(final Object advertisedObject) {
> > properties.remove(advertisedObject);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java Tue Jul 9 06:08:25 2013
> > @@ -189,24 +189,24 @@ public class TestConfigurator {
> > public void testEnvironment() throws Exception {
> > final LoggerContext ctx = Configurator.initialize("-config", null, (String) null);
> > final Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
> > - Configuration config = ctx.getConfiguration();
> > + final Configuration config = ctx.getConfiguration();
> > assertNotNull("No configuration", config);
> > assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
> > CONFIG_NAME.equals(config.getName()));
> > final Map<String, Appender<?>> map = config.getAppenders();
> > assertNotNull("No Appenders", map != null && map.size() > 0);
> > Appender<?> app = null;
> > - for (Map.Entry<String, Appender<?>> entry: map.entrySet()) {
> > + for (final Map.Entry<String, Appender<?>> entry: map.entrySet()) {
> > if (entry.getKey().equals("List2")) {
> > app = entry.getValue();
> > break;
> > }
> > }
> > assertNotNull("No ListAppender named List2", app);
> > - Layout layout = app.getLayout();
> > + final Layout layout = app.getLayout();
> > assertNotNull("Appender List2 does not have a Layout", layout);
> > assertTrue("Appender List2 is not configured with a PatternLayout", layout instanceof PatternLayout);
> > - String pattern = ((PatternLayout) layout).getConversionPattern();
> > + final String pattern = ((PatternLayout) layout).getConversionPattern();
> > assertNotNull("No conversion pattern for List2 PatternLayout", pattern);
> > assertFalse("Environment variable was not substituted", pattern.startsWith("${env:PATH}"));
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java Tue Jul 9 06:08:25 2013
> > @@ -55,7 +55,7 @@ public class RegexFilterTest {
> >
> > @Test
> > public void TestNoMsg() {
> > - RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
> > + final RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
> > filter.start();
> > assertTrue(filter.isStarted());
> > assertTrue(filter.filter(null, Level.DEBUG, null, (String)null, (Throwable)null) == Filter.Result.DENY);
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
Re: svn commit: r1501104 [4/5] - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/ api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j/s...
Posted by Nick Williams <ni...@nicholaswilliams.net>.
Gotta be careful about that. ;-)
Nick
On Jul 9, 2013, at 3:33 PM, Gary Gregory wrote:
> woa, my IDE was picking up java 7 for my Log4j2 projects instead of Java 6...
>
> Gary
>
>
> On Tue, Jul 9, 2013 at 4:20 PM, Gary Gregory <ga...@gmail.com> wrote:
> Everything is compiling in Eclipse (Java 6) and Maven (Java 7) but I just read Nick's comment. I am running Maven on Java 6 as I write this...
>
> Gary
>
>
> On Tue, Jul 9, 2013 at 4:10 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> After fixing the prior compiler error I then ran into this one:
>
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project log4j-core: Compilation failure
> [ERROR] /Users/rgoers/projects/apache/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java:[177,13] variable _averageOpsPerSec might already have been assigned
>
> Can you please compile and test before committing?
>
> Ralph
>
> On Jul 8, 2013, at 11:08 PM, ggregory@apache.org wrote:
>
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -41,7 +41,7 @@ public class ContextStackAttributeConver
> >
> > @Test
> > public void testConvertToDatabaseColumn01() {
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("value1", "another2"));
> >
> > assertEquals("The converted value is not correct.", "value1\nanother2",
> > @@ -50,7 +50,7 @@ public class ContextStackAttributeConver
> >
> > @Test
> > public void testConvertToDatabaseColumn02() {
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("key1", "value2", "my3"));
> >
> > assertEquals("The converted value is not correct.",
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -42,14 +42,14 @@ public class ContextStackJsonAttributeCo
> > @Test
> > public void testConvert01() {
> > ThreadContext.clearStack();
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("value1", "another2"));
> >
> > - String converted = this.converter.convertToDatabaseColumn(stack);
> > + final String converted = this.converter.convertToDatabaseColumn(stack);
> >
> > assertNotNull("The converted value should not be null.", converted);
> >
> > - ThreadContext.ContextStack reversed = this.converter
> > + final ThreadContext.ContextStack reversed = this.converter
> > .convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > @@ -60,14 +60,14 @@ public class ContextStackJsonAttributeCo
> > @Test
> > public void testConvert02() {
> > ThreadContext.clearStack();
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("key1", "value2", "my3"));
> >
> > - String converted = this.converter.convertToDatabaseColumn(stack);
> > + final String converted = this.converter.convertToDatabaseColumn(stack);
> >
> > assertNotNull("The converted value should not be null.", converted);
> >
> > - ThreadContext.ContextStack reversed = this.converter
> > + final ThreadContext.ContextStack reversed = this.converter
> > .convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -39,14 +39,14 @@ public class MarkerAttributeConverterTes
> >
> > @Test
> > public void testConvert01() {
> > - Marker marker = MarkerManager.getMarker("testConvert01");
> > + final Marker marker = MarkerManager.getMarker("testConvert01");
> >
> > - String converted = this.converter.convertToDatabaseColumn(marker);
> > + final String converted = this.converter.convertToDatabaseColumn(marker);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "testConvert01", converted);
> >
> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "testConvert01", marker.getName());
> > @@ -54,19 +54,19 @@ public class MarkerAttributeConverterTes
> >
> > @Test
> > public void testConvert02() {
> > - Marker marker = MarkerManager.getMarker("testConvert02",
> > + final Marker marker = MarkerManager.getMarker("testConvert02",
> > MarkerManager.getMarker("anotherConvert02",
> > MarkerManager.getMarker("finalConvert03")
> > )
> > );
> >
> > - String converted = this.converter.convertToDatabaseColumn(marker);
> > + final String converted = this.converter.convertToDatabaseColumn(marker);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "testConvert02[ anotherConvert02[ finalConvert03 ] ] ]",
> > converted);
> >
> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "testConvert02", marker.getName());
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -41,14 +41,14 @@ public class MessageAttributeConverterTe
> >
> > @Test
> > public void testConvert01() {
> > - Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
> > + final Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
> >
> > - String converted = this.converter.convertToDatabaseColumn(message);
> > + final String converted = this.converter.convertToDatabaseColumn(message);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "Message #3 said [Hello].", converted);
> >
> > - Message reversed = this.converter.convertToEntityAttribute(converted);
> > + final Message reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "Message #3 said [Hello].", reversed.getFormattedMessage());
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -37,15 +37,15 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert01() {
> > - StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
> > + final StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "TestNoPackage", reversed.getClassName());
> > @@ -57,17 +57,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert02() {
> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
> > "testConvert02", "TestWithPackage.java", -1);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "org.apache.logging.TestWithPackage", reversed.getClassName());
> > @@ -79,17 +79,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert03() {
> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
> > "testConvert03", null, -1);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestNoSource.testConvert03(Unknown Source)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "org.apache.logging.TestNoSource", reversed.getClassName());
> > @@ -101,17 +101,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert04() {
> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
> > "testConvert04", null, -2);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "org.apache.logging.TestIsNativeMethod",
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -39,16 +39,16 @@ public class ThrowableAttributeConverter
> >
> > @Test
> > public void testConvert01() {
> > - RuntimeException exception = new RuntimeException("My message 01.");
> > + final RuntimeException exception = new RuntimeException("My message 01.");
> >
> > - String stackTrace = getStackTrace(exception);
> > + final String stackTrace = getStackTrace(exception);
> >
> > - String converted = this.converter.convertToDatabaseColumn(exception);
> > + final String converted = this.converter.convertToDatabaseColumn(exception);
> >
> > assertNotNull("The converted value is not correct.", converted);
> > assertEquals("The converted value is not correct.", stackTrace, converted);
> >
> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
> > @@ -56,18 +56,18 @@ public class ThrowableAttributeConverter
> >
> > @Test
> > public void testConvert02() {
> > - SQLException cause2 = new SQLException("This is a test cause.");
> > - Error cause1 = new Error(cause2);
> > - RuntimeException exception = new RuntimeException("My message 01.", cause1);
> > + final SQLException cause2 = new SQLException("This is a test cause.");
> > + final Error cause1 = new Error(cause2);
> > + final RuntimeException exception = new RuntimeException("My message 01.", cause1);
> >
> > - String stackTrace = getStackTrace(exception);
> > + final String stackTrace = getStackTrace(exception);
> >
> > - String converted = this.converter.convertToDatabaseColumn(exception);
> > + final String converted = this.converter.convertToDatabaseColumn(exception);
> >
> > assertNotNull("The converted value is not correct.", converted);
> > assertEquals("The converted value is not correct.", stackTrace, converted);
> >
> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
> > @@ -84,10 +84,10 @@ public class ThrowableAttributeConverter
> > assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
> > }
> >
> > - private static String getStackTrace(Throwable throwable) {
> > + private static String getStackTrace(final Throwable throwable) {
> > String returnValue = throwable.toString() + "\n";
> >
> > - for (StackTraceElement element : throwable.getStackTrace()) {
> > + for (final StackTraceElement element : throwable.getStackTrace()) {
> > returnValue += "\tat " + element.toString() + "\n";
> > }
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java Tue Jul 9 06:08:25 2013
> > @@ -51,7 +51,7 @@ public class MapRewritePolicyTest {
> > logEvent1 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ERROR,
> > new MapMessage(map), null, map, null, "none",
> > new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 29), 2);
> > - ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
> > + final ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
> > logEvent2 = new Log4jLogEvent("test", MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
> > Level.TRACE, new StructuredDataMessage("test", "Nothing", "test", map), new RuntimeException("test"), null,
> > stack, "none", new StackTraceElement("MapRewritePolicyTest",
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java Tue Jul 9 06:08:25 2013
> > @@ -112,7 +112,7 @@ public class RewriteAppenderTest {
> > StructuredDataMessage msg = new StructuredDataMessage("Test", "This is a test", "Service");
> > msg.put("Key1", "Value2");
> > msg.put("Key2", "Value1");
> > - Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> > + final Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> > logger.debug(msg);
> > msg = new StructuredDataMessage("Test", "This is a test", "Service");
> > msg.put("Key1", "Value1");
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java Tue Jul 9 06:08:25 2013
> > @@ -40,23 +40,23 @@ public class FastRollingFileManagerTest
> > */
> > @Test
> > public void testWrite_multiplesOfBufferSize() throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > - boolean append = false;
> > - boolean flushNow = false;
> > - long triggerSize = Long.MAX_VALUE;
> > - long time = System.currentTimeMillis();
> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > + final boolean append = false;
> > + final boolean flushNow = false;
> > + final long triggerSize = Long.MAX_VALUE;
> > + final long time = System.currentTimeMillis();
> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > triggerSize);
> > - RolloverStrategy rolloverStrategy = null;
> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
> > + final RolloverStrategy rolloverStrategy = null;
> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
> > file.getName(), "", os, append, flushNow, triggerSize, time,
> > triggerPolicy, rolloverStrategy, null, null);
> >
> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> > - byte[] data = new byte[size];
> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> > + final byte[] data = new byte[size];
> > manager.write(data, 0, data.length); // no buffer overflow exception
> >
> > // buffer is full but not flushed yet
> > @@ -71,23 +71,23 @@ public class FastRollingFileManagerTest
> > */
> > @Test
> > public void testWrite_dataExceedingBufferSize() throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > - boolean append = false;
> > - boolean flushNow = false;
> > - long triggerSize = 0;
> > - long time = System.currentTimeMillis();
> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > + final boolean append = false;
> > + final boolean flushNow = false;
> > + final long triggerSize = 0;
> > + final long time = System.currentTimeMillis();
> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > triggerSize);
> > - RolloverStrategy rolloverStrategy = null;
> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
> > + final RolloverStrategy rolloverStrategy = null;
> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
> > file.getName(), "", os, append, flushNow, triggerSize, time,
> > triggerPolicy, rolloverStrategy, null, null);
> >
> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
> > - byte[] data = new byte[size];
> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
> > + final byte[] data = new byte[size];
> > manager.write(data, 0, data.length); // no exception
> > assertEquals(FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3,
> > raf.length());
> > @@ -98,12 +98,12 @@ public class FastRollingFileManagerTest
> >
> > @Test
> > public void testAppendDoesNotOverwriteExistingFile() throws IOException {
> > - boolean isAppend = true;
> > - File file = File.createTempFile("log4j2", "test");
> > + final boolean isAppend = true;
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > assertEquals(0, file.length());
> >
> > - byte[] bytes = new byte[4 * 1024];
> > + final byte[] bytes = new byte[4 * 1024];
> >
> > // create existing file
> > FileOutputStream fos = null;
> > @@ -116,31 +116,31 @@ public class FastRollingFileManagerTest
> > }
> > assertEquals("all flushed to disk", bytes.length, file.length());
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> > new SizeBasedTriggeringPolicy(Long.MAX_VALUE), //
> > null, null, null);
> > manager.write(bytes, 0, bytes.length);
> > - int expected = bytes.length * 2;
> > + final int expected = bytes.length * 2;
> > assertEquals("appended, not overwritten", expected, file.length());
> > }
> >
> > @Test
> > public void testFileTimeBasedOnSystemClockWhenAppendIsFalse()
> > throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > LockSupport.parkNanos(1000000); // 1 millisec
> >
> > // append is false deletes the file if it exists
> > - boolean isAppend = false;
> > - long expectedMin = System.currentTimeMillis();
> > - long expectedMax = expectedMin + 50;
> > + final boolean isAppend = false;
> > + final long expectedMin = System.currentTimeMillis();
> > + final long expectedMax = expectedMin + 50;
> > assertTrue(file.lastModified() < expectedMin);
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> > @@ -153,14 +153,14 @@ public class FastRollingFileManagerTest
> > @Test
> > public void testFileTimeBasedOnFileModifiedTimeWhenAppendIsTrue()
> > throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > LockSupport.parkNanos(1000000); // 1 millisec
> >
> > - boolean isAppend = true;
> > + final boolean isAppend = true;
> > assertTrue(file.lastModified() < System.currentTimeMillis());
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java Tue Jul 9 06:08:25 2013
> > @@ -35,7 +35,7 @@ public class FileRenameActionTest {
> >
> > @BeforeClass
> > public static void beforeClass() throws Exception {
> > - File file = new File(DIR);
> > + final File file = new File(DIR);
> > file.mkdirs();
> > }
> >
> > @@ -51,15 +51,15 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testRename1() throws Exception {
> > - File file = new File("target/fileRename/fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("target/fileRename/fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > for (int i = 0; i < 100; ++i) {
> > pos.println("This is line " + i);
> > }
> > pos.close();
> >
> > - File dest = new File("target/fileRename/newFile.log");
> > - FileRenameAction action = new FileRenameAction(file, dest, false);
> > + final File dest = new File("target/fileRename/newFile.log");
> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", dest.exists());
> > assertTrue("Old file exists", !file.exists());
> > @@ -67,12 +67,12 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testEmpty() throws Exception {
> > - File file = new File("target/fileRename/fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("target/fileRename/fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > pos.close();
> >
> > - File dest = new File("target/fileRename/newFile.log");
> > - FileRenameAction action = new FileRenameAction(file, dest, false);
> > + final File dest = new File("target/fileRename/newFile.log");
> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", !dest.exists());
> > assertTrue("Old file does not exist", !file.exists());
> > @@ -81,16 +81,16 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testNoParent() throws Exception {
> > - File file = new File("fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > for (int i = 0; i < 100; ++i) {
> > pos.println("This is line " + i);
> > }
> > pos.close();
> >
> > - File dest = new File("newFile.log");
> > + final File dest = new File("newFile.log");
> > try {
> > - FileRenameAction action = new FileRenameAction(file, dest, false);
> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", dest.exists());
> > assertTrue("Old file exists", !file.exists());
> > @@ -98,7 +98,7 @@ public class FileRenameActionTest {
> > try {
> > dest.delete();
> > file.delete();
> > - } catch (Exception ex) {
> > + } catch (final Exception ex) {
> > System.out.println("Unable to cleanup files written to main directory");
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java Tue Jul 9 06:08:25 2013
> > @@ -39,17 +39,17 @@ public class AsyncLoggerConfigTest {
> >
> > @Test
> > public void testAdditivity() throws Exception {
> > - File f = new File("target", "AsyncLoggerConfigTest.log");
> > + final File f = new File("target", "AsyncLoggerConfigTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Additive logging: 2 for the price of 1!";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Additive logging: 2 for the price of 1!";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > - String line2 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
> > + final String line1 = reader.readLine();
> > + final String line2 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > @@ -57,7 +57,7 @@ public class AsyncLoggerConfigTest {
> > assertTrue("line1 correct", line1.contains(msg));
> > assertTrue("line2 correct", line2.contains(msg));
> >
> > - String location = "testAdditivity";
> > + final String location = "testAdditivity";
> > assertTrue("location",
> > line1.contains(location) || line2.contains(location));
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java Tue Jul 9 06:08:25 2013
> > @@ -29,24 +29,24 @@ public class AsyncLoggerContextSelectorT
> >
> > @Test
> > public void testContextReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false);
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null, false);
> >
> > assertTrue(context instanceof AsyncLoggerContext);
> > }
> >
> > @Test
> > public void testContext2ReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false, null);
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null, false, null);
> >
> > assertTrue(context instanceof AsyncLoggerContext);
> > }
> >
> > @Test
> > public void testLoggerContextsReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - List<LoggerContext> list = selector.getLoggerContexts();
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final List<LoggerContext> list = selector.getLoggerContexts();
> >
> > assertEquals(1, list.size());
> > assertTrue(list.get(0) instanceof AsyncLoggerContext);
> > @@ -54,8 +54,8 @@ public class AsyncLoggerContextSelectorT
> >
> > @Test
> > public void testContextNameIsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false);
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null, false);
> >
> > assertEquals("AsyncLoggerContext", context.getName());
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java Tue Jul 9 06:08:25 2013
> > @@ -30,7 +30,7 @@ public class AsyncLoggerContextTest {
> >
> > @Test
> > public void testNewInstanceReturnsAsyncLogger() {
> > - Logger logger = new AsyncLoggerContext("a").newInstance(
> > + final Logger logger = new AsyncLoggerContext("a").newInstance(
> > new LoggerContext("a"), "a", null);
> > assertTrue(logger instanceof AsyncLogger);
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java Tue Jul 9 06:08:25 2013
> > @@ -49,22 +49,22 @@ public class AsyncLoggerLocationTest {
> >
> > @Test
> > public void testAsyncLogWritesToLog() throws Exception {
> > - File f = new File("target", "AsyncLoggerLocationTest.log");
> > + final File f = new File("target", "AsyncLoggerLocationTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Async logger msg with location";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Async logger msg with location";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
> > + final String line1 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > assertTrue("line1 correct", line1.contains(msg));
> >
> > - String location = "testAsyncLogWritesToLog";
> > + final String location = "testAsyncLogWritesToLog";
> > assertTrue("has location", line1.contains(location));
> > }
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java Tue Jul 9 06:08:25 2013
> > @@ -49,22 +49,22 @@ public class AsyncLoggerTest {
> >
> > @Test
> > public void testAsyncLogWritesToLog() throws Exception {
> > - File f = new File("target", "AsyncLoggerTest.log");
> > + final File f = new File("target", "AsyncLoggerTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Async logger msg";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Async logger msg";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
> > + final String line1 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > assertTrue("line1 correct", line1.contains(msg));
> >
> > - String location = "testAsyncLogWritesToLog";
> > + final String location = "testAsyncLogWritesToLog";
> > assertTrue("no location", !line1.contains(location));
> > }
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java Tue Jul 9 06:08:25 2013
> > @@ -22,23 +22,23 @@ import com.lmax.disruptor.collections.Hi
> >
> > public class MTPerfTest extends PerfTest {
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > new MTPerfTest().doMain(args);
> > }
> >
> > @Override
> > public void runTestAndPrintResult(final IPerfTestRunner runner,
> > - final String name, final int threadCount, String resultFile)
> > + final String name, final int threadCount, final String resultFile)
> > throws Exception {
> >
> > // ThreadContext.put("aKey", "mdcVal");
> > PerfTest.println("Warming up the JVM...");
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> >
> > // warmup at least 2 rounds and at most 1 minute
> > final Histogram warmupHist = PerfTest.createHistogram();
> > final long stop = System.currentTimeMillis() + (60 * 1000);
> > - Runnable run1 = new Runnable() {
> > + final Runnable run1 = new Runnable() {
> > @Override
> > public void run() {
> > for (int i = 0; i < 10; i++) {
> > @@ -50,8 +50,8 @@ public class MTPerfTest extends PerfTest
> > }
> > }
> > };
> > - Thread thread1 = new Thread(run1);
> > - Thread thread2 = new Thread(run1);
> > + final Thread thread1 = new Thread(run1);
> > + final Thread thread2 = new Thread(run1);
> > thread1.start();
> > thread2.start();
> > thread1.join();
> > @@ -74,7 +74,7 @@ public class MTPerfTest extends PerfTest
> > }
> >
> > private void multiThreadedTestRun(final IPerfTestRunner runner,
> > - final String name, final int threadCount, String resultFile)
> > + final String name, final int threadCount, final String resultFile)
> > throws Exception {
> >
> > final Histogram[] histograms = new Histogram[threadCount];
> > @@ -83,28 +83,28 @@ public class MTPerfTest extends PerfTest
> > }
> > final int LINES = 256 * 1024;
> >
> > - Thread[] threads = new Thread[threadCount];
> > + final Thread[] threads = new Thread[threadCount];
> > for (int i = 0; i < threads.length; i++) {
> > final Histogram histogram = histograms[i];
> > threads[i] = new Thread() {
> > @Override
> > public void run() {
> > // int latencyCount = threadCount >= 16 ? 1000000 : 5000000;
> > - int latencyCount = 5000000;
> > - int count = PerfTest.throughput ? LINES / threadCount
> > + final int latencyCount = 5000000;
> > + final int count = PerfTest.throughput ? LINES / threadCount
> > : latencyCount;
> > runTest(runner, count, "end", histogram, threadCount);
> > }
> > };
> > }
> > - for (Thread thread : threads) {
> > + for (final Thread thread : threads) {
> > thread.start();
> > }
> > - for (Thread thread : threads) {
> > + for (final Thread thread : threads) {
> > thread.join();
> > }
> >
> > - for (Histogram histogram : histograms) {
> > + for (final Histogram histogram : histograms) {
> > PerfTest.reportResult(resultFile, name, histogram);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java Tue Jul 9 06:08:25 2013
> > @@ -33,7 +33,7 @@ public class PerfTest {
> > // determine how long it takes to call System.nanoTime() (on average)
> > static long calcNanoTimeCost() {
> > final long iterations = 10000000;
> > - long start = System.nanoTime();
> > + final long start = System.nanoTime();
> > long finish = start;
> >
> > for (int i = 0; i < iterations; i++) {
> > @@ -49,7 +49,7 @@ public class PerfTest {
> > }
> >
> > static Histogram createHistogram() {
> > - long[] intervals = new long[31];
> > + final long[] intervals = new long[31];
> > long intervalUpperBound = 1L;
> > for (int i = 0, size = intervals.length - 1; i < size; i++) {
> > intervalUpperBound *= 2;
> > @@ -60,17 +60,17 @@ public class PerfTest {
> > return new Histogram(intervals);
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > new PerfTest().doMain(args);
> > }
> >
> > - public void doMain(String[] args) throws Exception {
> > - String runnerClass = args[0];
> > - IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
> > + public void doMain(final String[] args) throws Exception {
> > + final String runnerClass = args[0];
> > + final IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
> > .newInstance();
> > - String name = args[1];
> > - String resultFile = args.length > 2 ? args[2] : null;
> > - for (String arg : args) {
> > + final String name = args[1];
> > + final String resultFile = args.length > 2 ? args[2] : null;
> > + for (final String arg : args) {
> > if (verbose && throughput) {
> > break;
> > }
> > @@ -81,7 +81,7 @@ public class PerfTest {
> > throughput = true;
> > }
> > }
> > - int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
> > + final int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
> > printf("Starting %s %s (%d)...%n", getClass().getSimpleName(), name,
> > threadCount);
> > runTestAndPrintResult(runner, name, threadCount, resultFile);
> > @@ -89,14 +89,14 @@ public class PerfTest {
> > System.exit(0);
> > }
> >
> > - public void runTestAndPrintResult(IPerfTestRunner runner,
> > - final String name, int threadCount, String resultFile)
> > + public void runTestAndPrintResult(final IPerfTestRunner runner,
> > + final String name, final int threadCount, final String resultFile)
> > throws Exception {
> > - Histogram warmupHist = createHistogram();
> > + final Histogram warmupHist = createHistogram();
> >
> > // ThreadContext.put("aKey", "mdcVal");
> > println("Warming up the JVM...");
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> >
> > // warmup at least 2 rounds and at most 1 minute
> > final long stop = System.currentTimeMillis() + (60 * 1000);
> > @@ -124,46 +124,46 @@ public class PerfTest {
> > runSingleThreadedTest(runner, name, resultFile);
> > }
> >
> > - private int runSingleThreadedTest(IPerfTestRunner runner, String name,
> > - String resultFile) throws IOException {
> > - Histogram latency = createHistogram();
> > + private int runSingleThreadedTest(final IPerfTestRunner runner, final String name,
> > + final String resultFile) throws IOException {
> > + final Histogram latency = createHistogram();
> > final int LINES = throughput ? 50000 : 5000000;
> > runTest(runner, LINES, "end", latency, 1);
> > reportResult(resultFile, name, latency);
> > return LINES;
> > }
> >
> > - static void reportResult(String file, String name, Histogram histogram)
> > + static void reportResult(final String file, final String name, final Histogram histogram)
> > throws IOException {
> > - String result = createSamplingReport(name, histogram);
> > + final String result = createSamplingReport(name, histogram);
> > println(result);
> >
> > if (file != null) {
> > - FileWriter writer = new FileWriter(file, true);
> > + final FileWriter writer = new FileWriter(file, true);
> > writer.write(result);
> > writer.write(System.getProperty("line.separator"));
> > writer.close();
> > }
> > }
> >
> > - static void printf(String msg, Object... objects) {
> > + static void printf(final String msg, final Object... objects) {
> > if (verbose) {
> > System.out.printf(msg, objects);
> > }
> > }
> >
> > - static void println(String msg) {
> > + static void println(final String msg) {
> > if (verbose) {
> > System.out.println(msg);
> > }
> > }
> >
> > - static String createSamplingReport(String name, Histogram histogram) {
> > - Histogram data = histogram;
> > + static String createSamplingReport(final String name, final Histogram histogram) {
> > + final Histogram data = histogram;
> > if (throughput) {
> > return data.getMax() + " operations/second";
> > }
> > - String result = String.format(
> > + final String result = String.format(
> > "avg=%.0f 99%%=%d 99.99%%=%d sampleCount=%d", data.getMean(), //
> > data.getTwoNinesUpperBound(), //
> > data.getFourNinesUpperBound(), //
> > @@ -172,12 +172,12 @@ public class PerfTest {
> > return result;
> > }
> >
> > - public void runTest(IPerfTestRunner runner, int lines, String finalMessage,
> > - Histogram histogram, int threadCount) {
> > + public void runTest(final IPerfTestRunner runner, final int lines, final String finalMessage,
> > + final Histogram histogram, final int threadCount) {
> > if (throughput) {
> > runner.runThroughputTest(lines, histogram);
> > } else {
> > - long nanoTimeCost = calcNanoTimeCost();
> > + final long nanoTimeCost = calcNanoTimeCost();
> > runner.runLatencyTest(lines, histogram, nanoTimeCost, threadCount);
> > }
> > if (finalMessage != null) {
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java Tue Jul 9 06:08:25 2013
> > @@ -41,19 +41,19 @@ public class PerfTestDriver {
> > * Defines the setup for a java process running a performance test.
> > */
> > static class Setup implements Comparable<Setup> {
> > - private Class<?> _class;
> > - private String _log4jConfig;
> > - private String _name;
> > - private String[] _systemProperties;
> > - private int _threadCount;
> > - private File _temp;
> > + private final Class<?> _class;
> > + private final String _log4jConfig;
> > + private final String _name;
> > + private final String[] _systemProperties;
> > + private final int _threadCount;
> > + private final File _temp;
> > public Stats _stats;
> > - private WaitStrategy _wait;
> > - private String _runner;
> > + private final WaitStrategy _wait;
> > + private final String _runner;
> >
> > - public Setup(Class<?> klass, String runner, String name,
> > - String log4jConfig, int threadCount, WaitStrategy wait,
> > - String... systemProperties) throws IOException {
> > + public Setup(final Class<?> klass, final String runner, final String name,
> > + final String log4jConfig, final int threadCount, final WaitStrategy wait,
> > + final String... systemProperties) throws IOException {
> > _class = klass;
> > _runner = runner;
> > _name = name;
> > @@ -64,8 +64,8 @@ public class PerfTestDriver {
> > _temp = File.createTempFile("log4jperformance", ".txt");
> > }
> >
> > - List<String> processArguments(String java) {
> > - List<String> args = new ArrayList<String>();
> > + List<String> processArguments(final String java) {
> > + final List<String> args = new ArrayList<String>();
> > args.add(java);
> > args.add("-server");
> > args.add("-Xms1g");
> > @@ -84,7 +84,7 @@ public class PerfTestDriver {
> > args.add("-Dlog4j.configurationFile=" + _log4jConfig); // log4j 2
> > args.add("-Dlogback.configurationFile=" + _log4jConfig);// logback
> >
> > - int ringBufferSize = getUserSpecifiedRingBufferSize();
> > + final int ringBufferSize = getUserSpecifiedRingBufferSize();
> > if (ringBufferSize >= 128) {
> > args.add("-DAsyncLoggerConfig.RingBufferSize=" + ringBufferSize);
> > args.add("-DAsyncLogger.RingBufferSize=" + ringBufferSize);
> > @@ -108,23 +108,23 @@ public class PerfTestDriver {
> > try {
> > return Integer.parseInt(System.getProperty("RingBufferSize",
> > "-1"));
> > - } catch (Exception ignored) {
> > + } catch (final Exception ignored) {
> > return -1;
> > }
> > }
> >
> > - ProcessBuilder latencyTest(String java) {
> > + ProcessBuilder latencyTest(final String java) {
> > return new ProcessBuilder(processArguments(java));
> > }
> >
> > - ProcessBuilder throughputTest(String java) {
> > - List<String> args = processArguments(java);
> > + ProcessBuilder throughputTest(final String java) {
> > + final List<String> args = processArguments(java);
> > args.add("-throughput");
> > return new ProcessBuilder(args);
> > }
> >
> > @Override
> > - public int compareTo(Setup other) {
> > + public int compareTo(final Setup other) {
> > // largest ops/sec first
> > return (int) Math.signum(other._stats._averageOpsPerSec
> > - _stats._averageOpsPerSec);
> > @@ -137,7 +137,7 @@ public class PerfTestDriver {
> > } else if (MTPerfTest.class == _class) {
> > detail = _threadCount + " threads";
> > }
> > - String target = _runner.substring(_runner.indexOf(".Run") + 4);
> > + final String target = _runner.substring(_runner.indexOf(".Run") + 4);
> > return target + ": " + _name + " (" + detail + ")";
> > }
> > }
> > @@ -152,16 +152,16 @@ public class PerfTestDriver {
> > long _pct99_99;
> > double _latencyRowCount;
> > int _throughputRowCount;
> > - private long _averageOpsPerSec;
> > + private final long _averageOpsPerSec;
> >
> > // example line: avg=828 99%=1118 99.99%=5028 Count=3125
> > - public Stats(String raw) {
> > - String[] lines = raw.split("[\\r\\n]+");
> > + public Stats(final String raw) {
> > + final String[] lines = raw.split("[\\r\\n]+");
> > long totalOps = 0;
> > - for (String line : lines) {
> > + for (final String line : lines) {
> > if (line.startsWith("avg")) {
> > _latencyRowCount++;
> > - String[] parts = line.split(" ");
> > + final String[] parts = line.split(" ");
> > int i = 0;
> > _average += Long.parseLong(parts[i++].split("=")[1]);
> > _pct99 += Long.parseLong(parts[i++].split("=")[1]);
> > @@ -169,8 +169,8 @@ public class PerfTestDriver {
> > _count += Integer.parseInt(parts[i].split("=")[1]);
> > } else {
> > _throughputRowCount++;
> > - String number = line.substring(0, line.indexOf(' '));
> > - long opsPerSec = Long.parseLong(number);
> > + final String number = line.substring(0, line.indexOf(' '));
> > + final long opsPerSec = Long.parseLong(number);
> > totalOps += opsPerSec;
> > }
> > }
> > @@ -179,7 +179,7 @@ public class PerfTestDriver {
> >
> > @Override
> > public String toString() {
> > - String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> > + final String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> > return String.format(fmt, _averageOpsPerSec, //
> > _average / _latencyRowCount, // mean latency
> > _pct99 / _latencyRowCount, // 99% observations less than
> > @@ -189,24 +189,24 @@ public class PerfTestDriver {
> > }
> >
> > // single-threaded performance test
> > - private static Setup s(String config, String runner, String name,
> > - String... systemProperties) throws IOException {
> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > + private static Setup s(final String config, final String runner, final String name,
> > + final String... systemProperties) throws IOException {
> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > "WaitStrategy", "Sleep"));
> > return new Setup(PerfTest.class, runner, name, config, 1, wait,
> > systemProperties);
> > }
> >
> > // multi-threaded performance test
> > - private static Setup m(String config, String runner, String name,
> > - int threadCount, String... systemProperties) throws IOException {
> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > + private static Setup m(final String config, final String runner, final String name,
> > + final int threadCount, final String... systemProperties) throws IOException {
> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > "WaitStrategy", "Sleep"));
> > return new Setup(MTPerfTest.class, runner, name, config, threadCount,
> > wait, systemProperties);
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > final String ALL_ASYNC = "-DLog4jContextSelector="
> > + AsyncLoggerContextSelector.class.getName();
> > final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
> > @@ -215,8 +215,8 @@ public class PerfTestDriver {
> > final String LOG20 = RunLog4j2.class.getName();
> > final String LOGBK = RunLogback.class.getName();
> >
> > - long start = System.nanoTime();
> > - List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> > + final long start = System.nanoTime();
> > + final List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> > // includeLocation=false
> > tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
> > ALL_ASYNC, SYSCLOCK));
> > @@ -285,29 +285,29 @@ public class PerfTestDriver {
> > // "RollFastFileAppender", i));
> > }
> >
> > - String java = args.length > 0 ? args[0] : "java";
> > - int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
> > + final String java = args.length > 0 ? args[0] : "java";
> > + final int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
> > int x = 0;
> > - for (Setup config : tests) {
> > + for (final Setup config : tests) {
> > System.out.print(config.description());
> > - ProcessBuilder pb = config.throughputTest(java);
> > + final ProcessBuilder pb = config.throughputTest(java);
> > pb.redirectErrorStream(true); // merge System.out and System.err
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> > // int count = config._threadCount >= 16 ? 2 : repeat;
> > runPerfTest(repeat, x++, config, pb);
> > System.out.printf(" took %.1f seconds%n", (System.nanoTime() - t1)
> > / (1000.0 * 1000.0 * 1000.0));
> >
> > - FileReader reader = new FileReader(config._temp);
> > - CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> > + final FileReader reader = new FileReader(config._temp);
> > + final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> > reader.read(buffer);
> > reader.close();
> > config._temp.delete();
> > buffer.flip();
> >
> > - String raw = buffer.toString();
> > + final String raw = buffer.toString();
> > System.out.print(raw);
> > - Stats stats = new Stats(raw);
> > + final Stats stats = new Stats(raw);
> > System.out.println(stats);
> > System.out.println("-----");
> > config._stats = stats;
> > @@ -321,19 +321,19 @@ public class PerfTestDriver {
> > printRanking(tests.toArray(new Setup[tests.size()]));
> > }
> >
> > - private static void printRanking(Setup[] tests) {
> > + private static void printRanking(final Setup[] tests) {
> > System.out.println();
> > System.out.println("Ranking:");
> > Arrays.sort(tests);
> > for (int i = 0; i < tests.length; i++) {
> > - Setup setup = tests[i];
> > + final Setup setup = tests[i];
> > System.out.println((i + 1) + ". " + setup.description() + ": "
> > + setup._stats);
> > }
> > }
> >
> > - private static void runPerfTest(int repeat, int setupIndex, Setup config,
> > - ProcessBuilder pb) throws IOException, InterruptedException {
> > + private static void runPerfTest(final int repeat, final int setupIndex, final Setup config,
> > + final ProcessBuilder pb) throws IOException, InterruptedException {
> > for (int i = 0; i < repeat; i++) {
> > System.out.print(" (" + (i + 1) + "/" + repeat + ")...");
> > final Process process = pb.start();
> > @@ -343,7 +343,7 @@ public class PerfTestDriver {
> > process.waitFor();
> > stop[0] = true;
> >
> > - File gc = new File("gc" + setupIndex + "_" + i
> > + final File gc = new File("gc" + setupIndex + "_" + i
> > + config._log4jConfig + ".log");
> > if (gc.exists()) {
> > gc.delete();
> > @@ -355,17 +355,17 @@ public class PerfTestDriver {
> > private static Thread printProcessOutput(final Process process,
> > final boolean[] stop) {
> >
> > - Thread t = new Thread("OutputWriter") {
> > + final Thread t = new Thread("OutputWriter") {
> > @Override
> > public void run() {
> > - BufferedReader in = new BufferedReader(new InputStreamReader(
> > + final BufferedReader in = new BufferedReader(new InputStreamReader(
> > process.getInputStream()));
> > try {
> > String line = null;
> > while (!stop[0] && (line = in.readLine()) != null) {
> > System.out.println(line);
> > }
> > - } catch (Exception ignored) {
> > + } catch (final Exception ignored) {
> > }
> > }
> > };
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java Tue Jul 9 06:08:25 2013
> > @@ -42,7 +42,7 @@ class PerfTestResultFormatter {
> > double latency99Pct;
> > double latency99_99Pct;
> >
> > - Stats(String throughput, String avg, String lat99, String lat99_99)
> > + Stats(final String throughput, final String avg, final String lat99, final String lat99_99)
> > throws ParseException {
> > this.throughput = NUM.parse(throughput.trim()).longValue();
> > this.avgLatency = Double.parseDouble(avg.trim());
> > @@ -51,40 +51,40 @@ class PerfTestResultFormatter {
> > }
> > }
> >
> > - private Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
> > + private final Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
> >
> > public PerfTestResultFormatter() {
> > }
> >
> > - public String format(String text) throws ParseException {
> > + public String format(final String text) throws ParseException {
> > results.clear();
> > - String[] lines = text.split("[\\r\\n]+");
> > - for (String line : lines) {
> > + final String[] lines = text.split("[\\r\\n]+");
> > + for (final String line : lines) {
> > process(line);
> > }
> > return latencyTable() + LF + throughputTable();
> > }
> >
> > private String latencyTable() {
> > - StringBuilder sb = new StringBuilder(4 * 1024);
> > - Set<String> subKeys = results.values().iterator().next().keySet();
> > - char[] tabs = new char[subKeys.size()];
> > + final StringBuilder sb = new StringBuilder(4 * 1024);
> > + final Set<String> subKeys = results.values().iterator().next().keySet();
> > + final char[] tabs = new char[subKeys.size()];
> > Arrays.fill(tabs, '\t');
> > - String sep = new String(tabs);
> > + final String sep = new String(tabs);
> > sb.append("\tAverage latency").append(sep).append("99% less than").append(sep).append("99.99% less than");
> > sb.append(LF);
> > for (int i = 0; i < 3; i++) {
> > - for (String subKey : subKeys) {
> > + for (final String subKey : subKeys) {
> > sb.append("\t").append(subKey);
> > }
> > }
> > sb.append(LF);
> > - for (String key : results.keySet()) {
> > + for (final String key : results.keySet()) {
> > sb.append(key);
> > for (int i = 0; i < 3; i++) {
> > - Map<String, Stats> sub = results.get(key);
> > - for (String subKey : sub.keySet()) {
> > - Stats stats = sub.get(subKey);
> > + final Map<String, Stats> sub = results.get(key);
> > + for (final String subKey : sub.keySet()) {
> > + final Stats stats = sub.get(subKey);
> > switch (i) {
> > case 0:
> > sb.append("\t").append((long) stats.avgLatency);
> > @@ -104,19 +104,19 @@ class PerfTestResultFormatter {
> > }
> >
> > private String throughputTable() {
> > - StringBuilder sb = new StringBuilder(4 * 1024);
> > - Set<String> subKeys = results.values().iterator().next().keySet();
> > + final StringBuilder sb = new StringBuilder(4 * 1024);
> > + final Set<String> subKeys = results.values().iterator().next().keySet();
> > sb.append("\tThroughput per thread (msg/sec)");
> > sb.append(LF);
> > - for (String subKey : subKeys) {
> > + for (final String subKey : subKeys) {
> > sb.append("\t").append(subKey);
> > }
> > sb.append(LF);
> > - for (String key : results.keySet()) {
> > + for (final String key : results.keySet()) {
> > sb.append(key);
> > - Map<String, Stats> sub = results.get(key);
> > - for (String subKey : sub.keySet()) {
> > - Stats stats = sub.get(subKey);
> > + final Map<String, Stats> sub = results.get(key);
> > + for (final String subKey : sub.keySet()) {
> > + final Stats stats = sub.get(subKey);
> > sb.append("\t").append(stats.throughput);
> > }
> > sb.append(LF);
> > @@ -124,19 +124,19 @@ class PerfTestResultFormatter {
> > return sb.toString();
> > }
> >
> > - private void process(String line) throws ParseException {
> > - String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
> > - String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
> > - String throughput = line.substring(line.indexOf("throughput: ")
> > + private void process(final String line) throws ParseException {
> > + final String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
> > + final String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
> > + final String throughput = line.substring(line.indexOf("throughput: ")
> > + "throughput: ".length(), line.indexOf(" ops"));
> > - String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
> > + final String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
> > line.indexOf(" 99%"));
> > - String pct99 = line.substring(
> > + final String pct99 = line.substring(
> > line.indexOf("99% < ") + "99% < ".length(),
> > line.indexOf(" 99.99%"));
> > - String pct99_99 = line.substring(line.indexOf("99.99% < ")
> > + final String pct99_99 = line.substring(line.indexOf("99.99% < ")
> > + "99.99% < ".length(), line.lastIndexOf('(') - 1);
> > - Stats stats = new Stats(throughput, avg, pct99, pct99_99);
> > + final Stats stats = new Stats(throughput, avg, pct99, pct99_99);
> > Map<String, Stats> map = results.get(key.trim());
> > if (map == null) {
> > map = new TreeMap<String, Stats>(sort());
> > @@ -156,9 +156,9 @@ class PerfTestResultFormatter {
> > "64 threads");
> >
> > @Override
> > - public int compare(String o1, String o2) {
> > - int i1 = expected.indexOf(o1);
> > - int i2 = expected.indexOf(o2);
> > + public int compare(final String o1, final String o2) {
> > + final int i1 = expected.indexOf(o1);
> > + final int i2 = expected.indexOf(o2);
> > if (i1 < 0 || i2 < 0) {
> > return o1.compareTo(o2);
> > }
> > @@ -167,9 +167,9 @@ class PerfTestResultFormatter {
> > };
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > - PerfTestResultFormatter fmt = new PerfTestResultFormatter();
> > - BufferedReader reader = new BufferedReader(new InputStreamReader(
> > + public static void main(final String[] args) throws Exception {
> > + final PerfTestResultFormatter fmt = new PerfTestResultFormatter();
> > + final BufferedReader reader = new BufferedReader(new InputStreamReader(
> > System.in));
> > String line;
> > while ((line = reader.readLine()) != null) {
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java Tue Jul 9 06:08:25 2013
> > @@ -24,32 +24,32 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLog4j1 implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -62,8 +62,8 @@ public class RunLog4j1 implements IPerfT
> > }
> >
> > @Override
> > - public void log(String finalMessage) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void log(final String finalMessage) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > logger.info(finalMessage);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java Tue Jul 9 06:08:25 2013
> > @@ -25,33 +25,33 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLog4j2 implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -66,8 +66,8 @@ public class RunLog4j2 implements IPerfT
> >
> >
> > @Override
> > - public void log(String finalMessage) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void log(final String finalMessage) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > logger.info(finalMessage);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java Tue Jul 9 06:08:25 2013
> > @@ -26,32 +26,32 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLogback implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -64,8 +64,8 @@ public class RunLogback implements IPerf
> > }
> >
> > @Override
> > - public void log(String msg) {
> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > + public void log(final String msg) {
> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > logger.info(msg);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java Tue Jul 9 06:08:25 2013
> > @@ -63,12 +63,12 @@ public class AdvertiserTest {
> > file.delete();
> > }
> >
> > - private void verifyExpectedEntriesAdvertised(Map<Object, Map<String, String>> entries) {
> > + private void verifyExpectedEntriesAdvertised(final Map<Object, Map<String, String>> entries) {
> > boolean foundFile1 = false;
> > boolean foundFile2 = false;
> > boolean foundSocket1 = false;
> > boolean foundSocket2 = false;
> > - for (Map<String, String>entry:entries.values()) {
> > + for (final Map<String, String>entry:entries.values()) {
> > if (foundFile1 && foundFile2 && foundSocket1 && foundSocket2) {
> > break;
> > }
> > @@ -103,7 +103,7 @@ public class AdvertiserTest {
> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> > ctx.stop();
> >
> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > assertTrue("Entries found: " + entries, entries.isEmpty());
> >
> > //reconfigure for subsequent testing
> > @@ -117,7 +117,7 @@ public class AdvertiserTest {
> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> > ctx.stop();
> >
> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > assertTrue("Entries found: " + entries, entries.isEmpty());
> >
> > ctx.start();
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java Tue Jul 9 06:08:25 2013
> > @@ -34,9 +34,9 @@ public class BaseConfigurationTest {
> > @Test
> > public void testMissingRootLogger() throws Exception {
> > PluginManager.addPackage("org.apache.logging.log4j.test.appender");
> > - LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
> > + final LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
> > final Logger logger = LogManager.getLogger("sample.Logger1");
> > - Configuration config = ctx.getConfiguration();
> > + final Configuration config = ctx.getConfiguration();
> > assertNotNull("Config not null", config);
> > // final String MISSINGROOT = "MissingRootTest";
> > // assertTrue("Incorrect Configuration. Expected " + MISSINGROOT + " but found " + config.getName(),
> > @@ -53,15 +53,15 @@ public class BaseConfigurationTest {
> > // only the sample logger, no root logger in loggerMap!
> > assertTrue("contains key=sample", loggerMap.containsKey("sample"));
> >
> > - LoggerConfig sample = loggerMap.get("sample");
> > - Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
> > + final LoggerConfig sample = loggerMap.get("sample");
> > + final Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
> > assertEquals("sampleAppenders Size", 1, sampleAppenders.size());
> > // sample only has List appender, not Console!
> > assertTrue("sample has appender List", sampleAppenders.containsKey("List"));
> >
> > - BaseConfiguration baseConfig = (BaseConfiguration) config;
> > - LoggerConfig root = baseConfig.getRootLogger();
> > - Map<String, Appender<?>> rootAppenders = root.getAppenders();
> > + final BaseConfiguration baseConfig = (BaseConfiguration) config;
> > + final LoggerConfig root = baseConfig.getRootLogger();
> > + final Map<String, Appender<?>> rootAppenders = root.getAppenders();
> > assertEquals("rootAppenders Size", 1, rootAppenders.size());
> > // root only has Console appender!
> > assertTrue("root has appender Console", rootAppenders.containsKey("Console"));
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java Tue Jul 9 06:08:25 2013
> > @@ -28,20 +28,20 @@ public class InMemoryAdvertiser implemen
> >
> > public static Map<Object, Map<String, String>> getAdvertisedEntries()
> > {
> > - Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
> > + final Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
> > result.putAll(properties);
> > return result;
> > }
> >
> > @Override
> > - public Object advertise(Map<String, String> newEntry) {
> > - Object object = new Object();
> > + public Object advertise(final Map<String, String> newEntry) {
> > + final Object object = new Object();
> > properties.put(object, new HashMap<String, String>(newEntry));
> > return object;
> > }
> >
> > @Override
> > - public void unadvertise(Object advertisedObject) {
> > + public void unadvertise(final Object advertisedObject) {
> > properties.remove(advertisedObject);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java Tue Jul 9 06:08:25 2013
> > @@ -189,24 +189,24 @@ public class TestConfigurator {
> > public void testEnvironment() throws Exception {
> > final LoggerContext ctx = Configurator.initialize("-config", null, (String) null);
> > final Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
> > - Configuration config = ctx.getConfiguration();
> > + final Configuration config = ctx.getConfiguration();
> > assertNotNull("No configuration", config);
> > assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
> > CONFIG_NAME.equals(config.getName()));
> > final Map<String, Appender<?>> map = config.getAppenders();
> > assertNotNull("No Appenders", map != null && map.size() > 0);
> > Appender<?> app = null;
> > - for (Map.Entry<String, Appender<?>> entry: map.entrySet()) {
> > + for (final Map.Entry<String, Appender<?>> entry: map.entrySet()) {
> > if (entry.getKey().equals("List2")) {
> > app = entry.getValue();
> > break;
> > }
> > }
> > assertNotNull("No ListAppender named List2", app);
> > - Layout layout = app.getLayout();
> > + final Layout layout = app.getLayout();
> > assertNotNull("Appender List2 does not have a Layout", layout);
> > assertTrue("Appender List2 is not configured with a PatternLayout", layout instanceof PatternLayout);
> > - String pattern = ((PatternLayout) layout).getConversionPattern();
> > + final String pattern = ((PatternLayout) layout).getConversionPattern();
> > assertNotNull("No conversion pattern for List2 PatternLayout", pattern);
> > assertFalse("Environment variable was not substituted", pattern.startsWith("${env:PATH}"));
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java Tue Jul 9 06:08:25 2013
> > @@ -55,7 +55,7 @@ public class RegexFilterTest {
> >
> > @Test
> > public void TestNoMsg() {
> > - RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
> > + final RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
> > filter.start();
> > assertTrue(filter.isStarted());
> > assertTrue(filter.filter(null, Level.DEBUG, null, (String)null, (Throwable)null) == Filter.Result.DENY);
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
Re: svn commit: r1501104 [4/5] - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/ api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j/s...
Posted by Ralph Goers <ra...@dslextreme.com>.
I suppose that is why I always compile from the command line using maven.
Ralph
On Jul 9, 2013, at 1:33 PM, Gary Gregory wrote:
> woa, my IDE was picking up java 7 for my Log4j2 projects instead of Java 6...
>
> Gary
>
>
> On Tue, Jul 9, 2013 at 4:20 PM, Gary Gregory <ga...@gmail.com> wrote:
> Everything is compiling in Eclipse (Java 6) and Maven (Java 7) but I just read Nick's comment. I am running Maven on Java 6 as I write this...
>
> Gary
>
>
> On Tue, Jul 9, 2013 at 4:10 PM, Ralph Goers <ra...@dslextreme.com> wrote:
> After fixing the prior compiler error I then ran into this one:
>
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project log4j-core: Compilation failure
> [ERROR] /Users/rgoers/projects/apache/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java:[177,13] variable _averageOpsPerSec might already have been assigned
>
> Can you please compile and test before committing?
>
> Ralph
>
> On Jul 8, 2013, at 11:08 PM, ggregory@apache.org wrote:
>
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -41,7 +41,7 @@ public class ContextStackAttributeConver
> >
> > @Test
> > public void testConvertToDatabaseColumn01() {
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("value1", "another2"));
> >
> > assertEquals("The converted value is not correct.", "value1\nanother2",
> > @@ -50,7 +50,7 @@ public class ContextStackAttributeConver
> >
> > @Test
> > public void testConvertToDatabaseColumn02() {
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("key1", "value2", "my3"));
> >
> > assertEquals("The converted value is not correct.",
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -42,14 +42,14 @@ public class ContextStackJsonAttributeCo
> > @Test
> > public void testConvert01() {
> > ThreadContext.clearStack();
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("value1", "another2"));
> >
> > - String converted = this.converter.convertToDatabaseColumn(stack);
> > + final String converted = this.converter.convertToDatabaseColumn(stack);
> >
> > assertNotNull("The converted value should not be null.", converted);
> >
> > - ThreadContext.ContextStack reversed = this.converter
> > + final ThreadContext.ContextStack reversed = this.converter
> > .convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > @@ -60,14 +60,14 @@ public class ContextStackJsonAttributeCo
> > @Test
> > public void testConvert02() {
> > ThreadContext.clearStack();
> > - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> > Arrays.asList("key1", "value2", "my3"));
> >
> > - String converted = this.converter.convertToDatabaseColumn(stack);
> > + final String converted = this.converter.convertToDatabaseColumn(stack);
> >
> > assertNotNull("The converted value should not be null.", converted);
> >
> > - ThreadContext.ContextStack reversed = this.converter
> > + final ThreadContext.ContextStack reversed = this.converter
> > .convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -39,14 +39,14 @@ public class MarkerAttributeConverterTes
> >
> > @Test
> > public void testConvert01() {
> > - Marker marker = MarkerManager.getMarker("testConvert01");
> > + final Marker marker = MarkerManager.getMarker("testConvert01");
> >
> > - String converted = this.converter.convertToDatabaseColumn(marker);
> > + final String converted = this.converter.convertToDatabaseColumn(marker);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "testConvert01", converted);
> >
> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "testConvert01", marker.getName());
> > @@ -54,19 +54,19 @@ public class MarkerAttributeConverterTes
> >
> > @Test
> > public void testConvert02() {
> > - Marker marker = MarkerManager.getMarker("testConvert02",
> > + final Marker marker = MarkerManager.getMarker("testConvert02",
> > MarkerManager.getMarker("anotherConvert02",
> > MarkerManager.getMarker("finalConvert03")
> > )
> > );
> >
> > - String converted = this.converter.convertToDatabaseColumn(marker);
> > + final String converted = this.converter.convertToDatabaseColumn(marker);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "testConvert02[ anotherConvert02[ finalConvert03 ] ] ]",
> > converted);
> >
> > - Marker reversed = this.converter.convertToEntityAttribute(converted);
> > + final Marker reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "testConvert02", marker.getName());
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -41,14 +41,14 @@ public class MessageAttributeConverterTe
> >
> > @Test
> > public void testConvert01() {
> > - Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
> > + final Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
> >
> > - String converted = this.converter.convertToDatabaseColumn(message);
> > + final String converted = this.converter.convertToDatabaseColumn(message);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "Message #3 said [Hello].", converted);
> >
> > - Message reversed = this.converter.convertToEntityAttribute(converted);
> > + final Message reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "Message #3 said [Hello].", reversed.getFormattedMessage());
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -37,15 +37,15 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert01() {
> > - StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
> > + final StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.", "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "TestNoPackage", reversed.getClassName());
> > @@ -57,17 +57,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert02() {
> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
> > "testConvert02", "TestWithPackage.java", -1);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "org.apache.logging.TestWithPackage", reversed.getClassName());
> > @@ -79,17 +79,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert03() {
> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
> > "testConvert03", null, -1);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestNoSource.testConvert03(Unknown Source)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "org.apache.logging.TestNoSource", reversed.getClassName());
> > @@ -101,17 +101,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert04() {
> > - StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
> > + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
> > "testConvert04", null, -2);
> >
> > - String converted = this.converter.convertToDatabaseColumn(element);
> > + final String converted = this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.", converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
> > converted);
> >
> > - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "org.apache.logging.TestIsNativeMethod",
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> > @@ -39,16 +39,16 @@ public class ThrowableAttributeConverter
> >
> > @Test
> > public void testConvert01() {
> > - RuntimeException exception = new RuntimeException("My message 01.");
> > + final RuntimeException exception = new RuntimeException("My message 01.");
> >
> > - String stackTrace = getStackTrace(exception);
> > + final String stackTrace = getStackTrace(exception);
> >
> > - String converted = this.converter.convertToDatabaseColumn(exception);
> > + final String converted = this.converter.convertToDatabaseColumn(exception);
> >
> > assertNotNull("The converted value is not correct.", converted);
> > assertEquals("The converted value is not correct.", stackTrace, converted);
> >
> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
> > @@ -56,18 +56,18 @@ public class ThrowableAttributeConverter
> >
> > @Test
> > public void testConvert02() {
> > - SQLException cause2 = new SQLException("This is a test cause.");
> > - Error cause1 = new Error(cause2);
> > - RuntimeException exception = new RuntimeException("My message 01.", cause1);
> > + final SQLException cause2 = new SQLException("This is a test cause.");
> > + final Error cause1 = new Error(cause2);
> > + final RuntimeException exception = new RuntimeException("My message 01.", cause1);
> >
> > - String stackTrace = getStackTrace(exception);
> > + final String stackTrace = getStackTrace(exception);
> >
> > - String converted = this.converter.convertToDatabaseColumn(exception);
> > + final String converted = this.converter.convertToDatabaseColumn(exception);
> >
> > assertNotNull("The converted value is not correct.", converted);
> > assertEquals("The converted value is not correct.", stackTrace, converted);
> >
> > - Throwable reversed = this.converter.convertToEntityAttribute(converted);
> > + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
> > @@ -84,10 +84,10 @@ public class ThrowableAttributeConverter
> > assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
> > }
> >
> > - private static String getStackTrace(Throwable throwable) {
> > + private static String getStackTrace(final Throwable throwable) {
> > String returnValue = throwable.toString() + "\n";
> >
> > - for (StackTraceElement element : throwable.getStackTrace()) {
> > + for (final StackTraceElement element : throwable.getStackTrace()) {
> > returnValue += "\tat " + element.toString() + "\n";
> > }
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java Tue Jul 9 06:08:25 2013
> > @@ -51,7 +51,7 @@ public class MapRewritePolicyTest {
> > logEvent1 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ERROR,
> > new MapMessage(map), null, map, null, "none",
> > new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 29), 2);
> > - ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
> > + final ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
> > logEvent2 = new Log4jLogEvent("test", MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
> > Level.TRACE, new StructuredDataMessage("test", "Nothing", "test", map), new RuntimeException("test"), null,
> > stack, "none", new StackTraceElement("MapRewritePolicyTest",
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java Tue Jul 9 06:08:25 2013
> > @@ -112,7 +112,7 @@ public class RewriteAppenderTest {
> > StructuredDataMessage msg = new StructuredDataMessage("Test", "This is a test", "Service");
> > msg.put("Key1", "Value2");
> > msg.put("Key2", "Value1");
> > - Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> > + final Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> > logger.debug(msg);
> > msg = new StructuredDataMessage("Test", "This is a test", "Service");
> > msg.put("Key1", "Value1");
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java Tue Jul 9 06:08:25 2013
> > @@ -40,23 +40,23 @@ public class FastRollingFileManagerTest
> > */
> > @Test
> > public void testWrite_multiplesOfBufferSize() throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > - boolean append = false;
> > - boolean flushNow = false;
> > - long triggerSize = Long.MAX_VALUE;
> > - long time = System.currentTimeMillis();
> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > + final boolean append = false;
> > + final boolean flushNow = false;
> > + final long triggerSize = Long.MAX_VALUE;
> > + final long time = System.currentTimeMillis();
> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > triggerSize);
> > - RolloverStrategy rolloverStrategy = null;
> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
> > + final RolloverStrategy rolloverStrategy = null;
> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
> > file.getName(), "", os, append, flushNow, triggerSize, time,
> > triggerPolicy, rolloverStrategy, null, null);
> >
> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> > - byte[] data = new byte[size];
> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> > + final byte[] data = new byte[size];
> > manager.write(data, 0, data.length); // no buffer overflow exception
> >
> > // buffer is full but not flushed yet
> > @@ -71,23 +71,23 @@ public class FastRollingFileManagerTest
> > */
> > @Test
> > public void testWrite_dataExceedingBufferSize() throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > - OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > - boolean append = false;
> > - boolean flushNow = false;
> > - long triggerSize = 0;
> > - long time = System.currentTimeMillis();
> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
> > + final boolean append = false;
> > + final boolean flushNow = false;
> > + final long triggerSize = 0;
> > + final long time = System.currentTimeMillis();
> > + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > triggerSize);
> > - RolloverStrategy rolloverStrategy = null;
> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
> > + final RolloverStrategy rolloverStrategy = null;
> > + final FastRollingFileManager manager = new FastRollingFileManager(raf,
> > file.getName(), "", os, append, flushNow, triggerSize, time,
> > triggerPolicy, rolloverStrategy, null, null);
> >
> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
> > - byte[] data = new byte[size];
> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
> > + final byte[] data = new byte[size];
> > manager.write(data, 0, data.length); // no exception
> > assertEquals(FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3,
> > raf.length());
> > @@ -98,12 +98,12 @@ public class FastRollingFileManagerTest
> >
> > @Test
> > public void testAppendDoesNotOverwriteExistingFile() throws IOException {
> > - boolean isAppend = true;
> > - File file = File.createTempFile("log4j2", "test");
> > + final boolean isAppend = true;
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > assertEquals(0, file.length());
> >
> > - byte[] bytes = new byte[4 * 1024];
> > + final byte[] bytes = new byte[4 * 1024];
> >
> > // create existing file
> > FileOutputStream fos = null;
> > @@ -116,31 +116,31 @@ public class FastRollingFileManagerTest
> > }
> > assertEquals("all flushed to disk", bytes.length, file.length());
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> > new SizeBasedTriggeringPolicy(Long.MAX_VALUE), //
> > null, null, null);
> > manager.write(bytes, 0, bytes.length);
> > - int expected = bytes.length * 2;
> > + final int expected = bytes.length * 2;
> > assertEquals("appended, not overwritten", expected, file.length());
> > }
> >
> > @Test
> > public void testFileTimeBasedOnSystemClockWhenAppendIsFalse()
> > throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > LockSupport.parkNanos(1000000); // 1 millisec
> >
> > // append is false deletes the file if it exists
> > - boolean isAppend = false;
> > - long expectedMin = System.currentTimeMillis();
> > - long expectedMax = expectedMin + 50;
> > + final boolean isAppend = false;
> > + final long expectedMin = System.currentTimeMillis();
> > + final long expectedMax = expectedMin + 50;
> > assertTrue(file.lastModified() < expectedMin);
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> > @@ -153,14 +153,14 @@ public class FastRollingFileManagerTest
> > @Test
> > public void testFileTimeBasedOnFileModifiedTimeWhenAppendIsTrue()
> > throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > LockSupport.parkNanos(1000000); // 1 millisec
> >
> > - boolean isAppend = true;
> > + final boolean isAppend = true;
> > assertTrue(file.lastModified() < System.currentTimeMillis());
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java Tue Jul 9 06:08:25 2013
> > @@ -35,7 +35,7 @@ public class FileRenameActionTest {
> >
> > @BeforeClass
> > public static void beforeClass() throws Exception {
> > - File file = new File(DIR);
> > + final File file = new File(DIR);
> > file.mkdirs();
> > }
> >
> > @@ -51,15 +51,15 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testRename1() throws Exception {
> > - File file = new File("target/fileRename/fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("target/fileRename/fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > for (int i = 0; i < 100; ++i) {
> > pos.println("This is line " + i);
> > }
> > pos.close();
> >
> > - File dest = new File("target/fileRename/newFile.log");
> > - FileRenameAction action = new FileRenameAction(file, dest, false);
> > + final File dest = new File("target/fileRename/newFile.log");
> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", dest.exists());
> > assertTrue("Old file exists", !file.exists());
> > @@ -67,12 +67,12 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testEmpty() throws Exception {
> > - File file = new File("target/fileRename/fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("target/fileRename/fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > pos.close();
> >
> > - File dest = new File("target/fileRename/newFile.log");
> > - FileRenameAction action = new FileRenameAction(file, dest, false);
> > + final File dest = new File("target/fileRename/newFile.log");
> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", !dest.exists());
> > assertTrue("Old file does not exist", !file.exists());
> > @@ -81,16 +81,16 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testNoParent() throws Exception {
> > - File file = new File("fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > for (int i = 0; i < 100; ++i) {
> > pos.println("This is line " + i);
> > }
> > pos.close();
> >
> > - File dest = new File("newFile.log");
> > + final File dest = new File("newFile.log");
> > try {
> > - FileRenameAction action = new FileRenameAction(file, dest, false);
> > + final FileRenameAction action = new FileRenameAction(file, dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", dest.exists());
> > assertTrue("Old file exists", !file.exists());
> > @@ -98,7 +98,7 @@ public class FileRenameActionTest {
> > try {
> > dest.delete();
> > file.delete();
> > - } catch (Exception ex) {
> > + } catch (final Exception ex) {
> > System.out.println("Unable to cleanup files written to main directory");
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java Tue Jul 9 06:08:25 2013
> > @@ -39,17 +39,17 @@ public class AsyncLoggerConfigTest {
> >
> > @Test
> > public void testAdditivity() throws Exception {
> > - File f = new File("target", "AsyncLoggerConfigTest.log");
> > + final File f = new File("target", "AsyncLoggerConfigTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Additive logging: 2 for the price of 1!";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Additive logging: 2 for the price of 1!";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > - String line2 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
> > + final String line1 = reader.readLine();
> > + final String line2 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > @@ -57,7 +57,7 @@ public class AsyncLoggerConfigTest {
> > assertTrue("line1 correct", line1.contains(msg));
> > assertTrue("line2 correct", line2.contains(msg));
> >
> > - String location = "testAdditivity";
> > + final String location = "testAdditivity";
> > assertTrue("location",
> > line1.contains(location) || line2.contains(location));
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java Tue Jul 9 06:08:25 2013
> > @@ -29,24 +29,24 @@ public class AsyncLoggerContextSelectorT
> >
> > @Test
> > public void testContextReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false);
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null, false);
> >
> > assertTrue(context instanceof AsyncLoggerContext);
> > }
> >
> > @Test
> > public void testContext2ReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false, null);
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null, false, null);
> >
> > assertTrue(context instanceof AsyncLoggerContext);
> > }
> >
> > @Test
> > public void testLoggerContextsReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - List<LoggerContext> list = selector.getLoggerContexts();
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final List<LoggerContext> list = selector.getLoggerContexts();
> >
> > assertEquals(1, list.size());
> > assertTrue(list.get(0) instanceof AsyncLoggerContext);
> > @@ -54,8 +54,8 @@ public class AsyncLoggerContextSelectorT
> >
> > @Test
> > public void testContextNameIsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false);
> > + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null, false);
> >
> > assertEquals("AsyncLoggerContext", context.getName());
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java Tue Jul 9 06:08:25 2013
> > @@ -30,7 +30,7 @@ public class AsyncLoggerContextTest {
> >
> > @Test
> > public void testNewInstanceReturnsAsyncLogger() {
> > - Logger logger = new AsyncLoggerContext("a").newInstance(
> > + final Logger logger = new AsyncLoggerContext("a").newInstance(
> > new LoggerContext("a"), "a", null);
> > assertTrue(logger instanceof AsyncLogger);
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java Tue Jul 9 06:08:25 2013
> > @@ -49,22 +49,22 @@ public class AsyncLoggerLocationTest {
> >
> > @Test
> > public void testAsyncLogWritesToLog() throws Exception {
> > - File f = new File("target", "AsyncLoggerLocationTest.log");
> > + final File f = new File("target", "AsyncLoggerLocationTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Async logger msg with location";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Async logger msg with location";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
> > + final String line1 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > assertTrue("line1 correct", line1.contains(msg));
> >
> > - String location = "testAsyncLogWritesToLog";
> > + final String location = "testAsyncLogWritesToLog";
> > assertTrue("has location", line1.contains(location));
> > }
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java Tue Jul 9 06:08:25 2013
> > @@ -49,22 +49,22 @@ public class AsyncLoggerTest {
> >
> > @Test
> > public void testAsyncLogWritesToLog() throws Exception {
> > - File f = new File("target", "AsyncLoggerTest.log");
> > + final File f = new File("target", "AsyncLoggerTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Async logger msg";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Async logger msg";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new FileReader(f));
> > + final String line1 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > assertTrue("line1 correct", line1.contains(msg));
> >
> > - String location = "testAsyncLogWritesToLog";
> > + final String location = "testAsyncLogWritesToLog";
> > assertTrue("no location", !line1.contains(location));
> > }
> >
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java Tue Jul 9 06:08:25 2013
> > @@ -22,23 +22,23 @@ import com.lmax.disruptor.collections.Hi
> >
> > public class MTPerfTest extends PerfTest {
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > new MTPerfTest().doMain(args);
> > }
> >
> > @Override
> > public void runTestAndPrintResult(final IPerfTestRunner runner,
> > - final String name, final int threadCount, String resultFile)
> > + final String name, final int threadCount, final String resultFile)
> > throws Exception {
> >
> > // ThreadContext.put("aKey", "mdcVal");
> > PerfTest.println("Warming up the JVM...");
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> >
> > // warmup at least 2 rounds and at most 1 minute
> > final Histogram warmupHist = PerfTest.createHistogram();
> > final long stop = System.currentTimeMillis() + (60 * 1000);
> > - Runnable run1 = new Runnable() {
> > + final Runnable run1 = new Runnable() {
> > @Override
> > public void run() {
> > for (int i = 0; i < 10; i++) {
> > @@ -50,8 +50,8 @@ public class MTPerfTest extends PerfTest
> > }
> > }
> > };
> > - Thread thread1 = new Thread(run1);
> > - Thread thread2 = new Thread(run1);
> > + final Thread thread1 = new Thread(run1);
> > + final Thread thread2 = new Thread(run1);
> > thread1.start();
> > thread2.start();
> > thread1.join();
> > @@ -74,7 +74,7 @@ public class MTPerfTest extends PerfTest
> > }
> >
> > private void multiThreadedTestRun(final IPerfTestRunner runner,
> > - final String name, final int threadCount, String resultFile)
> > + final String name, final int threadCount, final String resultFile)
> > throws Exception {
> >
> > final Histogram[] histograms = new Histogram[threadCount];
> > @@ -83,28 +83,28 @@ public class MTPerfTest extends PerfTest
> > }
> > final int LINES = 256 * 1024;
> >
> > - Thread[] threads = new Thread[threadCount];
> > + final Thread[] threads = new Thread[threadCount];
> > for (int i = 0; i < threads.length; i++) {
> > final Histogram histogram = histograms[i];
> > threads[i] = new Thread() {
> > @Override
> > public void run() {
> > // int latencyCount = threadCount >= 16 ? 1000000 : 5000000;
> > - int latencyCount = 5000000;
> > - int count = PerfTest.throughput ? LINES / threadCount
> > + final int latencyCount = 5000000;
> > + final int count = PerfTest.throughput ? LINES / threadCount
> > : latencyCount;
> > runTest(runner, count, "end", histogram, threadCount);
> > }
> > };
> > }
> > - for (Thread thread : threads) {
> > + for (final Thread thread : threads) {
> > thread.start();
> > }
> > - for (Thread thread : threads) {
> > + for (final Thread thread : threads) {
> > thread.join();
> > }
> >
> > - for (Histogram histogram : histograms) {
> > + for (final Histogram histogram : histograms) {
> > PerfTest.reportResult(resultFile, name, histogram);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java Tue Jul 9 06:08:25 2013
> > @@ -33,7 +33,7 @@ public class PerfTest {
> > // determine how long it takes to call System.nanoTime() (on average)
> > static long calcNanoTimeCost() {
> > final long iterations = 10000000;
> > - long start = System.nanoTime();
> > + final long start = System.nanoTime();
> > long finish = start;
> >
> > for (int i = 0; i < iterations; i++) {
> > @@ -49,7 +49,7 @@ public class PerfTest {
> > }
> >
> > static Histogram createHistogram() {
> > - long[] intervals = new long[31];
> > + final long[] intervals = new long[31];
> > long intervalUpperBound = 1L;
> > for (int i = 0, size = intervals.length - 1; i < size; i++) {
> > intervalUpperBound *= 2;
> > @@ -60,17 +60,17 @@ public class PerfTest {
> > return new Histogram(intervals);
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > new PerfTest().doMain(args);
> > }
> >
> > - public void doMain(String[] args) throws Exception {
> > - String runnerClass = args[0];
> > - IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
> > + public void doMain(final String[] args) throws Exception {
> > + final String runnerClass = args[0];
> > + final IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
> > .newInstance();
> > - String name = args[1];
> > - String resultFile = args.length > 2 ? args[2] : null;
> > - for (String arg : args) {
> > + final String name = args[1];
> > + final String resultFile = args.length > 2 ? args[2] : null;
> > + for (final String arg : args) {
> > if (verbose && throughput) {
> > break;
> > }
> > @@ -81,7 +81,7 @@ public class PerfTest {
> > throughput = true;
> > }
> > }
> > - int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
> > + final int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
> > printf("Starting %s %s (%d)...%n", getClass().getSimpleName(), name,
> > threadCount);
> > runTestAndPrintResult(runner, name, threadCount, resultFile);
> > @@ -89,14 +89,14 @@ public class PerfTest {
> > System.exit(0);
> > }
> >
> > - public void runTestAndPrintResult(IPerfTestRunner runner,
> > - final String name, int threadCount, String resultFile)
> > + public void runTestAndPrintResult(final IPerfTestRunner runner,
> > + final String name, final int threadCount, final String resultFile)
> > throws Exception {
> > - Histogram warmupHist = createHistogram();
> > + final Histogram warmupHist = createHistogram();
> >
> > // ThreadContext.put("aKey", "mdcVal");
> > println("Warming up the JVM...");
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> >
> > // warmup at least 2 rounds and at most 1 minute
> > final long stop = System.currentTimeMillis() + (60 * 1000);
> > @@ -124,46 +124,46 @@ public class PerfTest {
> > runSingleThreadedTest(runner, name, resultFile);
> > }
> >
> > - private int runSingleThreadedTest(IPerfTestRunner runner, String name,
> > - String resultFile) throws IOException {
> > - Histogram latency = createHistogram();
> > + private int runSingleThreadedTest(final IPerfTestRunner runner, final String name,
> > + final String resultFile) throws IOException {
> > + final Histogram latency = createHistogram();
> > final int LINES = throughput ? 50000 : 5000000;
> > runTest(runner, LINES, "end", latency, 1);
> > reportResult(resultFile, name, latency);
> > return LINES;
> > }
> >
> > - static void reportResult(String file, String name, Histogram histogram)
> > + static void reportResult(final String file, final String name, final Histogram histogram)
> > throws IOException {
> > - String result = createSamplingReport(name, histogram);
> > + final String result = createSamplingReport(name, histogram);
> > println(result);
> >
> > if (file != null) {
> > - FileWriter writer = new FileWriter(file, true);
> > + final FileWriter writer = new FileWriter(file, true);
> > writer.write(result);
> > writer.write(System.getProperty("line.separator"));
> > writer.close();
> > }
> > }
> >
> > - static void printf(String msg, Object... objects) {
> > + static void printf(final String msg, final Object... objects) {
> > if (verbose) {
> > System.out.printf(msg, objects);
> > }
> > }
> >
> > - static void println(String msg) {
> > + static void println(final String msg) {
> > if (verbose) {
> > System.out.println(msg);
> > }
> > }
> >
> > - static String createSamplingReport(String name, Histogram histogram) {
> > - Histogram data = histogram;
> > + static String createSamplingReport(final String name, final Histogram histogram) {
> > + final Histogram data = histogram;
> > if (throughput) {
> > return data.getMax() + " operations/second";
> > }
> > - String result = String.format(
> > + final String result = String.format(
> > "avg=%.0f 99%%=%d 99.99%%=%d sampleCount=%d", data.getMean(), //
> > data.getTwoNinesUpperBound(), //
> > data.getFourNinesUpperBound(), //
> > @@ -172,12 +172,12 @@ public class PerfTest {
> > return result;
> > }
> >
> > - public void runTest(IPerfTestRunner runner, int lines, String finalMessage,
> > - Histogram histogram, int threadCount) {
> > + public void runTest(final IPerfTestRunner runner, final int lines, final String finalMessage,
> > + final Histogram histogram, final int threadCount) {
> > if (throughput) {
> > runner.runThroughputTest(lines, histogram);
> > } else {
> > - long nanoTimeCost = calcNanoTimeCost();
> > + final long nanoTimeCost = calcNanoTimeCost();
> > runner.runLatencyTest(lines, histogram, nanoTimeCost, threadCount);
> > }
> > if (finalMessage != null) {
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java Tue Jul 9 06:08:25 2013
> > @@ -41,19 +41,19 @@ public class PerfTestDriver {
> > * Defines the setup for a java process running a performance test.
> > */
> > static class Setup implements Comparable<Setup> {
> > - private Class<?> _class;
> > - private String _log4jConfig;
> > - private String _name;
> > - private String[] _systemProperties;
> > - private int _threadCount;
> > - private File _temp;
> > + private final Class<?> _class;
> > + private final String _log4jConfig;
> > + private final String _name;
> > + private final String[] _systemProperties;
> > + private final int _threadCount;
> > + private final File _temp;
> > public Stats _stats;
> > - private WaitStrategy _wait;
> > - private String _runner;
> > + private final WaitStrategy _wait;
> > + private final String _runner;
> >
> > - public Setup(Class<?> klass, String runner, String name,
> > - String log4jConfig, int threadCount, WaitStrategy wait,
> > - String... systemProperties) throws IOException {
> > + public Setup(final Class<?> klass, final String runner, final String name,
> > + final String log4jConfig, final int threadCount, final WaitStrategy wait,
> > + final String... systemProperties) throws IOException {
> > _class = klass;
> > _runner = runner;
> > _name = name;
> > @@ -64,8 +64,8 @@ public class PerfTestDriver {
> > _temp = File.createTempFile("log4jperformance", ".txt");
> > }
> >
> > - List<String> processArguments(String java) {
> > - List<String> args = new ArrayList<String>();
> > + List<String> processArguments(final String java) {
> > + final List<String> args = new ArrayList<String>();
> > args.add(java);
> > args.add("-server");
> > args.add("-Xms1g");
> > @@ -84,7 +84,7 @@ public class PerfTestDriver {
> > args.add("-Dlog4j.configurationFile=" + _log4jConfig); // log4j 2
> > args.add("-Dlogback.configurationFile=" + _log4jConfig);// logback
> >
> > - int ringBufferSize = getUserSpecifiedRingBufferSize();
> > + final int ringBufferSize = getUserSpecifiedRingBufferSize();
> > if (ringBufferSize >= 128) {
> > args.add("-DAsyncLoggerConfig.RingBufferSize=" + ringBufferSize);
> > args.add("-DAsyncLogger.RingBufferSize=" + ringBufferSize);
> > @@ -108,23 +108,23 @@ public class PerfTestDriver {
> > try {
> > return Integer.parseInt(System.getProperty("RingBufferSize",
> > "-1"));
> > - } catch (Exception ignored) {
> > + } catch (final Exception ignored) {
> > return -1;
> > }
> > }
> >
> > - ProcessBuilder latencyTest(String java) {
> > + ProcessBuilder latencyTest(final String java) {
> > return new ProcessBuilder(processArguments(java));
> > }
> >
> > - ProcessBuilder throughputTest(String java) {
> > - List<String> args = processArguments(java);
> > + ProcessBuilder throughputTest(final String java) {
> > + final List<String> args = processArguments(java);
> > args.add("-throughput");
> > return new ProcessBuilder(args);
> > }
> >
> > @Override
> > - public int compareTo(Setup other) {
> > + public int compareTo(final Setup other) {
> > // largest ops/sec first
> > return (int) Math.signum(other._stats._averageOpsPerSec
> > - _stats._averageOpsPerSec);
> > @@ -137,7 +137,7 @@ public class PerfTestDriver {
> > } else if (MTPerfTest.class == _class) {
> > detail = _threadCount + " threads";
> > }
> > - String target = _runner.substring(_runner.indexOf(".Run") + 4);
> > + final String target = _runner.substring(_runner.indexOf(".Run") + 4);
> > return target + ": " + _name + " (" + detail + ")";
> > }
> > }
> > @@ -152,16 +152,16 @@ public class PerfTestDriver {
> > long _pct99_99;
> > double _latencyRowCount;
> > int _throughputRowCount;
> > - private long _averageOpsPerSec;
> > + private final long _averageOpsPerSec;
> >
> > // example line: avg=828 99%=1118 99.99%=5028 Count=3125
> > - public Stats(String raw) {
> > - String[] lines = raw.split("[\\r\\n]+");
> > + public Stats(final String raw) {
> > + final String[] lines = raw.split("[\\r\\n]+");
> > long totalOps = 0;
> > - for (String line : lines) {
> > + for (final String line : lines) {
> > if (line.startsWith("avg")) {
> > _latencyRowCount++;
> > - String[] parts = line.split(" ");
> > + final String[] parts = line.split(" ");
> > int i = 0;
> > _average += Long.parseLong(parts[i++].split("=")[1]);
> > _pct99 += Long.parseLong(parts[i++].split("=")[1]);
> > @@ -169,8 +169,8 @@ public class PerfTestDriver {
> > _count += Integer.parseInt(parts[i].split("=")[1]);
> > } else {
> > _throughputRowCount++;
> > - String number = line.substring(0, line.indexOf(' '));
> > - long opsPerSec = Long.parseLong(number);
> > + final String number = line.substring(0, line.indexOf(' '));
> > + final long opsPerSec = Long.parseLong(number);
> > totalOps += opsPerSec;
> > }
> > }
> > @@ -179,7 +179,7 @@ public class PerfTestDriver {
> >
> > @Override
> > public String toString() {
> > - String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> > + final String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> > return String.format(fmt, _averageOpsPerSec, //
> > _average / _latencyRowCount, // mean latency
> > _pct99 / _latencyRowCount, // 99% observations less than
> > @@ -189,24 +189,24 @@ public class PerfTestDriver {
> > }
> >
> > // single-threaded performance test
> > - private static Setup s(String config, String runner, String name,
> > - String... systemProperties) throws IOException {
> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > + private static Setup s(final String config, final String runner, final String name,
> > + final String... systemProperties) throws IOException {
> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > "WaitStrategy", "Sleep"));
> > return new Setup(PerfTest.class, runner, name, config, 1, wait,
> > systemProperties);
> > }
> >
> > // multi-threaded performance test
> > - private static Setup m(String config, String runner, String name,
> > - int threadCount, String... systemProperties) throws IOException {
> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > + private static Setup m(final String config, final String runner, final String name,
> > + final int threadCount, final String... systemProperties) throws IOException {
> > + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > "WaitStrategy", "Sleep"));
> > return new Setup(MTPerfTest.class, runner, name, config, threadCount,
> > wait, systemProperties);
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > final String ALL_ASYNC = "-DLog4jContextSelector="
> > + AsyncLoggerContextSelector.class.getName();
> > final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
> > @@ -215,8 +215,8 @@ public class PerfTestDriver {
> > final String LOG20 = RunLog4j2.class.getName();
> > final String LOGBK = RunLogback.class.getName();
> >
> > - long start = System.nanoTime();
> > - List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> > + final long start = System.nanoTime();
> > + final List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> > // includeLocation=false
> > tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
> > ALL_ASYNC, SYSCLOCK));
> > @@ -285,29 +285,29 @@ public class PerfTestDriver {
> > // "RollFastFileAppender", i));
> > }
> >
> > - String java = args.length > 0 ? args[0] : "java";
> > - int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
> > + final String java = args.length > 0 ? args[0] : "java";
> > + final int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
> > int x = 0;
> > - for (Setup config : tests) {
> > + for (final Setup config : tests) {
> > System.out.print(config.description());
> > - ProcessBuilder pb = config.throughputTest(java);
> > + final ProcessBuilder pb = config.throughputTest(java);
> > pb.redirectErrorStream(true); // merge System.out and System.err
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> > // int count = config._threadCount >= 16 ? 2 : repeat;
> > runPerfTest(repeat, x++, config, pb);
> > System.out.printf(" took %.1f seconds%n", (System.nanoTime() - t1)
> > / (1000.0 * 1000.0 * 1000.0));
> >
> > - FileReader reader = new FileReader(config._temp);
> > - CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> > + final FileReader reader = new FileReader(config._temp);
> > + final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> > reader.read(buffer);
> > reader.close();
> > config._temp.delete();
> > buffer.flip();
> >
> > - String raw = buffer.toString();
> > + final String raw = buffer.toString();
> > System.out.print(raw);
> > - Stats stats = new Stats(raw);
> > + final Stats stats = new Stats(raw);
> > System.out.println(stats);
> > System.out.println("-----");
> > config._stats = stats;
> > @@ -321,19 +321,19 @@ public class PerfTestDriver {
> > printRanking(tests.toArray(new Setup[tests.size()]));
> > }
> >
> > - private static void printRanking(Setup[] tests) {
> > + private static void printRanking(final Setup[] tests) {
> > System.out.println();
> > System.out.println("Ranking:");
> > Arrays.sort(tests);
> > for (int i = 0; i < tests.length; i++) {
> > - Setup setup = tests[i];
> > + final Setup setup = tests[i];
> > System.out.println((i + 1) + ". " + setup.description() + ": "
> > + setup._stats);
> > }
> > }
> >
> > - private static void runPerfTest(int repeat, int setupIndex, Setup config,
> > - ProcessBuilder pb) throws IOException, InterruptedException {
> > + private static void runPerfTest(final int repeat, final int setupIndex, final Setup config,
> > + final ProcessBuilder pb) throws IOException, InterruptedException {
> > for (int i = 0; i < repeat; i++) {
> > System.out.print(" (" + (i + 1) + "/" + repeat + ")...");
> > final Process process = pb.start();
> > @@ -343,7 +343,7 @@ public class PerfTestDriver {
> > process.waitFor();
> > stop[0] = true;
> >
> > - File gc = new File("gc" + setupIndex + "_" + i
> > + final File gc = new File("gc" + setupIndex + "_" + i
> > + config._log4jConfig + ".log");
> > if (gc.exists()) {
> > gc.delete();
> > @@ -355,17 +355,17 @@ public class PerfTestDriver {
> > private static Thread printProcessOutput(final Process process,
> > final boolean[] stop) {
> >
> > - Thread t = new Thread("OutputWriter") {
> > + final Thread t = new Thread("OutputWriter") {
> > @Override
> > public void run() {
> > - BufferedReader in = new BufferedReader(new InputStreamReader(
> > + final BufferedReader in = new BufferedReader(new InputStreamReader(
> > process.getInputStream()));
> > try {
> > String line = null;
> > while (!stop[0] && (line = in.readLine()) != null) {
> > System.out.println(line);
> > }
> > - } catch (Exception ignored) {
> > + } catch (final Exception ignored) {
> > }
> > }
> > };
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java Tue Jul 9 06:08:25 2013
> > @@ -42,7 +42,7 @@ class PerfTestResultFormatter {
> > double latency99Pct;
> > double latency99_99Pct;
> >
> > - Stats(String throughput, String avg, String lat99, String lat99_99)
> > + Stats(final String throughput, final String avg, final String lat99, final String lat99_99)
> > throws ParseException {
> > this.throughput = NUM.parse(throughput.trim()).longValue();
> > this.avgLatency = Double.parseDouble(avg.trim());
> > @@ -51,40 +51,40 @@ class PerfTestResultFormatter {
> > }
> > }
> >
> > - private Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
> > + private final Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
> >
> > public PerfTestResultFormatter() {
> > }
> >
> > - public String format(String text) throws ParseException {
> > + public String format(final String text) throws ParseException {
> > results.clear();
> > - String[] lines = text.split("[\\r\\n]+");
> > - for (String line : lines) {
> > + final String[] lines = text.split("[\\r\\n]+");
> > + for (final String line : lines) {
> > process(line);
> > }
> > return latencyTable() + LF + throughputTable();
> > }
> >
> > private String latencyTable() {
> > - StringBuilder sb = new StringBuilder(4 * 1024);
> > - Set<String> subKeys = results.values().iterator().next().keySet();
> > - char[] tabs = new char[subKeys.size()];
> > + final StringBuilder sb = new StringBuilder(4 * 1024);
> > + final Set<String> subKeys = results.values().iterator().next().keySet();
> > + final char[] tabs = new char[subKeys.size()];
> > Arrays.fill(tabs, '\t');
> > - String sep = new String(tabs);
> > + final String sep = new String(tabs);
> > sb.append("\tAverage latency").append(sep).append("99% less than").append(sep).append("99.99% less than");
> > sb.append(LF);
> > for (int i = 0; i < 3; i++) {
> > - for (String subKey : subKeys) {
> > + for (final String subKey : subKeys) {
> > sb.append("\t").append(subKey);
> > }
> > }
> > sb.append(LF);
> > - for (String key : results.keySet()) {
> > + for (final String key : results.keySet()) {
> > sb.append(key);
> > for (int i = 0; i < 3; i++) {
> > - Map<String, Stats> sub = results.get(key);
> > - for (String subKey : sub.keySet()) {
> > - Stats stats = sub.get(subKey);
> > + final Map<String, Stats> sub = results.get(key);
> > + for (final String subKey : sub.keySet()) {
> > + final Stats stats = sub.get(subKey);
> > switch (i) {
> > case 0:
> > sb.append("\t").append((long) stats.avgLatency);
> > @@ -104,19 +104,19 @@ class PerfTestResultFormatter {
> > }
> >
> > private String throughputTable() {
> > - StringBuilder sb = new StringBuilder(4 * 1024);
> > - Set<String> subKeys = results.values().iterator().next().keySet();
> > + final StringBuilder sb = new StringBuilder(4 * 1024);
> > + final Set<String> subKeys = results.values().iterator().next().keySet();
> > sb.append("\tThroughput per thread (msg/sec)");
> > sb.append(LF);
> > - for (String subKey : subKeys) {
> > + for (final String subKey : subKeys) {
> > sb.append("\t").append(subKey);
> > }
> > sb.append(LF);
> > - for (String key : results.keySet()) {
> > + for (final String key : results.keySet()) {
> > sb.append(key);
> > - Map<String, Stats> sub = results.get(key);
> > - for (String subKey : sub.keySet()) {
> > - Stats stats = sub.get(subKey);
> > + final Map<String, Stats> sub = results.get(key);
> > + for (final String subKey : sub.keySet()) {
> > + final Stats stats = sub.get(subKey);
> > sb.append("\t").append(stats.throughput);
> > }
> > sb.append(LF);
> > @@ -124,19 +124,19 @@ class PerfTestResultFormatter {
> > return sb.toString();
> > }
> >
> > - private void process(String line) throws ParseException {
> > - String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
> > - String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
> > - String throughput = line.substring(line.indexOf("throughput: ")
> > + private void process(final String line) throws ParseException {
> > + final String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
> > + final String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
> > + final String throughput = line.substring(line.indexOf("throughput: ")
> > + "throughput: ".length(), line.indexOf(" ops"));
> > - String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
> > + final String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
> > line.indexOf(" 99%"));
> > - String pct99 = line.substring(
> > + final String pct99 = line.substring(
> > line.indexOf("99% < ") + "99% < ".length(),
> > line.indexOf(" 99.99%"));
> > - String pct99_99 = line.substring(line.indexOf("99.99% < ")
> > + final String pct99_99 = line.substring(line.indexOf("99.99% < ")
> > + "99.99% < ".length(), line.lastIndexOf('(') - 1);
> > - Stats stats = new Stats(throughput, avg, pct99, pct99_99);
> > + final Stats stats = new Stats(throughput, avg, pct99, pct99_99);
> > Map<String, Stats> map = results.get(key.trim());
> > if (map == null) {
> > map = new TreeMap<String, Stats>(sort());
> > @@ -156,9 +156,9 @@ class PerfTestResultFormatter {
> > "64 threads");
> >
> > @Override
> > - public int compare(String o1, String o2) {
> > - int i1 = expected.indexOf(o1);
> > - int i2 = expected.indexOf(o2);
> > + public int compare(final String o1, final String o2) {
> > + final int i1 = expected.indexOf(o1);
> > + final int i2 = expected.indexOf(o2);
> > if (i1 < 0 || i2 < 0) {
> > return o1.compareTo(o2);
> > }
> > @@ -167,9 +167,9 @@ class PerfTestResultFormatter {
> > };
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > - PerfTestResultFormatter fmt = new PerfTestResultFormatter();
> > - BufferedReader reader = new BufferedReader(new InputStreamReader(
> > + public static void main(final String[] args) throws Exception {
> > + final PerfTestResultFormatter fmt = new PerfTestResultFormatter();
> > + final BufferedReader reader = new BufferedReader(new InputStreamReader(
> > System.in));
> > String line;
> > while ((line = reader.readLine()) != null) {
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java Tue Jul 9 06:08:25 2013
> > @@ -24,32 +24,32 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLog4j1 implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -62,8 +62,8 @@ public class RunLog4j1 implements IPerfT
> > }
> >
> > @Override
> > - public void log(String finalMessage) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void log(final String finalMessage) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > logger.info(finalMessage);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java Tue Jul 9 06:08:25 2013
> > @@ -25,33 +25,33 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLog4j2 implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -66,8 +66,8 @@ public class RunLog4j2 implements IPerfT
> >
> >
> > @Override
> > - public void log(String finalMessage) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void log(final String finalMessage) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > logger.info(finalMessage);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java Tue Jul 9 06:08:25 2013
> > @@ -26,32 +26,32 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLogback implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -64,8 +64,8 @@ public class RunLogback implements IPerf
> > }
> >
> > @Override
> > - public void log(String msg) {
> > - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > + public void log(final String msg) {
> > + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> > logger.info(msg);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java Tue Jul 9 06:08:25 2013
> > @@ -63,12 +63,12 @@ public class AdvertiserTest {
> > file.delete();
> > }
> >
> > - private void verifyExpectedEntriesAdvertised(Map<Object, Map<String, String>> entries) {
> > + private void verifyExpectedEntriesAdvertised(final Map<Object, Map<String, String>> entries) {
> > boolean foundFile1 = false;
> > boolean foundFile2 = false;
> > boolean foundSocket1 = false;
> > boolean foundSocket2 = false;
> > - for (Map<String, String>entry:entries.values()) {
> > + for (final Map<String, String>entry:entries.values()) {
> > if (foundFile1 && foundFile2 && foundSocket1 && foundSocket2) {
> > break;
> > }
> > @@ -103,7 +103,7 @@ public class AdvertiserTest {
> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> > ctx.stop();
> >
> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > assertTrue("Entries found: " + entries, entries.isEmpty());
> >
> > //reconfigure for subsequent testing
> > @@ -117,7 +117,7 @@ public class AdvertiserTest {
> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> > ctx.stop();
> >
> > - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> > assertTrue("Entries found: " + entries, entries.isEmpty());
> >
> > ctx.start();
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java Tue Jul 9 06:08:25 2013
> > @@ -34,9 +34,9 @@ public class BaseConfigurationTest {
> > @Test
> > public void testMissingRootLogger() throws Exception {
> > PluginManager.addPackage("org.apache.logging.log4j.test.appender");
> > - LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
> > + final LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
> > final Logger logger = LogManager.getLogger("sample.Logger1");
> > - Configuration config = ctx.getConfiguration();
> > + final Configuration config = ctx.getConfiguration();
> > assertNotNull("Config not null", config);
> > // final String MISSINGROOT = "MissingRootTest";
> > // assertTrue("Incorrect Configuration. Expected " + MISSINGROOT + " but found " + config.getName(),
> > @@ -53,15 +53,15 @@ public class BaseConfigurationTest {
> > // only the sample logger, no root logger in loggerMap!
> > assertTrue("contains key=sample", loggerMap.containsKey("sample"));
> >
> > - LoggerConfig sample = loggerMap.get("sample");
> > - Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
> > + final LoggerConfig sample = loggerMap.get("sample");
> > + final Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
> > assertEquals("sampleAppenders Size", 1, sampleAppenders.size());
> > // sample only has List appender, not Console!
> > assertTrue("sample has appender List", sampleAppenders.containsKey("List"));
> >
> > - BaseConfiguration baseConfig = (BaseConfiguration) config;
> > - LoggerConfig root = baseConfig.getRootLogger();
> > - Map<String, Appender<?>> rootAppenders = root.getAppenders();
> > + final BaseConfiguration baseConfig = (BaseConfiguration) config;
> > + final LoggerConfig root = baseConfig.getRootLogger();
> > + final Map<String, Appender<?>> rootAppenders = root.getAppenders();
> > assertEquals("rootAppenders Size", 1, rootAppenders.size());
> > // root only has Console appender!
> > assertTrue("root has appender Console", rootAppenders.containsKey("Console"));
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java Tue Jul 9 06:08:25 2013
> > @@ -28,20 +28,20 @@ public class InMemoryAdvertiser implemen
> >
> > public static Map<Object, Map<String, String>> getAdvertisedEntries()
> > {
> > - Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
> > + final Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
> > result.putAll(properties);
> > return result;
> > }
> >
> > @Override
> > - public Object advertise(Map<String, String> newEntry) {
> > - Object object = new Object();
> > + public Object advertise(final Map<String, String> newEntry) {
> > + final Object object = new Object();
> > properties.put(object, new HashMap<String, String>(newEntry));
> > return object;
> > }
> >
> > @Override
> > - public void unadvertise(Object advertisedObject) {
> > + public void unadvertise(final Object advertisedObject) {
> > properties.remove(advertisedObject);
> > }
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java Tue Jul 9 06:08:25 2013
> > @@ -189,24 +189,24 @@ public class TestConfigurator {
> > public void testEnvironment() throws Exception {
> > final LoggerContext ctx = Configurator.initialize("-config", null, (String) null);
> > final Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
> > - Configuration config = ctx.getConfiguration();
> > + final Configuration config = ctx.getConfiguration();
> > assertNotNull("No configuration", config);
> > assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
> > CONFIG_NAME.equals(config.getName()));
> > final Map<String, Appender<?>> map = config.getAppenders();
> > assertNotNull("No Appenders", map != null && map.size() > 0);
> > Appender<?> app = null;
> > - for (Map.Entry<String, Appender<?>> entry: map.entrySet()) {
> > + for (final Map.Entry<String, Appender<?>> entry: map.entrySet()) {
> > if (entry.getKey().equals("List2")) {
> > app = entry.getValue();
> > break;
> > }
> > }
> > assertNotNull("No ListAppender named List2", app);
> > - Layout layout = app.getLayout();
> > + final Layout layout = app.getLayout();
> > assertNotNull("Appender List2 does not have a Layout", layout);
> > assertTrue("Appender List2 is not configured with a PatternLayout", layout instanceof PatternLayout);
> > - String pattern = ((PatternLayout) layout).getConversionPattern();
> > + final String pattern = ((PatternLayout) layout).getConversionPattern();
> > assertNotNull("No conversion pattern for List2 PatternLayout", pattern);
> > assertFalse("Environment variable was not substituted", pattern.startsWith("${env:PATH}"));
> > }
> >
> > Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
> > URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> > ==============================================================================
> > --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java (original)
> > +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java Tue Jul 9 06:08:25 2013
> > @@ -55,7 +55,7 @@ public class RegexFilterTest {
> >
> > @Test
> > public void TestNoMsg() {
> > - RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
> > + final RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
> > filter.start();
> > assertTrue(filter.isStarted());
> > assertTrue(filter.filter(null, Level.DEBUG, null, (String)null, (Throwable)null) == Filter.Result.DENY);
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
Re: svn commit: r1501104 [4/5] - in /logging/log4j/log4j2/trunk:
api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/
api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j/s...
Posted by Gary Gregory <ga...@gmail.com>.
woa, my IDE was picking up java 7 for my Log4j2 projects instead of Java
6...
Gary
On Tue, Jul 9, 2013 at 4:20 PM, Gary Gregory <ga...@gmail.com> wrote:
> Everything is compiling in Eclipse (Java 6) and Maven (Java 7) but I just
> read Nick's comment. I am running Maven on Java 6 as I write this...
>
> Gary
>
>
> On Tue, Jul 9, 2013 at 4:10 PM, Ralph Goers <ra...@dslextreme.com>wrote:
>
>> After fixing the prior compiler error I then ran into this one:
>>
>> [INFO]
>> ------------------------------------------------------------------------
>> [ERROR] Failed to execute goal
>> org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile
>> (default-testCompile) on project log4j-core: Compilation failure
>> [ERROR]
>> /Users/rgoers/projects/apache/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java:[177,13]
>> variable _averageOpsPerSec might already have been assigned
>>
>> Can you please compile and test before committing?
>>
>> Ralph
>>
>> On Jul 8, 2013, at 11:08 PM, ggregory@apache.org wrote:
>>
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -41,7 +41,7 @@ public class ContextStackAttributeConver
>> >
>> > @Test
>> > public void testConvertToDatabaseColumn01() {
>> > - ThreadContext.ContextStack stack = new
>> MutableThreadContextStack(
>> > + final ThreadContext.ContextStack stack = new
>> MutableThreadContextStack(
>> > Arrays.asList("value1", "another2"));
>> >
>> > assertEquals("The converted value is not correct.",
>> "value1\nanother2",
>> > @@ -50,7 +50,7 @@ public class ContextStackAttributeConver
>> >
>> > @Test
>> > public void testConvertToDatabaseColumn02() {
>> > - ThreadContext.ContextStack stack = new
>> MutableThreadContextStack(
>> > + final ThreadContext.ContextStack stack = new
>> MutableThreadContextStack(
>> > Arrays.asList("key1", "value2", "my3"));
>> >
>> > assertEquals("The converted value is not correct.",
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -42,14 +42,14 @@ public class ContextStackJsonAttributeCo
>> > @Test
>> > public void testConvert01() {
>> > ThreadContext.clearStack();
>> > - ThreadContext.ContextStack stack = new
>> MutableThreadContextStack(
>> > + final ThreadContext.ContextStack stack = new
>> MutableThreadContextStack(
>> > Arrays.asList("value1", "another2"));
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(stack);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(stack);
>> >
>> > assertNotNull("The converted value should not be null.",
>> converted);
>> >
>> > - ThreadContext.ContextStack reversed = this.converter
>> > + final ThreadContext.ContextStack reversed = this.converter
>> > .convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > @@ -60,14 +60,14 @@ public class ContextStackJsonAttributeCo
>> > @Test
>> > public void testConvert02() {
>> > ThreadContext.clearStack();
>> > - ThreadContext.ContextStack stack = new
>> MutableThreadContextStack(
>> > + final ThreadContext.ContextStack stack = new
>> MutableThreadContextStack(
>> > Arrays.asList("key1", "value2", "my3"));
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(stack);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(stack);
>> >
>> > assertNotNull("The converted value should not be null.",
>> converted);
>> >
>> > - ThreadContext.ContextStack reversed = this.converter
>> > + final ThreadContext.ContextStack reversed = this.converter
>> > .convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -39,14 +39,14 @@ public class MarkerAttributeConverterTes
>> >
>> > @Test
>> > public void testConvert01() {
>> > - Marker marker = MarkerManager.getMarker("testConvert01");
>> > + final Marker marker = MarkerManager.getMarker("testConvert01");
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(marker);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(marker);
>> >
>> > assertNotNull("The converted value should not be null.",
>> converted);
>> > assertEquals("The converted value is not correct.",
>> "testConvert01", converted);
>> >
>> > - Marker reversed =
>> this.converter.convertToEntityAttribute(converted);
>> > + final Marker reversed =
>> this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.",
>> "testConvert01", marker.getName());
>> > @@ -54,19 +54,19 @@ public class MarkerAttributeConverterTes
>> >
>> > @Test
>> > public void testConvert02() {
>> > - Marker marker = MarkerManager.getMarker("testConvert02",
>> > + final Marker marker = MarkerManager.getMarker("testConvert02",
>> > MarkerManager.getMarker("anotherConvert02",
>> > MarkerManager.getMarker("finalConvert03")
>> > )
>> > );
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(marker);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(marker);
>> >
>> > assertNotNull("The converted value should not be null.",
>> converted);
>> > assertEquals("The converted value is not correct.",
>> "testConvert02[ anotherConvert02[ finalConvert03 ] ] ]",
>> > converted);
>> >
>> > - Marker reversed =
>> this.converter.convertToEntityAttribute(converted);
>> > + final Marker reversed =
>> this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.",
>> "testConvert02", marker.getName());
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -41,14 +41,14 @@ public class MessageAttributeConverterTe
>> >
>> > @Test
>> > public void testConvert01() {
>> > - Message message = log.getMessageFactory().newMessage("Message
>> #{} said [{}].", 3, "Hello");
>> > + final Message message =
>> log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(message);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(message);
>> >
>> > assertNotNull("The converted value should not be null.",
>> converted);
>> > assertEquals("The converted value is not correct.", "Message #3
>> said [Hello].", converted);
>> >
>> > - Message reversed =
>> this.converter.convertToEntityAttribute(converted);
>> > + final Message reversed =
>> this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.", "Message #3
>> said [Hello].", reversed.getFormattedMessage());
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -37,15 +37,15 @@ public class StackTraceElementAttributeC
>> >
>> > @Test
>> > public void testConvert01() {
>> > - StackTraceElement element = new
>> StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java",
>> 1234);
>> > + final StackTraceElement element = new
>> StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java",
>> 1234);
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(element);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(element);
>> >
>> > assertNotNull("The converted value should not be null.",
>> converted);
>> > assertEquals("The converted value is not correct.",
>> "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
>> > converted);
>> >
>> > - StackTraceElement reversed =
>> this.converter.convertToEntityAttribute(converted);
>> > + final StackTraceElement reversed =
>> this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The class name is not correct.", "TestNoPackage",
>> reversed.getClassName());
>> > @@ -57,17 +57,17 @@ public class StackTraceElementAttributeC
>> >
>> > @Test
>> > public void testConvert02() {
>> > - StackTraceElement element = new
>> StackTraceElement("org.apache.logging.TestWithPackage",
>> > + final StackTraceElement element = new
>> StackTraceElement("org.apache.logging.TestWithPackage",
>> > "testConvert02", "TestWithPackage.java", -1);
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(element);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(element);
>> >
>> > assertNotNull("The converted value should not be null.",
>> converted);
>> > assertEquals("The converted value is not correct.",
>> >
>> "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
>> > converted);
>> >
>> > - StackTraceElement reversed =
>> this.converter.convertToEntityAttribute(converted);
>> > + final StackTraceElement reversed =
>> this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The class name is not correct.",
>> "org.apache.logging.TestWithPackage", reversed.getClassName());
>> > @@ -79,17 +79,17 @@ public class StackTraceElementAttributeC
>> >
>> > @Test
>> > public void testConvert03() {
>> > - StackTraceElement element = new
>> StackTraceElement("org.apache.logging.TestNoSource",
>> > + final StackTraceElement element = new
>> StackTraceElement("org.apache.logging.TestNoSource",
>> > "testConvert03", null, -1);
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(element);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(element);
>> >
>> > assertNotNull("The converted value should not be null.",
>> converted);
>> > assertEquals("The converted value is not correct.",
>> > "org.apache.logging.TestNoSource.testConvert03(Unknown
>> Source)",
>> > converted);
>> >
>> > - StackTraceElement reversed =
>> this.converter.convertToEntityAttribute(converted);
>> > + final StackTraceElement reversed =
>> this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The class name is not correct.",
>> "org.apache.logging.TestNoSource", reversed.getClassName());
>> > @@ -101,17 +101,17 @@ public class StackTraceElementAttributeC
>> >
>> > @Test
>> > public void testConvert04() {
>> > - StackTraceElement element = new
>> StackTraceElement("org.apache.logging.TestIsNativeMethod",
>> > + final StackTraceElement element = new
>> StackTraceElement("org.apache.logging.TestIsNativeMethod",
>> > "testConvert04", null, -2);
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(element);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(element);
>> >
>> > assertNotNull("The converted value should not be null.",
>> converted);
>> > assertEquals("The converted value is not correct.",
>> >
>> "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
>> > converted);
>> >
>> > - StackTraceElement reversed =
>> this.converter.convertToEntityAttribute(converted);
>> > + final StackTraceElement reversed =
>> this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The class name is not correct.",
>> "org.apache.logging.TestIsNativeMethod",
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -39,16 +39,16 @@ public class ThrowableAttributeConverter
>> >
>> > @Test
>> > public void testConvert01() {
>> > - RuntimeException exception = new RuntimeException("My message
>> 01.");
>> > + final RuntimeException exception = new RuntimeException("My
>> message 01.");
>> >
>> > - String stackTrace = getStackTrace(exception);
>> > + final String stackTrace = getStackTrace(exception);
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(exception);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(exception);
>> >
>> > assertNotNull("The converted value is not correct.", converted);
>> > assertEquals("The converted value is not correct.", stackTrace,
>> converted);
>> >
>> > - Throwable reversed =
>> this.converter.convertToEntityAttribute(converted);
>> > + final Throwable reversed =
>> this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.", stackTrace,
>> getStackTrace(reversed));
>> > @@ -56,18 +56,18 @@ public class ThrowableAttributeConverter
>> >
>> > @Test
>> > public void testConvert02() {
>> > - SQLException cause2 = new SQLException("This is a test
>> cause.");
>> > - Error cause1 = new Error(cause2);
>> > - RuntimeException exception = new RuntimeException("My message
>> 01.", cause1);
>> > + final SQLException cause2 = new SQLException("This is a test
>> cause.");
>> > + final Error cause1 = new Error(cause2);
>> > + final RuntimeException exception = new RuntimeException("My
>> message 01.", cause1);
>> >
>> > - String stackTrace = getStackTrace(exception);
>> > + final String stackTrace = getStackTrace(exception);
>> >
>> > - String converted =
>> this.converter.convertToDatabaseColumn(exception);
>> > + final String converted =
>> this.converter.convertToDatabaseColumn(exception);
>> >
>> > assertNotNull("The converted value is not correct.", converted);
>> > assertEquals("The converted value is not correct.", stackTrace,
>> converted);
>> >
>> > - Throwable reversed =
>> this.converter.convertToEntityAttribute(converted);
>> > + final Throwable reversed =
>> this.converter.convertToEntityAttribute(converted);
>> >
>> > assertNotNull("The reversed value should not be null.", reversed);
>> > assertEquals("The reversed value is not correct.", stackTrace,
>> getStackTrace(reversed));
>> > @@ -84,10 +84,10 @@ public class ThrowableAttributeConverter
>> > assertNull("The converted attribute should be null (2).",
>> this.converter.convertToEntityAttribute(""));
>> > }
>> >
>> > - private static String getStackTrace(Throwable throwable) {
>> > + private static String getStackTrace(final Throwable throwable) {
>> > String returnValue = throwable.toString() + "\n";
>> >
>> > - for (StackTraceElement element : throwable.getStackTrace()) {
>> > + for (final StackTraceElement element :
>> throwable.getStackTrace()) {
>> > returnValue += "\tat " + element.toString() + "\n";
>> > }
>> >
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -51,7 +51,7 @@ public class MapRewritePolicyTest {
>> > logEvent1 = new Log4jLogEvent("test", null,
>> "MapRewritePolicyTest.setupClass()", Level.ERROR,
>> > new MapMessage(map), null, map, null, "none",
>> > new StackTraceElement("MapRewritePolicyTest", "setupClass",
>> "MapRewritePolicyTest", 29), 2);
>> > - ThreadContextStack stack = new MutableThreadContextStack(new
>> ArrayList<String>(map.values()));
>> > + final ThreadContextStack stack = new MutableThreadContextStack(new
>> ArrayList<String>(map.values()));
>> > logEvent2 = new Log4jLogEvent("test",
>> MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
>> > Level.TRACE, new StructuredDataMessage("test", "Nothing", "test",
>> map), new RuntimeException("test"), null,
>> > stack, "none", new StackTraceElement("MapRewritePolicyTest",
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -112,7 +112,7 @@ public class RewriteAppenderTest {
>> > StructuredDataMessage msg = new StructuredDataMessage("Test",
>> "This is a test", "Service");
>> > msg.put("Key1", "Value2");
>> > msg.put("Key2", "Value1");
>> > - Logger logger =
>> LogManager.getLogger("org.apache.logging.log4j.core.Logging");
>> > + final Logger logger =
>> LogManager.getLogger("org.apache.logging.log4j.core.Logging");
>> > logger.debug(msg);
>> > msg = new StructuredDataMessage("Test", "This is a test",
>> "Service");
>> > msg.put("Key1", "Value1");
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -40,23 +40,23 @@ public class FastRollingFileManagerTest
>> > */
>> > @Test
>> > public void testWrite_multiplesOfBufferSize() throws IOException {
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
>> > - OutputStream os = new
>> FastRollingFileManager.DummyOutputStream();
>> > - boolean append = false;
>> > - boolean flushNow = false;
>> > - long triggerSize = Long.MAX_VALUE;
>> > - long time = System.currentTimeMillis();
>> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
>> > + final OutputStream os = new
>> FastRollingFileManager.DummyOutputStream();
>> > + final boolean append = false;
>> > + final boolean flushNow = false;
>> > + final long triggerSize = Long.MAX_VALUE;
>> > + final long time = System.currentTimeMillis();
>> > + final TriggeringPolicy triggerPolicy = new
>> SizeBasedTriggeringPolicy(
>> > triggerSize);
>> > - RolloverStrategy rolloverStrategy = null;
>> > - FastRollingFileManager manager = new
>> FastRollingFileManager(raf,
>> > + final RolloverStrategy rolloverStrategy = null;
>> > + final FastRollingFileManager manager = new
>> FastRollingFileManager(raf,
>> > file.getName(), "", os, append, flushNow, triggerSize,
>> time,
>> > triggerPolicy, rolloverStrategy, null, null);
>> >
>> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
>> > - byte[] data = new byte[size];
>> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE *
>> 3;
>> > + final byte[] data = new byte[size];
>> > manager.write(data, 0, data.length); // no buffer overflow
>> exception
>> >
>> > // buffer is full but not flushed yet
>> > @@ -71,23 +71,23 @@ public class FastRollingFileManagerTest
>> > */
>> > @Test
>> > public void testWrite_dataExceedingBufferSize() throws IOException {
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
>> > - OutputStream os = new
>> FastRollingFileManager.DummyOutputStream();
>> > - boolean append = false;
>> > - boolean flushNow = false;
>> > - long triggerSize = 0;
>> > - long time = System.currentTimeMillis();
>> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
>> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
>> > + final OutputStream os = new
>> FastRollingFileManager.DummyOutputStream();
>> > + final boolean append = false;
>> > + final boolean flushNow = false;
>> > + final long triggerSize = 0;
>> > + final long time = System.currentTimeMillis();
>> > + final TriggeringPolicy triggerPolicy = new
>> SizeBasedTriggeringPolicy(
>> > triggerSize);
>> > - RolloverStrategy rolloverStrategy = null;
>> > - FastRollingFileManager manager = new
>> FastRollingFileManager(raf,
>> > + final RolloverStrategy rolloverStrategy = null;
>> > + final FastRollingFileManager manager = new
>> FastRollingFileManager(raf,
>> > file.getName(), "", os, append, flushNow, triggerSize,
>> time,
>> > triggerPolicy, rolloverStrategy, null, null);
>> >
>> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
>> > - byte[] data = new byte[size];
>> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE *
>> 3 + 1;
>> > + final byte[] data = new byte[size];
>> > manager.write(data, 0, data.length); // no exception
>> > assertEquals(FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3,
>> > raf.length());
>> > @@ -98,12 +98,12 @@ public class FastRollingFileManagerTest
>> >
>> > @Test
>> > public void testAppendDoesNotOverwriteExistingFile() throws
>> IOException {
>> > - boolean isAppend = true;
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final boolean isAppend = true;
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > assertEquals(0, file.length());
>> >
>> > - byte[] bytes = new byte[4 * 1024];
>> > + final byte[] bytes = new byte[4 * 1024];
>> >
>> > // create existing file
>> > FileOutputStream fos = null;
>> > @@ -116,31 +116,31 @@ public class FastRollingFileManagerTest
>> > }
>> > assertEquals("all flushed to disk", bytes.length, file.length());
>> >
>> > - FastRollingFileManager manager = FastRollingFileManager
>> > + final FastRollingFileManager manager = FastRollingFileManager
>> > .getFastRollingFileManager(
>> > //
>> > file.getAbsolutePath(), "", isAppend, true,
>> > new SizeBasedTriggeringPolicy(Long.MAX_VALUE), //
>> > null, null, null);
>> > manager.write(bytes, 0, bytes.length);
>> > - int expected = bytes.length * 2;
>> > + final int expected = bytes.length * 2;
>> > assertEquals("appended, not overwritten", expected,
>> file.length());
>> > }
>> >
>> > @Test
>> > public void testFileTimeBasedOnSystemClockWhenAppendIsFalse()
>> > throws IOException {
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > LockSupport.parkNanos(1000000); // 1 millisec
>> >
>> > // append is false deletes the file if it exists
>> > - boolean isAppend = false;
>> > - long expectedMin = System.currentTimeMillis();
>> > - long expectedMax = expectedMin + 50;
>> > + final boolean isAppend = false;
>> > + final long expectedMin = System.currentTimeMillis();
>> > + final long expectedMax = expectedMin + 50;
>> > assertTrue(file.lastModified() < expectedMin);
>> >
>> > - FastRollingFileManager manager = FastRollingFileManager
>> > + final FastRollingFileManager manager = FastRollingFileManager
>> > .getFastRollingFileManager(
>> > //
>> > file.getAbsolutePath(), "", isAppend, true,
>> > @@ -153,14 +153,14 @@ public class FastRollingFileManagerTest
>> > @Test
>> > public void testFileTimeBasedOnFileModifiedTimeWhenAppendIsTrue()
>> > throws IOException {
>> > - File file = File.createTempFile("log4j2", "test");
>> > + final File file = File.createTempFile("log4j2", "test");
>> > file.deleteOnExit();
>> > LockSupport.parkNanos(1000000); // 1 millisec
>> >
>> > - boolean isAppend = true;
>> > + final boolean isAppend = true;
>> > assertTrue(file.lastModified() < System.currentTimeMillis());
>> >
>> > - FastRollingFileManager manager = FastRollingFileManager
>> > + final FastRollingFileManager manager = FastRollingFileManager
>> > .getFastRollingFileManager(
>> > //
>> > file.getAbsolutePath(), "", isAppend, true,
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -35,7 +35,7 @@ public class FileRenameActionTest {
>> >
>> > @BeforeClass
>> > public static void beforeClass() throws Exception {
>> > - File file = new File(DIR);
>> > + final File file = new File(DIR);
>> > file.mkdirs();
>> > }
>> >
>> > @@ -51,15 +51,15 @@ public class FileRenameActionTest {
>> >
>> > @Test
>> > public void testRename1() throws Exception {
>> > - File file = new File("target/fileRename/fileRename.log");
>> > - PrintStream pos = new PrintStream(file);
>> > + final File file = new File("target/fileRename/fileRename.log");
>> > + final PrintStream pos = new PrintStream(file);
>> > for (int i = 0; i < 100; ++i) {
>> > pos.println("This is line " + i);
>> > }
>> > pos.close();
>> >
>> > - File dest = new File("target/fileRename/newFile.log");
>> > - FileRenameAction action = new FileRenameAction(file, dest,
>> false);
>> > + final File dest = new File("target/fileRename/newFile.log");
>> > + final FileRenameAction action = new FileRenameAction(file,
>> dest, false);
>> > action.execute();
>> > assertTrue("Renamed file does not exist", dest.exists());
>> > assertTrue("Old file exists", !file.exists());
>> > @@ -67,12 +67,12 @@ public class FileRenameActionTest {
>> >
>> > @Test
>> > public void testEmpty() throws Exception {
>> > - File file = new File("target/fileRename/fileRename.log");
>> > - PrintStream pos = new PrintStream(file);
>> > + final File file = new File("target/fileRename/fileRename.log");
>> > + final PrintStream pos = new PrintStream(file);
>> > pos.close();
>> >
>> > - File dest = new File("target/fileRename/newFile.log");
>> > - FileRenameAction action = new FileRenameAction(file, dest,
>> false);
>> > + final File dest = new File("target/fileRename/newFile.log");
>> > + final FileRenameAction action = new FileRenameAction(file,
>> dest, false);
>> > action.execute();
>> > assertTrue("Renamed file does not exist", !dest.exists());
>> > assertTrue("Old file does not exist", !file.exists());
>> > @@ -81,16 +81,16 @@ public class FileRenameActionTest {
>> >
>> > @Test
>> > public void testNoParent() throws Exception {
>> > - File file = new File("fileRename.log");
>> > - PrintStream pos = new PrintStream(file);
>> > + final File file = new File("fileRename.log");
>> > + final PrintStream pos = new PrintStream(file);
>> > for (int i = 0; i < 100; ++i) {
>> > pos.println("This is line " + i);
>> > }
>> > pos.close();
>> >
>> > - File dest = new File("newFile.log");
>> > + final File dest = new File("newFile.log");
>> > try {
>> > - FileRenameAction action = new FileRenameAction(file, dest,
>> false);
>> > + final FileRenameAction action = new FileRenameAction(file,
>> dest, false);
>> > action.execute();
>> > assertTrue("Renamed file does not exist", dest.exists());
>> > assertTrue("Old file exists", !file.exists());
>> > @@ -98,7 +98,7 @@ public class FileRenameActionTest {
>> > try {
>> > dest.delete();
>> > file.delete();
>> > - } catch (Exception ex) {
>> > + } catch (final Exception ex) {
>> > System.out.println("Unable to cleanup files written to
>> main directory");
>> > }
>> > }
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -39,17 +39,17 @@ public class AsyncLoggerConfigTest {
>> >
>> > @Test
>> > public void testAdditivity() throws Exception {
>> > - File f = new File("target", "AsyncLoggerConfigTest.log");
>> > + final File f = new File("target", "AsyncLoggerConfigTest.log");
>> > // System.out.println(f.getAbsolutePath());
>> > f.delete();
>> > - Logger log = LogManager.getLogger("com.foo.Bar");
>> > - String msg = "Additive logging: 2 for the price of 1!";
>> > + final Logger log = LogManager.getLogger("com.foo.Bar");
>> > + final String msg = "Additive logging: 2 for the price of 1!";
>> > log.info(msg);
>> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>> >
>> > - BufferedReader reader = new BufferedReader(new FileReader(f));
>> > - String line1 = reader.readLine();
>> > - String line2 = reader.readLine();
>> > + final BufferedReader reader = new BufferedReader(new
>> FileReader(f));
>> > + final String line1 = reader.readLine();
>> > + final String line2 = reader.readLine();
>> > reader.close();
>> > f.delete();
>> > assertNotNull("line1", line1);
>> > @@ -57,7 +57,7 @@ public class AsyncLoggerConfigTest {
>> > assertTrue("line1 correct", line1.contains(msg));
>> > assertTrue("line2 correct", line2.contains(msg));
>> >
>> > - String location = "testAdditivity";
>> > + final String location = "testAdditivity";
>> > assertTrue("location",
>> > line1.contains(location) || line2.contains(location));
>> > }
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -29,24 +29,24 @@ public class AsyncLoggerContextSelectorT
>> >
>> > @Test
>> > public void testContextReturnsAsyncLoggerContext() {
>> > - AsyncLoggerContextSelector selector = new
>> AsyncLoggerContextSelector();
>> > - LoggerContext context = selector.getContext(null, null, false);
>> > + final AsyncLoggerContextSelector selector = new
>> AsyncLoggerContextSelector();
>> > + final LoggerContext context = selector.getContext(null, null,
>> false);
>> >
>> > assertTrue(context instanceof AsyncLoggerContext);
>> > }
>> >
>> > @Test
>> > public void testContext2ReturnsAsyncLoggerContext() {
>> > - AsyncLoggerContextSelector selector = new
>> AsyncLoggerContextSelector();
>> > - LoggerContext context = selector.getContext(null, null, false,
>> null);
>> > + final AsyncLoggerContextSelector selector = new
>> AsyncLoggerContextSelector();
>> > + final LoggerContext context = selector.getContext(null, null,
>> false, null);
>> >
>> > assertTrue(context instanceof AsyncLoggerContext);
>> > }
>> >
>> > @Test
>> > public void testLoggerContextsReturnsAsyncLoggerContext() {
>> > - AsyncLoggerContextSelector selector = new
>> AsyncLoggerContextSelector();
>> > - List<LoggerContext> list = selector.getLoggerContexts();
>> > + final AsyncLoggerContextSelector selector = new
>> AsyncLoggerContextSelector();
>> > + final List<LoggerContext> list = selector.getLoggerContexts();
>> >
>> > assertEquals(1, list.size());
>> > assertTrue(list.get(0) instanceof AsyncLoggerContext);
>> > @@ -54,8 +54,8 @@ public class AsyncLoggerContextSelectorT
>> >
>> > @Test
>> > public void testContextNameIsAsyncLoggerContext() {
>> > - AsyncLoggerContextSelector selector = new
>> AsyncLoggerContextSelector();
>> > - LoggerContext context = selector.getContext(null, null, false);
>> > + final AsyncLoggerContextSelector selector = new
>> AsyncLoggerContextSelector();
>> > + final LoggerContext context = selector.getContext(null, null,
>> false);
>> >
>> > assertEquals("AsyncLoggerContext", context.getName());
>> > }
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -30,7 +30,7 @@ public class AsyncLoggerContextTest {
>> >
>> > @Test
>> > public void testNewInstanceReturnsAsyncLogger() {
>> > - Logger logger = new AsyncLoggerContext("a").newInstance(
>> > + final Logger logger = new AsyncLoggerContext("a").newInstance(
>> > new LoggerContext("a"), "a", null);
>> > assertTrue(logger instanceof AsyncLogger);
>> >
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -49,22 +49,22 @@ public class AsyncLoggerLocationTest {
>> >
>> > @Test
>> > public void testAsyncLogWritesToLog() throws Exception {
>> > - File f = new File("target", "AsyncLoggerLocationTest.log");
>> > + final File f = new File("target",
>> "AsyncLoggerLocationTest.log");
>> > // System.out.println(f.getAbsolutePath());
>> > f.delete();
>> > - Logger log = LogManager.getLogger("com.foo.Bar");
>> > - String msg = "Async logger msg with location";
>> > + final Logger log = LogManager.getLogger("com.foo.Bar");
>> > + final String msg = "Async logger msg with location";
>> > log.info(msg);
>> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>> >
>> > - BufferedReader reader = new BufferedReader(new FileReader(f));
>> > - String line1 = reader.readLine();
>> > + final BufferedReader reader = new BufferedReader(new
>> FileReader(f));
>> > + final String line1 = reader.readLine();
>> > reader.close();
>> > f.delete();
>> > assertNotNull("line1", line1);
>> > assertTrue("line1 correct", line1.contains(msg));
>> >
>> > - String location = "testAsyncLogWritesToLog";
>> > + final String location = "testAsyncLogWritesToLog";
>> > assertTrue("has location", line1.contains(location));
>> > }
>> >
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -49,22 +49,22 @@ public class AsyncLoggerTest {
>> >
>> > @Test
>> > public void testAsyncLogWritesToLog() throws Exception {
>> > - File f = new File("target", "AsyncLoggerTest.log");
>> > + final File f = new File("target", "AsyncLoggerTest.log");
>> > // System.out.println(f.getAbsolutePath());
>> > f.delete();
>> > - Logger log = LogManager.getLogger("com.foo.Bar");
>> > - String msg = "Async logger msg";
>> > + final Logger log = LogManager.getLogger("com.foo.Bar");
>> > + final String msg = "Async logger msg";
>> > log.info(msg);
>> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>> >
>> > - BufferedReader reader = new BufferedReader(new FileReader(f));
>> > - String line1 = reader.readLine();
>> > + final BufferedReader reader = new BufferedReader(new
>> FileReader(f));
>> > + final String line1 = reader.readLine();
>> > reader.close();
>> > f.delete();
>> > assertNotNull("line1", line1);
>> > assertTrue("line1 correct", line1.contains(msg));
>> >
>> > - String location = "testAsyncLogWritesToLog";
>> > + final String location = "testAsyncLogWritesToLog";
>> > assertTrue("no location", !line1.contains(location));
>> > }
>> >
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -22,23 +22,23 @@ import com.lmax.disruptor.collections.Hi
>> >
>> > public class MTPerfTest extends PerfTest {
>> >
>> > - public static void main(String[] args) throws Exception {
>> > + public static void main(final String[] args) throws Exception {
>> > new MTPerfTest().doMain(args);
>> > }
>> >
>> > @Override
>> > public void runTestAndPrintResult(final IPerfTestRunner runner,
>> > - final String name, final int threadCount, String
>> resultFile)
>> > + final String name, final int threadCount, final
>> String resultFile)
>> > throws Exception {
>> >
>> > // ThreadContext.put("aKey", "mdcVal");
>> > PerfTest.println("Warming up the JVM...");
>> > - long t1 = System.nanoTime();
>> > + final long t1 = System.nanoTime();
>> >
>> > // warmup at least 2 rounds and at most 1 minute
>> > final Histogram warmupHist = PerfTest.createHistogram();
>> > final long stop = System.currentTimeMillis() + (60 *
>> 1000);
>> > - Runnable run1 = new Runnable() {
>> > + final Runnable run1 = new Runnable() {
>> > @Override
>> > public void run() {
>> > for (int i = 0; i < 10; i++) {
>> > @@ -50,8 +50,8 @@ public class MTPerfTest extends PerfTest
>> > }
>> > }
>> > };
>> > - Thread thread1 = new Thread(run1);
>> > - Thread thread2 = new Thread(run1);
>> > + final Thread thread1 = new Thread(run1);
>> > + final Thread thread2 = new Thread(run1);
>> > thread1.start();
>> > thread2.start();
>> > thread1.join();
>> > @@ -74,7 +74,7 @@ public class MTPerfTest extends PerfTest
>> > }
>> >
>> > private void multiThreadedTestRun(final IPerfTestRunner runner,
>> > - final String name, final int threadCount, String
>> resultFile)
>> > + final String name, final int threadCount, final
>> String resultFile)
>> > throws Exception {
>> >
>> > final Histogram[] histograms = new Histogram[threadCount];
>> > @@ -83,28 +83,28 @@ public class MTPerfTest extends PerfTest
>> > }
>> > final int LINES = 256 * 1024;
>> >
>> > - Thread[] threads = new Thread[threadCount];
>> > + final Thread[] threads = new Thread[threadCount];
>> > for (int i = 0; i < threads.length; i++) {
>> > final Histogram histogram = histograms[i];
>> > threads[i] = new Thread() {
>> > @Override
>> > public void run() {
>> > // int latencyCount = threadCount >= 16
>> ? 1000000 : 5000000;
>> > - int latencyCount = 5000000;
>> > - int count = PerfTest.throughput ?
>> LINES / threadCount
>> > + final int latencyCount = 5000000;
>> > + final int count =
>> PerfTest.throughput ? LINES / threadCount
>> > : latencyCount;
>> > runTest(runner, count, "end",
>> histogram, threadCount);
>> > }
>> > };
>> > }
>> > - for (Thread thread : threads) {
>> > + for (final Thread thread : threads) {
>> > thread.start();
>> > }
>> > - for (Thread thread : threads) {
>> > + for (final Thread thread : threads) {
>> > thread.join();
>> > }
>> >
>> > - for (Histogram histogram : histograms) {
>> > + for (final Histogram histogram : histograms) {
>> > PerfTest.reportResult(resultFile, name,
>> histogram);
>> > }
>> > }
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -33,7 +33,7 @@ public class PerfTest {
>> > // determine how long it takes to call System.nanoTime() (on
>> average)
>> > static long calcNanoTimeCost() {
>> > final long iterations = 10000000;
>> > - long start = System.nanoTime();
>> > + final long start = System.nanoTime();
>> > long finish = start;
>> >
>> > for (int i = 0; i < iterations; i++) {
>> > @@ -49,7 +49,7 @@ public class PerfTest {
>> > }
>> >
>> > static Histogram createHistogram() {
>> > - long[] intervals = new long[31];
>> > + final long[] intervals = new long[31];
>> > long intervalUpperBound = 1L;
>> > for (int i = 0, size = intervals.length - 1; i < size;
>> i++) {
>> > intervalUpperBound *= 2;
>> > @@ -60,17 +60,17 @@ public class PerfTest {
>> > return new Histogram(intervals);
>> > }
>> >
>> > - public static void main(String[] args) throws Exception {
>> > + public static void main(final String[] args) throws Exception {
>> > new PerfTest().doMain(args);
>> > }
>> >
>> > - public void doMain(String[] args) throws Exception {
>> > - String runnerClass = args[0];
>> > - IPerfTestRunner runner = (IPerfTestRunner)
>> Class.forName(runnerClass)
>> > + public void doMain(final String[] args) throws Exception {
>> > + final String runnerClass = args[0];
>> > + final IPerfTestRunner runner = (IPerfTestRunner)
>> Class.forName(runnerClass)
>> > .newInstance();
>> > - String name = args[1];
>> > - String resultFile = args.length > 2 ? args[2] : null;
>> > - for (String arg : args) {
>> > + final String name = args[1];
>> > + final String resultFile = args.length > 2 ? args[2] :
>> null;
>> > + for (final String arg : args) {
>> > if (verbose && throughput) {
>> > break;
>> > }
>> > @@ -81,7 +81,7 @@ public class PerfTest {
>> > throughput = true;
>> > }
>> > }
>> > - int threadCount = args.length > 2 ?
>> Integer.parseInt(args[3]) : 3;
>> > + final int threadCount = args.length > 2 ?
>> Integer.parseInt(args[3]) : 3;
>> > printf("Starting %s %s (%d)...%n",
>> getClass().getSimpleName(), name,
>> > threadCount);
>> > runTestAndPrintResult(runner, name, threadCount,
>> resultFile);
>> > @@ -89,14 +89,14 @@ public class PerfTest {
>> > System.exit(0);
>> > }
>> >
>> > - public void runTestAndPrintResult(IPerfTestRunner runner,
>> > - final String name, int threadCount, String
>> resultFile)
>> > + public void runTestAndPrintResult(final IPerfTestRunner runner,
>> > + final String name, final int threadCount, final
>> String resultFile)
>> > throws Exception {
>> > - Histogram warmupHist = createHistogram();
>> > + final Histogram warmupHist = createHistogram();
>> >
>> > // ThreadContext.put("aKey", "mdcVal");
>> > println("Warming up the JVM...");
>> > - long t1 = System.nanoTime();
>> > + final long t1 = System.nanoTime();
>> >
>> > // warmup at least 2 rounds and at most 1 minute
>> > final long stop = System.currentTimeMillis() + (60 *
>> 1000);
>> > @@ -124,46 +124,46 @@ public class PerfTest {
>> > runSingleThreadedTest(runner, name, resultFile);
>> > }
>> >
>> > - private int runSingleThreadedTest(IPerfTestRunner runner, String
>> name,
>> > - String resultFile) throws IOException {
>> > - Histogram latency = createHistogram();
>> > + private int runSingleThreadedTest(final IPerfTestRunner runner,
>> final String name,
>> > + final String resultFile) throws IOException {
>> > + final Histogram latency = createHistogram();
>> > final int LINES = throughput ? 50000 : 5000000;
>> > runTest(runner, LINES, "end", latency, 1);
>> > reportResult(resultFile, name, latency);
>> > return LINES;
>> > }
>> >
>> > - static void reportResult(String file, String name, Histogram
>> histogram)
>> > + static void reportResult(final String file, final String name,
>> final Histogram histogram)
>> > throws IOException {
>> > - String result = createSamplingReport(name, histogram);
>> > + final String result = createSamplingReport(name,
>> histogram);
>> > println(result);
>> >
>> > if (file != null) {
>> > - FileWriter writer = new FileWriter(file, true);
>> > + final FileWriter writer = new FileWriter(file,
>> true);
>> > writer.write(result);
>> >
>> writer.write(System.getProperty("line.separator"));
>> > writer.close();
>> > }
>> > }
>> >
>> > - static void printf(String msg, Object... objects) {
>> > + static void printf(final String msg, final Object... objects) {
>> > if (verbose) {
>> > System.out.printf(msg, objects);
>> > }
>> > }
>> >
>> > - static void println(String msg) {
>> > + static void println(final String msg) {
>> > if (verbose) {
>> > System.out.println(msg);
>> > }
>> > }
>> >
>> > - static String createSamplingReport(String name, Histogram
>> histogram) {
>> > - Histogram data = histogram;
>> > + static String createSamplingReport(final String name, final
>> Histogram histogram) {
>> > + final Histogram data = histogram;
>> > if (throughput) {
>> > return data.getMax() + " operations/second";
>> > }
>> > - String result = String.format(
>> > + final String result = String.format(
>> > "avg=%.0f 99%%=%d 99.99%%=%d
>> sampleCount=%d", data.getMean(), //
>> > data.getTwoNinesUpperBound(), //
>> > data.getFourNinesUpperBound(), //
>> > @@ -172,12 +172,12 @@ public class PerfTest {
>> > return result;
>> > }
>> >
>> > - public void runTest(IPerfTestRunner runner, int lines, String
>> finalMessage,
>> > - Histogram histogram, int threadCount) {
>> > + public void runTest(final IPerfTestRunner runner, final int
>> lines, final String finalMessage,
>> > + final Histogram histogram, final int threadCount)
>> {
>> > if (throughput) {
>> > runner.runThroughputTest(lines, histogram);
>> > } else {
>> > - long nanoTimeCost = calcNanoTimeCost();
>> > + final long nanoTimeCost = calcNanoTimeCost();
>> > runner.runLatencyTest(lines, histogram,
>> nanoTimeCost, threadCount);
>> > }
>> > if (finalMessage != null) {
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -41,19 +41,19 @@ public class PerfTestDriver {
>> > * Defines the setup for a java process running a performance test.
>> > */
>> > static class Setup implements Comparable<Setup> {
>> > - private Class<?> _class;
>> > - private String _log4jConfig;
>> > - private String _name;
>> > - private String[] _systemProperties;
>> > - private int _threadCount;
>> > - private File _temp;
>> > + private final Class<?> _class;
>> > + private final String _log4jConfig;
>> > + private final String _name;
>> > + private final String[] _systemProperties;
>> > + private final int _threadCount;
>> > + private final File _temp;
>> > public Stats _stats;
>> > - private WaitStrategy _wait;
>> > - private String _runner;
>> > + private final WaitStrategy _wait;
>> > + private final String _runner;
>> >
>> > - public Setup(Class<?> klass, String runner, String name,
>> > - String log4jConfig, int threadCount, WaitStrategy wait,
>> > - String... systemProperties) throws IOException {
>> > + public Setup(final Class<?> klass, final String runner, final
>> String name,
>> > + final String log4jConfig, final int threadCount, final
>> WaitStrategy wait,
>> > + final String... systemProperties) throws IOException {
>> > _class = klass;
>> > _runner = runner;
>> > _name = name;
>> > @@ -64,8 +64,8 @@ public class PerfTestDriver {
>> > _temp = File.createTempFile("log4jperformance", ".txt");
>> > }
>> >
>> > - List<String> processArguments(String java) {
>> > - List<String> args = new ArrayList<String>();
>> > + List<String> processArguments(final String java) {
>> > + final List<String> args = new ArrayList<String>();
>> > args.add(java);
>> > args.add("-server");
>> > args.add("-Xms1g");
>> > @@ -84,7 +84,7 @@ public class PerfTestDriver {
>> > args.add("-Dlog4j.configurationFile=" + _log4jConfig); //
>> log4j 2
>> > args.add("-Dlogback.configurationFile=" + _log4jConfig);//
>> logback
>> >
>> > - int ringBufferSize = getUserSpecifiedRingBufferSize();
>> > + final int ringBufferSize =
>> getUserSpecifiedRingBufferSize();
>> > if (ringBufferSize >= 128) {
>> > args.add("-DAsyncLoggerConfig.RingBufferSize=" +
>> ringBufferSize);
>> > args.add("-DAsyncLogger.RingBufferSize=" +
>> ringBufferSize);
>> > @@ -108,23 +108,23 @@ public class PerfTestDriver {
>> > try {
>> > return
>> Integer.parseInt(System.getProperty("RingBufferSize",
>> > "-1"));
>> > - } catch (Exception ignored) {
>> > + } catch (final Exception ignored) {
>> > return -1;
>> > }
>> > }
>> >
>> > - ProcessBuilder latencyTest(String java) {
>> > + ProcessBuilder latencyTest(final String java) {
>> > return new ProcessBuilder(processArguments(java));
>> > }
>> >
>> > - ProcessBuilder throughputTest(String java) {
>> > - List<String> args = processArguments(java);
>> > + ProcessBuilder throughputTest(final String java) {
>> > + final List<String> args = processArguments(java);
>> > args.add("-throughput");
>> > return new ProcessBuilder(args);
>> > }
>> >
>> > @Override
>> > - public int compareTo(Setup other) {
>> > + public int compareTo(final Setup other) {
>> > // largest ops/sec first
>> > return (int) Math.signum(other._stats._averageOpsPerSec
>> > - _stats._averageOpsPerSec);
>> > @@ -137,7 +137,7 @@ public class PerfTestDriver {
>> > } else if (MTPerfTest.class == _class) {
>> > detail = _threadCount + " threads";
>> > }
>> > - String target = _runner.substring(_runner.indexOf(".Run")
>> + 4);
>> > + final String target =
>> _runner.substring(_runner.indexOf(".Run") + 4);
>> > return target + ": " + _name + " (" + detail + ")";
>> > }
>> > }
>> > @@ -152,16 +152,16 @@ public class PerfTestDriver {
>> > long _pct99_99;
>> > double _latencyRowCount;
>> > int _throughputRowCount;
>> > - private long _averageOpsPerSec;
>> > + private final long _averageOpsPerSec;
>> >
>> > // example line: avg=828 99%=1118 99.99%=5028 Count=3125
>> > - public Stats(String raw) {
>> > - String[] lines = raw.split("[\\r\\n]+");
>> > + public Stats(final String raw) {
>> > + final String[] lines = raw.split("[\\r\\n]+");
>> > long totalOps = 0;
>> > - for (String line : lines) {
>> > + for (final String line : lines) {
>> > if (line.startsWith("avg")) {
>> > _latencyRowCount++;
>> > - String[] parts = line.split(" ");
>> > + final String[] parts = line.split(" ");
>> > int i = 0;
>> > _average += Long.parseLong(parts[i++].split("=")[1]);
>> > _pct99 += Long.parseLong(parts[i++].split("=")[1]);
>> > @@ -169,8 +169,8 @@ public class PerfTestDriver {
>> > _count += Integer.parseInt(parts[i].split("=")[1]);
>> > } else {
>> > _throughputRowCount++;
>> > - String number = line.substring(0, line.indexOf('
>> '));
>> > - long opsPerSec = Long.parseLong(number);
>> > + final String number = line.substring(0,
>> line.indexOf(' '));
>> > + final long opsPerSec = Long.parseLong(number);
>> > totalOps += opsPerSec;
>> > }
>> > }
>> > @@ -179,7 +179,7 @@ public class PerfTestDriver {
>> >
>> > @Override
>> > public String toString() {
>> > - String fmt = "throughput: %,d ops/sec. latency(ns):
>> avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
>> > + final String fmt = "throughput: %,d ops/sec. latency(ns):
>> avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
>> > return String.format(fmt, _averageOpsPerSec, //
>> > _average / _latencyRowCount, // mean latency
>> > _pct99 / _latencyRowCount, // 99% observations less
>> than
>> > @@ -189,24 +189,24 @@ public class PerfTestDriver {
>> > }
>> >
>> > // single-threaded performance test
>> > - private static Setup s(String config, String runner, String name,
>> > - String... systemProperties) throws IOException {
>> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>> > + private static Setup s(final String config, final String runner,
>> final String name,
>> > + final String... systemProperties) throws IOException {
>> > + final WaitStrategy wait =
>> WaitStrategy.valueOf(System.getProperty(
>> > "WaitStrategy", "Sleep"));
>> > return new Setup(PerfTest.class, runner, name, config, 1, wait,
>> > systemProperties);
>> > }
>> >
>> > // multi-threaded performance test
>> > - private static Setup m(String config, String runner, String name,
>> > - int threadCount, String... systemProperties) throws
>> IOException {
>> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
>> > + private static Setup m(final String config, final String runner,
>> final String name,
>> > + final int threadCount, final String... systemProperties)
>> throws IOException {
>> > + final WaitStrategy wait =
>> WaitStrategy.valueOf(System.getProperty(
>> > "WaitStrategy", "Sleep"));
>> > return new Setup(MTPerfTest.class, runner, name, config,
>> threadCount,
>> > wait, systemProperties);
>> > }
>> >
>> > - public static void main(String[] args) throws Exception {
>> > + public static void main(final String[] args) throws Exception {
>> > final String ALL_ASYNC = "-DLog4jContextSelector="
>> > + AsyncLoggerContextSelector.class.getName();
>> > final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
>> > @@ -215,8 +215,8 @@ public class PerfTestDriver {
>> > final String LOG20 = RunLog4j2.class.getName();
>> > final String LOGBK = RunLogback.class.getName();
>> >
>> > - long start = System.nanoTime();
>> > - List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
>> > + final long start = System.nanoTime();
>> > + final List<Setup> tests = new
>> ArrayList<PerfTestDriver.Setup>();
>> > // includeLocation=false
>> > tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
>> > ALL_ASYNC, SYSCLOCK));
>> > @@ -285,29 +285,29 @@ public class PerfTestDriver {
>> > // "RollFastFileAppender", i));
>> > }
>> >
>> > - String java = args.length > 0 ? args[0] : "java";
>> > - int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
>> > + final String java = args.length > 0 ? args[0] : "java";
>> > + final int repeat = args.length > 1 ? Integer.parseInt(args[1])
>> : 5;
>> > int x = 0;
>> > - for (Setup config : tests) {
>> > + for (final Setup config : tests) {
>> > System.out.print(config.description());
>> > - ProcessBuilder pb = config.throughputTest(java);
>> > + final ProcessBuilder pb = config.throughputTest(java);
>> > pb.redirectErrorStream(true); // merge System.out and
>> System.err
>> > - long t1 = System.nanoTime();
>> > + final long t1 = System.nanoTime();
>> > // int count = config._threadCount >= 16 ? 2 : repeat;
>> > runPerfTest(repeat, x++, config, pb);
>> > System.out.printf(" took %.1f seconds%n", (System.nanoTime()
>> - t1)
>> > / (1000.0 * 1000.0 * 1000.0));
>> >
>> > - FileReader reader = new FileReader(config._temp);
>> > - CharBuffer buffer = CharBuffer.allocate(256 * 1024);
>> > + final FileReader reader = new FileReader(config._temp);
>> > + final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
>> > reader.read(buffer);
>> > reader.close();
>> > config._temp.delete();
>> > buffer.flip();
>> >
>> > - String raw = buffer.toString();
>> > + final String raw = buffer.toString();
>> > System.out.print(raw);
>> > - Stats stats = new Stats(raw);
>> > + final Stats stats = new Stats(raw);
>> > System.out.println(stats);
>> > System.out.println("-----");
>> > config._stats = stats;
>> > @@ -321,19 +321,19 @@ public class PerfTestDriver {
>> > printRanking(tests.toArray(new Setup[tests.size()]));
>> > }
>> >
>> > - private static void printRanking(Setup[] tests) {
>> > + private static void printRanking(final Setup[] tests) {
>> > System.out.println();
>> > System.out.println("Ranking:");
>> > Arrays.sort(tests);
>> > for (int i = 0; i < tests.length; i++) {
>> > - Setup setup = tests[i];
>> > + final Setup setup = tests[i];
>> > System.out.println((i + 1) + ". " + setup.description() + ": "
>> > + setup._stats);
>> > }
>> > }
>> >
>> > - private static void runPerfTest(int repeat, int setupIndex, Setup
>> config,
>> > - ProcessBuilder pb) throws IOException,
>> InterruptedException {
>> > + private static void runPerfTest(final int repeat, final int
>> setupIndex, final Setup config,
>> > + final ProcessBuilder pb) throws IOException,
>> InterruptedException {
>> > for (int i = 0; i < repeat; i++) {
>> > System.out.print(" (" + (i + 1) + "/" + repeat + ")...");
>> > final Process process = pb.start();
>> > @@ -343,7 +343,7 @@ public class PerfTestDriver {
>> > process.waitFor();
>> > stop[0] = true;
>> >
>> > - File gc = new File("gc" + setupIndex + "_" + i
>> > + final File gc = new File("gc" + setupIndex + "_" + i
>> > + config._log4jConfig + ".log");
>> > if (gc.exists()) {
>> > gc.delete();
>> > @@ -355,17 +355,17 @@ public class PerfTestDriver {
>> > private static Thread printProcessOutput(final Process process,
>> > final boolean[] stop) {
>> >
>> > - Thread t = new Thread("OutputWriter") {
>> > + final Thread t = new Thread("OutputWriter") {
>> > @Override
>> > public void run() {
>> > - BufferedReader in = new BufferedReader(new
>> InputStreamReader(
>> > + final BufferedReader in = new BufferedReader(new
>> InputStreamReader(
>> > process.getInputStream()));
>> > try {
>> > String line = null;
>> > while (!stop[0] && (line = in.readLine()) != null) {
>> > System.out.println(line);
>> > }
>> > - } catch (Exception ignored) {
>> > + } catch (final Exception ignored) {
>> > }
>> > }
>> > };
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -42,7 +42,7 @@ class PerfTestResultFormatter {
>> > double latency99Pct;
>> > double latency99_99Pct;
>> >
>> > - Stats(String throughput, String avg, String lat99, String
>> lat99_99)
>> > + Stats(final String throughput, final String avg, final
>> String lat99, final String lat99_99)
>> > throws ParseException {
>> > this.throughput =
>> NUM.parse(throughput.trim()).longValue();
>> > this.avgLatency = Double.parseDouble(avg.trim());
>> > @@ -51,40 +51,40 @@ class PerfTestResultFormatter {
>> > }
>> > }
>> >
>> > - private Map<String, Map<String, Stats>> results = new
>> TreeMap<String, Map<String, Stats>>();
>> > + private final Map<String, Map<String, Stats>> results = new
>> TreeMap<String, Map<String, Stats>>();
>> >
>> > public PerfTestResultFormatter() {
>> > }
>> >
>> > - public String format(String text) throws ParseException {
>> > + public String format(final String text) throws ParseException {
>> > results.clear();
>> > - String[] lines = text.split("[\\r\\n]+");
>> > - for (String line : lines) {
>> > + final String[] lines = text.split("[\\r\\n]+");
>> > + for (final String line : lines) {
>> > process(line);
>> > }
>> > return latencyTable() + LF + throughputTable();
>> > }
>> >
>> > private String latencyTable() {
>> > - StringBuilder sb = new StringBuilder(4 * 1024);
>> > - Set<String> subKeys =
>> results.values().iterator().next().keySet();
>> > - char[] tabs = new char[subKeys.size()];
>> > + final StringBuilder sb = new StringBuilder(4 * 1024);
>> > + final Set<String> subKeys =
>> results.values().iterator().next().keySet();
>> > + final char[] tabs = new char[subKeys.size()];
>> > Arrays.fill(tabs, '\t');
>> > - String sep = new String(tabs);
>> > + final String sep = new String(tabs);
>> > sb.append("\tAverage latency").append(sep).append("99%
>> less than").append(sep).append("99.99% less than");
>> > sb.append(LF);
>> > for (int i = 0; i < 3; i++) {
>> > - for (String subKey : subKeys) {
>> > + for (final String subKey : subKeys) {
>> > sb.append("\t").append(subKey);
>> > }
>> > }
>> > sb.append(LF);
>> > - for (String key : results.keySet()) {
>> > + for (final String key : results.keySet()) {
>> > sb.append(key);
>> > for (int i = 0; i < 3; i++) {
>> > - Map<String, Stats> sub = results.get(key);
>> > - for (String subKey : sub.keySet()) {
>> > - Stats stats = sub.get(subKey);
>> > + final Map<String, Stats> sub =
>> results.get(key);
>> > + for (final String subKey : sub.keySet()) {
>> > + final Stats stats =
>> sub.get(subKey);
>> > switch (i) {
>> > case 0:
>> >
>> sb.append("\t").append((long) stats.avgLatency);
>> > @@ -104,19 +104,19 @@ class PerfTestResultFormatter {
>> > }
>> >
>> > private String throughputTable() {
>> > - StringBuilder sb = new StringBuilder(4 * 1024);
>> > - Set<String> subKeys =
>> results.values().iterator().next().keySet();
>> > + final StringBuilder sb = new StringBuilder(4 * 1024);
>> > + final Set<String> subKeys =
>> results.values().iterator().next().keySet();
>> > sb.append("\tThroughput per thread (msg/sec)");
>> > sb.append(LF);
>> > - for (String subKey : subKeys) {
>> > + for (final String subKey : subKeys) {
>> > sb.append("\t").append(subKey);
>> > }
>> > sb.append(LF);
>> > - for (String key : results.keySet()) {
>> > + for (final String key : results.keySet()) {
>> > sb.append(key);
>> > - Map<String, Stats> sub = results.get(key);
>> > - for (String subKey : sub.keySet()) {
>> > - Stats stats = sub.get(subKey);
>> > + final Map<String, Stats> sub = results.get(key);
>> > + for (final String subKey : sub.keySet()) {
>> > + final Stats stats = sub.get(subKey);
>> > sb.append("\t").append(stats.throughput);
>> > }
>> > sb.append(LF);
>> > @@ -124,19 +124,19 @@ class PerfTestResultFormatter {
>> > return sb.toString();
>> > }
>> >
>> > - private void process(String line) throws ParseException {
>> > - String key = line.substring(line.indexOf('.') + 1,
>> line.indexOf('('));
>> > - String sub = line.substring(line.indexOf('(') + 1,
>> line.indexOf(')'));
>> > - String throughput =
>> line.substring(line.indexOf("throughput: ")
>> > + private void process(final String line) throws ParseException {
>> > + final String key = line.substring(line.indexOf('.') + 1,
>> line.indexOf('('));
>> > + final String sub = line.substring(line.indexOf('(') + 1,
>> line.indexOf(')'));
>> > + final String throughput =
>> line.substring(line.indexOf("throughput: ")
>> > + "throughput: ".length(), line.indexOf("
>> ops"));
>> > - String avg = line.substring(line.indexOf("avg=") +
>> "avg=".length(),
>> > + final String avg = line.substring(line.indexOf("avg=") +
>> "avg=".length(),
>> > line.indexOf(" 99%"));
>> > - String pct99 = line.substring(
>> > + final String pct99 = line.substring(
>> > line.indexOf("99% < ") + "99% <
>> ".length(),
>> > line.indexOf(" 99.99%"));
>> > - String pct99_99 = line.substring(line.indexOf("99.99% < ")
>> > + final String pct99_99 =
>> line.substring(line.indexOf("99.99% < ")
>> > + "99.99% < ".length(),
>> line.lastIndexOf('(') - 1);
>> > - Stats stats = new Stats(throughput, avg, pct99, pct99_99);
>> > + final Stats stats = new Stats(throughput, avg, pct99,
>> pct99_99);
>> > Map<String, Stats> map = results.get(key.trim());
>> > if (map == null) {
>> > map = new TreeMap<String, Stats>(sort());
>> > @@ -156,9 +156,9 @@ class PerfTestResultFormatter {
>> > "64 threads");
>> >
>> > @Override
>> > - public int compare(String o1, String o2) {
>> > - int i1 = expected.indexOf(o1);
>> > - int i2 = expected.indexOf(o2);
>> > + public int compare(final String o1, final String
>> o2) {
>> > + final int i1 = expected.indexOf(o1);
>> > + final int i2 = expected.indexOf(o2);
>> > if (i1 < 0 || i2 < 0) {
>> > return o1.compareTo(o2);
>> > }
>> > @@ -167,9 +167,9 @@ class PerfTestResultFormatter {
>> > };
>> > }
>> >
>> > - public static void main(String[] args) throws Exception {
>> > - PerfTestResultFormatter fmt = new
>> PerfTestResultFormatter();
>> > - BufferedReader reader = new BufferedReader(new
>> InputStreamReader(
>> > + public static void main(final String[] args) throws Exception {
>> > + final PerfTestResultFormatter fmt = new
>> PerfTestResultFormatter();
>> > + final BufferedReader reader = new BufferedReader(new
>> InputStreamReader(
>> > System.in));
>> > String line;
>> > while ((line = reader.readLine()) != null) {
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -24,32 +24,32 @@ import com.lmax.disruptor.collections.Hi
>> > public class RunLog4j1 implements IPerfTestRunner {
>> >
>> > @Override
>> > - public void runThroughputTest(int lines, Histogram histogram) {
>> > - long s1 = System.nanoTime();
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void runThroughputTest(final int lines, final Histogram
>> histogram) {
>> > + final long s1 = System.nanoTime();
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > for (int j = 0; j < lines; j++) {
>> > logger.info(THROUGHPUT_MSG);
>> > }
>> > - long s2 = System.nanoTime();
>> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>> > + final long s2 = System.nanoTime();
>> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 -
>> s1);
>> > histogram.addObservation(opsPerSec);
>> > }
>> >
>> > @Override
>> > - public void runLatencyTest(int samples, Histogram histogram,
>> > - long nanoTimeCost, int threadCount) {
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void runLatencyTest(final int samples, final Histogram
>> histogram,
>> > + final long nanoTimeCost, final int threadCount) {
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > for (int i = 0; i < samples; i++) {
>> > - long s1 = System.nanoTime();
>> > + final long s1 = System.nanoTime();
>> > logger.info(LATENCY_MSG);
>> > - long s2 = System.nanoTime();
>> > - long value = s2 - s1 - nanoTimeCost;
>> > + final long s2 = System.nanoTime();
>> > + final long value = s2 - s1 - nanoTimeCost;
>> > if (value > 0) {
>> > histogram.addObservation(value);
>> > }
>> > // wait 1 microsec
>> > final long PAUSE_NANOS = 10000 * threadCount;
>> > - long pauseStart = System.nanoTime();
>> > + final long pauseStart = System.nanoTime();
>> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
>> > // busy spin
>> > }
>> > @@ -62,8 +62,8 @@ public class RunLog4j1 implements IPerfT
>> > }
>> >
>> > @Override
>> > - public void log(String finalMessage) {
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void log(final String finalMessage) {
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > logger.info(finalMessage);
>> > }
>> > }
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -25,33 +25,33 @@ import com.lmax.disruptor.collections.Hi
>> > public class RunLog4j2 implements IPerfTestRunner {
>> >
>> > @Override
>> > - public void runThroughputTest(int lines, Histogram histogram) {
>> > - long s1 = System.nanoTime();
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void runThroughputTest(final int lines, final Histogram
>> histogram) {
>> > + final long s1 = System.nanoTime();
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > for (int j = 0; j < lines; j++) {
>> > logger.info(THROUGHPUT_MSG);
>> > }
>> > - long s2 = System.nanoTime();
>> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
>> > + final long s2 = System.nanoTime();
>> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 -
>> s1);
>> > histogram.addObservation(opsPerSec);
>> > }
>> >
>> >
>> > @Override
>> > - public void runLatencyTest(int samples, Histogram histogram,
>> > - long nanoTimeCost, int threadCount) {
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void runLatencyTest(final int samples, final Histogram
>> histogram,
>> > + final long nanoTimeCost, final int threadCount) {
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > for (int i = 0; i < samples; i++) {
>> > - long s1 = System.nanoTime();
>> > + final long s1 = System.nanoTime();
>> > logger.info(LATENCY_MSG);
>> > - long s2 = System.nanoTime();
>> > - long value = s2 - s1 - nanoTimeCost;
>> > + final long s2 = System.nanoTime();
>> > + final long value = s2 - s1 - nanoTimeCost;
>> > if (value > 0) {
>> > histogram.addObservation(value);
>> > }
>> > // wait 1 microsec
>> > final long PAUSE_NANOS = 10000 * threadCount;
>> > - long pauseStart = System.nanoTime();
>> > + final long pauseStart = System.nanoTime();
>> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
>> > // busy spin
>> > }
>> > @@ -66,8 +66,8 @@ public class RunLog4j2 implements IPerfT
>> >
>> >
>> > @Override
>> > - public void log(String finalMessage) {
>> > - Logger logger = LogManager.getLogger(getClass());
>> > + public void log(final String finalMessage) {
>> > + final Logger logger = LogManager.getLogger(getClass());
>> > logger.info(finalMessage);
>> > }
>> > }
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -26,32 +26,32 @@ import com.lmax.disruptor.collections.Hi
>> > public class RunLogback implements IPerfTestRunner {
>> >
>> > @Override
>> > - public void runThroughputTest(int lines, Histogram histogram) {
>> > - long s1 = System.nanoTime();
>> > - Logger logger = (Logger)
>> LoggerFactory.getLogger(getClass());
>> > + public void runThroughputTest(final int lines, final Histogram
>> histogram) {
>> > + final long s1 = System.nanoTime();
>> > + final Logger logger = (Logger)
>> LoggerFactory.getLogger(getClass());
>> > for (int j = 0; j < lines; j++) {
>> > logger.info(THROUGHPUT_MSG);
>> > }
>> > - long s2 = System.nanoTime();
>> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 -
>> s1);
>> > + final long s2 = System.nanoTime();
>> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) /
>> (s2 - s1);
>> > histogram.addObservation(opsPerSec);
>> > }
>> >
>> > @Override
>> > - public void runLatencyTest(int samples, Histogram histogram,
>> > - long nanoTimeCost, int threadCount) {
>> > - Logger logger = (Logger)
>> LoggerFactory.getLogger(getClass());
>> > + public void runLatencyTest(final int samples, final Histogram
>> histogram,
>> > + final long nanoTimeCost, final int threadCount) {
>> > + final Logger logger = (Logger)
>> LoggerFactory.getLogger(getClass());
>> > for (int i = 0; i < samples; i++) {
>> > - long s1 = System.nanoTime();
>> > + final long s1 = System.nanoTime();
>> > logger.info(LATENCY_MSG);
>> > - long s2 = System.nanoTime();
>> > - long value = s2 - s1 - nanoTimeCost;
>> > + final long s2 = System.nanoTime();
>> > + final long value = s2 - s1 - nanoTimeCost;
>> > if (value > 0) {
>> > histogram.addObservation(value);
>> > }
>> > // wait 1 microsec
>> > final long PAUSE_NANOS = 10000 * threadCount;
>> > - long pauseStart = System.nanoTime();
>> > + final long pauseStart = System.nanoTime();
>> > while (PAUSE_NANOS > (System.nanoTime() -
>> pauseStart)) {
>> > // busy spin
>> > }
>> > @@ -64,8 +64,8 @@ public class RunLogback implements IPerf
>> > }
>> >
>> > @Override
>> > - public void log(String msg) {
>> > - Logger logger = (Logger)
>> LoggerFactory.getLogger(getClass());
>> > + public void log(final String msg) {
>> > + final Logger logger = (Logger)
>> LoggerFactory.getLogger(getClass());
>> > logger.info(msg);
>> > }
>> > }
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -63,12 +63,12 @@ public class AdvertiserTest {
>> > file.delete();
>> > }
>> >
>> > - private void verifyExpectedEntriesAdvertised(Map<Object,
>> Map<String, String>> entries) {
>> > + private void verifyExpectedEntriesAdvertised(final Map<Object,
>> Map<String, String>> entries) {
>> > boolean foundFile1 = false;
>> > boolean foundFile2 = false;
>> > boolean foundSocket1 = false;
>> > boolean foundSocket2 = false;
>> > - for (Map<String, String>entry:entries.values()) {
>> > + for (final Map<String, String>entry:entries.values()) {
>> > if (foundFile1 && foundFile2 && foundSocket1 && foundSocket2)
>> {
>> > break;
>> > }
>> > @@ -103,7 +103,7 @@ public class AdvertiserTest {
>> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
>> > ctx.stop();
>> >
>> > - Map<Object, Map<String, String>> entries =
>> InMemoryAdvertiser.getAdvertisedEntries();
>> > + final Map<Object, Map<String, String>> entries =
>> InMemoryAdvertiser.getAdvertisedEntries();
>> > assertTrue("Entries found: " + entries, entries.isEmpty());
>> >
>> > //reconfigure for subsequent testing
>> > @@ -117,7 +117,7 @@ public class AdvertiserTest {
>> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
>> > ctx.stop();
>> >
>> > - Map<Object, Map<String, String>> entries =
>> InMemoryAdvertiser.getAdvertisedEntries();
>> > + final Map<Object, Map<String, String>> entries =
>> InMemoryAdvertiser.getAdvertisedEntries();
>> > assertTrue("Entries found: " + entries, entries.isEmpty());
>> >
>> > ctx.start();
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -34,9 +34,9 @@ public class BaseConfigurationTest {
>> > @Test
>> > public void testMissingRootLogger() throws Exception {
>> >
>> PluginManager.addPackage("org.apache.logging.log4j.test.appender");
>> > - LoggerContext ctx = Configurator.initialize("Test1", null,
>> "missingRootLogger.xml");
>> > + final LoggerContext ctx = Configurator.initialize("Test1",
>> null, "missingRootLogger.xml");
>> > final Logger logger = LogManager.getLogger("sample.Logger1");
>> > - Configuration config = ctx.getConfiguration();
>> > + final Configuration config = ctx.getConfiguration();
>> > assertNotNull("Config not null", config);
>> > // final String MISSINGROOT = "MissingRootTest";
>> > // assertTrue("Incorrect Configuration. Expected " + MISSINGROOT
>> + " but found " + config.getName(),
>> > @@ -53,15 +53,15 @@ public class BaseConfigurationTest {
>> > // only the sample logger, no root logger in loggerMap!
>> > assertTrue("contains key=sample",
>> loggerMap.containsKey("sample"));
>> >
>> > - LoggerConfig sample = loggerMap.get("sample");
>> > - Map<String, Appender<?>> sampleAppenders =
>> sample.getAppenders();
>> > + final LoggerConfig sample = loggerMap.get("sample");
>> > + final Map<String, Appender<?>> sampleAppenders =
>> sample.getAppenders();
>> > assertEquals("sampleAppenders Size", 1, sampleAppenders.size());
>> > // sample only has List appender, not Console!
>> > assertTrue("sample has appender List",
>> sampleAppenders.containsKey("List"));
>> >
>> > - BaseConfiguration baseConfig = (BaseConfiguration) config;
>> > - LoggerConfig root = baseConfig.getRootLogger();
>> > - Map<String, Appender<?>> rootAppenders = root.getAppenders();
>> > + final BaseConfiguration baseConfig = (BaseConfiguration)
>> config;
>> > + final LoggerConfig root = baseConfig.getRootLogger();
>> > + final Map<String, Appender<?>> rootAppenders =
>> root.getAppenders();
>> > assertEquals("rootAppenders Size", 1, rootAppenders.size());
>> > // root only has Console appender!
>> > assertTrue("root has appender Console",
>> rootAppenders.containsKey("Console"));
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -28,20 +28,20 @@ public class InMemoryAdvertiser implemen
>> >
>> > public static Map<Object, Map<String, String>> getAdvertisedEntries()
>> > {
>> > - Map<Object, Map<String, String>> result = new HashMap<Object,
>> Map<String, String>>();
>> > + final Map<Object, Map<String, String>> result = new
>> HashMap<Object, Map<String, String>>();
>> > result.putAll(properties);
>> > return result;
>> > }
>> >
>> > @Override
>> > - public Object advertise(Map<String, String> newEntry) {
>> > - Object object = new Object();
>> > + public Object advertise(final Map<String, String> newEntry) {
>> > + final Object object = new Object();
>> > properties.put(object, new HashMap<String, String>(newEntry));
>> > return object;
>> > }
>> >
>> > @Override
>> > - public void unadvertise(Object advertisedObject) {
>> > + public void unadvertise(final Object advertisedObject) {
>> > properties.remove(advertisedObject);
>> > }
>> > }
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -189,24 +189,24 @@ public class TestConfigurator {
>> > public void testEnvironment() throws Exception {
>> > final LoggerContext ctx = Configurator.initialize("-config",
>> null, (String) null);
>> > final Logger logger =
>> LogManager.getLogger("org.apache.test.TestConfigurator");
>> > - Configuration config = ctx.getConfiguration();
>> > + final Configuration config = ctx.getConfiguration();
>> > assertNotNull("No configuration", config);
>> > assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + "
>> but found " + config.getName(),
>> > CONFIG_NAME.equals(config.getName()));
>> > final Map<String, Appender<?>> map = config.getAppenders();
>> > assertNotNull("No Appenders", map != null && map.size() > 0);
>> > Appender<?> app = null;
>> > - for (Map.Entry<String, Appender<?>> entry: map.entrySet()) {
>> > + for (final Map.Entry<String, Appender<?>> entry:
>> map.entrySet()) {
>> > if (entry.getKey().equals("List2")) {
>> > app = entry.getValue();
>> > break;
>> > }
>> > }
>> > assertNotNull("No ListAppender named List2", app);
>> > - Layout layout = app.getLayout();
>> > + final Layout layout = app.getLayout();
>> > assertNotNull("Appender List2 does not have a Layout", layout);
>> > assertTrue("Appender List2 is not configured with a
>> PatternLayout", layout instanceof PatternLayout);
>> > - String pattern = ((PatternLayout)
>> layout).getConversionPattern();
>> > + final String pattern = ((PatternLayout)
>> layout).getConversionPattern();
>> > assertNotNull("No conversion pattern for List2 PatternLayout",
>> pattern);
>> > assertFalse("Environment variable was not substituted",
>> pattern.startsWith("${env:PATH}"));
>> > }
>> >
>> > Modified:
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
>> > URL:
>> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
>> >
>> ==============================================================================
>> > ---
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
>> (original)
>> > +++
>> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
>> Tue Jul 9 06:08:25 2013
>> > @@ -55,7 +55,7 @@ public class RegexFilterTest {
>> >
>> > @Test
>> > public void TestNoMsg() {
>> > - RegexFilter filter = RegexFilter.createFilter(".* test .*",
>> null, null, null);
>> > + final RegexFilter filter = RegexFilter.createFilter(".* test
>> .*", null, null, null);
>> > filter.start();
>> > assertTrue(filter.isStarted());
>> > assertTrue(filter.filter(null, Level.DEBUG, null, (String)null,
>> (Throwable)null) == Filter.Result.DENY);
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: svn commit: r1501104 [4/5] - in /logging/log4j/log4j2/trunk:
api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/
api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j/s...
Posted by Gary Gregory <ga...@gmail.com>.
Everything is compiling in Eclipse (Java 6) and Maven (Java 7) but I just
read Nick's comment. I am running Maven on Java 6 as I write this...
Gary
On Tue, Jul 9, 2013 at 4:10 PM, Ralph Goers <ra...@dslextreme.com>wrote:
> After fixing the prior compiler error I then ran into this one:
>
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile
> (default-testCompile) on project log4j-core: Compilation failure
> [ERROR]
> /Users/rgoers/projects/apache/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java:[177,13]
> variable _averageOpsPerSec might already have been assigned
>
> Can you please compile and test before committing?
>
> Ralph
>
> On Jul 8, 2013, at 11:08 PM, ggregory@apache.org wrote:
>
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -41,7 +41,7 @@ public class ContextStackAttributeConver
> >
> > @Test
> > public void testConvertToDatabaseColumn01() {
> > - ThreadContext.ContextStack stack = new
> MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new
> MutableThreadContextStack(
> > Arrays.asList("value1", "another2"));
> >
> > assertEquals("The converted value is not correct.",
> "value1\nanother2",
> > @@ -50,7 +50,7 @@ public class ContextStackAttributeConver
> >
> > @Test
> > public void testConvertToDatabaseColumn02() {
> > - ThreadContext.ContextStack stack = new
> MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new
> MutableThreadContextStack(
> > Arrays.asList("key1", "value2", "my3"));
> >
> > assertEquals("The converted value is not correct.",
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -42,14 +42,14 @@ public class ContextStackJsonAttributeCo
> > @Test
> > public void testConvert01() {
> > ThreadContext.clearStack();
> > - ThreadContext.ContextStack stack = new
> MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new
> MutableThreadContextStack(
> > Arrays.asList("value1", "another2"));
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(stack);
> > + final String converted =
> this.converter.convertToDatabaseColumn(stack);
> >
> > assertNotNull("The converted value should not be null.",
> converted);
> >
> > - ThreadContext.ContextStack reversed = this.converter
> > + final ThreadContext.ContextStack reversed = this.converter
> > .convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > @@ -60,14 +60,14 @@ public class ContextStackJsonAttributeCo
> > @Test
> > public void testConvert02() {
> > ThreadContext.clearStack();
> > - ThreadContext.ContextStack stack = new
> MutableThreadContextStack(
> > + final ThreadContext.ContextStack stack = new
> MutableThreadContextStack(
> > Arrays.asList("key1", "value2", "my3"));
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(stack);
> > + final String converted =
> this.converter.convertToDatabaseColumn(stack);
> >
> > assertNotNull("The converted value should not be null.",
> converted);
> >
> > - ThreadContext.ContextStack reversed = this.converter
> > + final ThreadContext.ContextStack reversed = this.converter
> > .convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -39,14 +39,14 @@ public class MarkerAttributeConverterTes
> >
> > @Test
> > public void testConvert01() {
> > - Marker marker = MarkerManager.getMarker("testConvert01");
> > + final Marker marker = MarkerManager.getMarker("testConvert01");
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(marker);
> > + final String converted =
> this.converter.convertToDatabaseColumn(marker);
> >
> > assertNotNull("The converted value should not be null.",
> converted);
> > assertEquals("The converted value is not correct.",
> "testConvert01", converted);
> >
> > - Marker reversed =
> this.converter.convertToEntityAttribute(converted);
> > + final Marker reversed =
> this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.",
> "testConvert01", marker.getName());
> > @@ -54,19 +54,19 @@ public class MarkerAttributeConverterTes
> >
> > @Test
> > public void testConvert02() {
> > - Marker marker = MarkerManager.getMarker("testConvert02",
> > + final Marker marker = MarkerManager.getMarker("testConvert02",
> > MarkerManager.getMarker("anotherConvert02",
> > MarkerManager.getMarker("finalConvert03")
> > )
> > );
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(marker);
> > + final String converted =
> this.converter.convertToDatabaseColumn(marker);
> >
> > assertNotNull("The converted value should not be null.",
> converted);
> > assertEquals("The converted value is not correct.",
> "testConvert02[ anotherConvert02[ finalConvert03 ] ] ]",
> > converted);
> >
> > - Marker reversed =
> this.converter.convertToEntityAttribute(converted);
> > + final Marker reversed =
> this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.",
> "testConvert02", marker.getName());
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -41,14 +41,14 @@ public class MessageAttributeConverterTe
> >
> > @Test
> > public void testConvert01() {
> > - Message message = log.getMessageFactory().newMessage("Message
> #{} said [{}].", 3, "Hello");
> > + final Message message =
> log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(message);
> > + final String converted =
> this.converter.convertToDatabaseColumn(message);
> >
> > assertNotNull("The converted value should not be null.",
> converted);
> > assertEquals("The converted value is not correct.", "Message #3
> said [Hello].", converted);
> >
> > - Message reversed =
> this.converter.convertToEntityAttribute(converted);
> > + final Message reversed =
> this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", "Message #3
> said [Hello].", reversed.getFormattedMessage());
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -37,15 +37,15 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert01() {
> > - StackTraceElement element = new
> StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java",
> 1234);
> > + final StackTraceElement element = new
> StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java",
> 1234);
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(element);
> > + final String converted =
> this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.",
> converted);
> > assertEquals("The converted value is not correct.",
> "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
> > converted);
> >
> > - StackTraceElement reversed =
> this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed =
> this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.", "TestNoPackage",
> reversed.getClassName());
> > @@ -57,17 +57,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert02() {
> > - StackTraceElement element = new
> StackTraceElement("org.apache.logging.TestWithPackage",
> > + final StackTraceElement element = new
> StackTraceElement("org.apache.logging.TestWithPackage",
> > "testConvert02", "TestWithPackage.java", -1);
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(element);
> > + final String converted =
> this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.",
> converted);
> > assertEquals("The converted value is not correct.",
> >
> "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
> > converted);
> >
> > - StackTraceElement reversed =
> this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed =
> this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.",
> "org.apache.logging.TestWithPackage", reversed.getClassName());
> > @@ -79,17 +79,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert03() {
> > - StackTraceElement element = new
> StackTraceElement("org.apache.logging.TestNoSource",
> > + final StackTraceElement element = new
> StackTraceElement("org.apache.logging.TestNoSource",
> > "testConvert03", null, -1);
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(element);
> > + final String converted =
> this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.",
> converted);
> > assertEquals("The converted value is not correct.",
> > "org.apache.logging.TestNoSource.testConvert03(Unknown
> Source)",
> > converted);
> >
> > - StackTraceElement reversed =
> this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed =
> this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.",
> "org.apache.logging.TestNoSource", reversed.getClassName());
> > @@ -101,17 +101,17 @@ public class StackTraceElementAttributeC
> >
> > @Test
> > public void testConvert04() {
> > - StackTraceElement element = new
> StackTraceElement("org.apache.logging.TestIsNativeMethod",
> > + final StackTraceElement element = new
> StackTraceElement("org.apache.logging.TestIsNativeMethod",
> > "testConvert04", null, -2);
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(element);
> > + final String converted =
> this.converter.convertToDatabaseColumn(element);
> >
> > assertNotNull("The converted value should not be null.",
> converted);
> > assertEquals("The converted value is not correct.",
> >
> "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
> > converted);
> >
> > - StackTraceElement reversed =
> this.converter.convertToEntityAttribute(converted);
> > + final StackTraceElement reversed =
> this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The class name is not correct.",
> "org.apache.logging.TestIsNativeMethod",
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -39,16 +39,16 @@ public class ThrowableAttributeConverter
> >
> > @Test
> > public void testConvert01() {
> > - RuntimeException exception = new RuntimeException("My message
> 01.");
> > + final RuntimeException exception = new RuntimeException("My
> message 01.");
> >
> > - String stackTrace = getStackTrace(exception);
> > + final String stackTrace = getStackTrace(exception);
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(exception);
> > + final String converted =
> this.converter.convertToDatabaseColumn(exception);
> >
> > assertNotNull("The converted value is not correct.", converted);
> > assertEquals("The converted value is not correct.", stackTrace,
> converted);
> >
> > - Throwable reversed =
> this.converter.convertToEntityAttribute(converted);
> > + final Throwable reversed =
> this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", stackTrace,
> getStackTrace(reversed));
> > @@ -56,18 +56,18 @@ public class ThrowableAttributeConverter
> >
> > @Test
> > public void testConvert02() {
> > - SQLException cause2 = new SQLException("This is a test cause.");
> > - Error cause1 = new Error(cause2);
> > - RuntimeException exception = new RuntimeException("My message
> 01.", cause1);
> > + final SQLException cause2 = new SQLException("This is a test
> cause.");
> > + final Error cause1 = new Error(cause2);
> > + final RuntimeException exception = new RuntimeException("My
> message 01.", cause1);
> >
> > - String stackTrace = getStackTrace(exception);
> > + final String stackTrace = getStackTrace(exception);
> >
> > - String converted =
> this.converter.convertToDatabaseColumn(exception);
> > + final String converted =
> this.converter.convertToDatabaseColumn(exception);
> >
> > assertNotNull("The converted value is not correct.", converted);
> > assertEquals("The converted value is not correct.", stackTrace,
> converted);
> >
> > - Throwable reversed =
> this.converter.convertToEntityAttribute(converted);
> > + final Throwable reversed =
> this.converter.convertToEntityAttribute(converted);
> >
> > assertNotNull("The reversed value should not be null.", reversed);
> > assertEquals("The reversed value is not correct.", stackTrace,
> getStackTrace(reversed));
> > @@ -84,10 +84,10 @@ public class ThrowableAttributeConverter
> > assertNull("The converted attribute should be null (2).",
> this.converter.convertToEntityAttribute(""));
> > }
> >
> > - private static String getStackTrace(Throwable throwable) {
> > + private static String getStackTrace(final Throwable throwable) {
> > String returnValue = throwable.toString() + "\n";
> >
> > - for (StackTraceElement element : throwable.getStackTrace()) {
> > + for (final StackTraceElement element :
> throwable.getStackTrace()) {
> > returnValue += "\tat " + element.toString() + "\n";
> > }
> >
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -51,7 +51,7 @@ public class MapRewritePolicyTest {
> > logEvent1 = new Log4jLogEvent("test", null,
> "MapRewritePolicyTest.setupClass()", Level.ERROR,
> > new MapMessage(map), null, map, null, "none",
> > new StackTraceElement("MapRewritePolicyTest", "setupClass",
> "MapRewritePolicyTest", 29), 2);
> > - ThreadContextStack stack = new MutableThreadContextStack(new
> ArrayList<String>(map.values()));
> > + final ThreadContextStack stack = new MutableThreadContextStack(new
> ArrayList<String>(map.values()));
> > logEvent2 = new Log4jLogEvent("test",
> MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
> > Level.TRACE, new StructuredDataMessage("test", "Nothing", "test",
> map), new RuntimeException("test"), null,
> > stack, "none", new StackTraceElement("MapRewritePolicyTest",
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -112,7 +112,7 @@ public class RewriteAppenderTest {
> > StructuredDataMessage msg = new StructuredDataMessage("Test",
> "This is a test", "Service");
> > msg.put("Key1", "Value2");
> > msg.put("Key2", "Value1");
> > - Logger logger =
> LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> > + final Logger logger =
> LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> > logger.debug(msg);
> > msg = new StructuredDataMessage("Test", "This is a test",
> "Service");
> > msg.put("Key1", "Value1");
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -40,23 +40,23 @@ public class FastRollingFileManagerTest
> > */
> > @Test
> > public void testWrite_multiplesOfBufferSize() throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > - OutputStream os = new
> FastRollingFileManager.DummyOutputStream();
> > - boolean append = false;
> > - boolean flushNow = false;
> > - long triggerSize = Long.MAX_VALUE;
> > - long time = System.currentTimeMillis();
> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > + final OutputStream os = new
> FastRollingFileManager.DummyOutputStream();
> > + final boolean append = false;
> > + final boolean flushNow = false;
> > + final long triggerSize = Long.MAX_VALUE;
> > + final long time = System.currentTimeMillis();
> > + final TriggeringPolicy triggerPolicy = new
> SizeBasedTriggeringPolicy(
> > triggerSize);
> > - RolloverStrategy rolloverStrategy = null;
> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
> > + final RolloverStrategy rolloverStrategy = null;
> > + final FastRollingFileManager manager = new
> FastRollingFileManager(raf,
> > file.getName(), "", os, append, flushNow, triggerSize,
> time,
> > triggerPolicy, rolloverStrategy, null, null);
> >
> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> > - byte[] data = new byte[size];
> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> > + final byte[] data = new byte[size];
> > manager.write(data, 0, data.length); // no buffer overflow
> exception
> >
> > // buffer is full but not flushed yet
> > @@ -71,23 +71,23 @@ public class FastRollingFileManagerTest
> > */
> > @Test
> > public void testWrite_dataExceedingBufferSize() throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > - OutputStream os = new
> FastRollingFileManager.DummyOutputStream();
> > - boolean append = false;
> > - boolean flushNow = false;
> > - long triggerSize = 0;
> > - long time = System.currentTimeMillis();
> > - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> > + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> > + final OutputStream os = new
> FastRollingFileManager.DummyOutputStream();
> > + final boolean append = false;
> > + final boolean flushNow = false;
> > + final long triggerSize = 0;
> > + final long time = System.currentTimeMillis();
> > + final TriggeringPolicy triggerPolicy = new
> SizeBasedTriggeringPolicy(
> > triggerSize);
> > - RolloverStrategy rolloverStrategy = null;
> > - FastRollingFileManager manager = new FastRollingFileManager(raf,
> > + final RolloverStrategy rolloverStrategy = null;
> > + final FastRollingFileManager manager = new
> FastRollingFileManager(raf,
> > file.getName(), "", os, append, flushNow, triggerSize,
> time,
> > triggerPolicy, rolloverStrategy, null, null);
> >
> > - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
> > - byte[] data = new byte[size];
> > + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3
> + 1;
> > + final byte[] data = new byte[size];
> > manager.write(data, 0, data.length); // no exception
> > assertEquals(FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3,
> > raf.length());
> > @@ -98,12 +98,12 @@ public class FastRollingFileManagerTest
> >
> > @Test
> > public void testAppendDoesNotOverwriteExistingFile() throws
> IOException {
> > - boolean isAppend = true;
> > - File file = File.createTempFile("log4j2", "test");
> > + final boolean isAppend = true;
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > assertEquals(0, file.length());
> >
> > - byte[] bytes = new byte[4 * 1024];
> > + final byte[] bytes = new byte[4 * 1024];
> >
> > // create existing file
> > FileOutputStream fos = null;
> > @@ -116,31 +116,31 @@ public class FastRollingFileManagerTest
> > }
> > assertEquals("all flushed to disk", bytes.length, file.length());
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> > new SizeBasedTriggeringPolicy(Long.MAX_VALUE), //
> > null, null, null);
> > manager.write(bytes, 0, bytes.length);
> > - int expected = bytes.length * 2;
> > + final int expected = bytes.length * 2;
> > assertEquals("appended, not overwritten", expected, file.length());
> > }
> >
> > @Test
> > public void testFileTimeBasedOnSystemClockWhenAppendIsFalse()
> > throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > LockSupport.parkNanos(1000000); // 1 millisec
> >
> > // append is false deletes the file if it exists
> > - boolean isAppend = false;
> > - long expectedMin = System.currentTimeMillis();
> > - long expectedMax = expectedMin + 50;
> > + final boolean isAppend = false;
> > + final long expectedMin = System.currentTimeMillis();
> > + final long expectedMax = expectedMin + 50;
> > assertTrue(file.lastModified() < expectedMin);
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> > @@ -153,14 +153,14 @@ public class FastRollingFileManagerTest
> > @Test
> > public void testFileTimeBasedOnFileModifiedTimeWhenAppendIsTrue()
> > throws IOException {
> > - File file = File.createTempFile("log4j2", "test");
> > + final File file = File.createTempFile("log4j2", "test");
> > file.deleteOnExit();
> > LockSupport.parkNanos(1000000); // 1 millisec
> >
> > - boolean isAppend = true;
> > + final boolean isAppend = true;
> > assertTrue(file.lastModified() < System.currentTimeMillis());
> >
> > - FastRollingFileManager manager = FastRollingFileManager
> > + final FastRollingFileManager manager = FastRollingFileManager
> > .getFastRollingFileManager(
> > //
> > file.getAbsolutePath(), "", isAppend, true,
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -35,7 +35,7 @@ public class FileRenameActionTest {
> >
> > @BeforeClass
> > public static void beforeClass() throws Exception {
> > - File file = new File(DIR);
> > + final File file = new File(DIR);
> > file.mkdirs();
> > }
> >
> > @@ -51,15 +51,15 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testRename1() throws Exception {
> > - File file = new File("target/fileRename/fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("target/fileRename/fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > for (int i = 0; i < 100; ++i) {
> > pos.println("This is line " + i);
> > }
> > pos.close();
> >
> > - File dest = new File("target/fileRename/newFile.log");
> > - FileRenameAction action = new FileRenameAction(file, dest,
> false);
> > + final File dest = new File("target/fileRename/newFile.log");
> > + final FileRenameAction action = new FileRenameAction(file,
> dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", dest.exists());
> > assertTrue("Old file exists", !file.exists());
> > @@ -67,12 +67,12 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testEmpty() throws Exception {
> > - File file = new File("target/fileRename/fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("target/fileRename/fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > pos.close();
> >
> > - File dest = new File("target/fileRename/newFile.log");
> > - FileRenameAction action = new FileRenameAction(file, dest,
> false);
> > + final File dest = new File("target/fileRename/newFile.log");
> > + final FileRenameAction action = new FileRenameAction(file,
> dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", !dest.exists());
> > assertTrue("Old file does not exist", !file.exists());
> > @@ -81,16 +81,16 @@ public class FileRenameActionTest {
> >
> > @Test
> > public void testNoParent() throws Exception {
> > - File file = new File("fileRename.log");
> > - PrintStream pos = new PrintStream(file);
> > + final File file = new File("fileRename.log");
> > + final PrintStream pos = new PrintStream(file);
> > for (int i = 0; i < 100; ++i) {
> > pos.println("This is line " + i);
> > }
> > pos.close();
> >
> > - File dest = new File("newFile.log");
> > + final File dest = new File("newFile.log");
> > try {
> > - FileRenameAction action = new FileRenameAction(file, dest,
> false);
> > + final FileRenameAction action = new FileRenameAction(file,
> dest, false);
> > action.execute();
> > assertTrue("Renamed file does not exist", dest.exists());
> > assertTrue("Old file exists", !file.exists());
> > @@ -98,7 +98,7 @@ public class FileRenameActionTest {
> > try {
> > dest.delete();
> > file.delete();
> > - } catch (Exception ex) {
> > + } catch (final Exception ex) {
> > System.out.println("Unable to cleanup files written to
> main directory");
> > }
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -39,17 +39,17 @@ public class AsyncLoggerConfigTest {
> >
> > @Test
> > public void testAdditivity() throws Exception {
> > - File f = new File("target", "AsyncLoggerConfigTest.log");
> > + final File f = new File("target", "AsyncLoggerConfigTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Additive logging: 2 for the price of 1!";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Additive logging: 2 for the price of 1!";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > - String line2 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new
> FileReader(f));
> > + final String line1 = reader.readLine();
> > + final String line2 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > @@ -57,7 +57,7 @@ public class AsyncLoggerConfigTest {
> > assertTrue("line1 correct", line1.contains(msg));
> > assertTrue("line2 correct", line2.contains(msg));
> >
> > - String location = "testAdditivity";
> > + final String location = "testAdditivity";
> > assertTrue("location",
> > line1.contains(location) || line2.contains(location));
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -29,24 +29,24 @@ public class AsyncLoggerContextSelectorT
> >
> > @Test
> > public void testContextReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new
> AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false);
> > + final AsyncLoggerContextSelector selector = new
> AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null,
> false);
> >
> > assertTrue(context instanceof AsyncLoggerContext);
> > }
> >
> > @Test
> > public void testContext2ReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new
> AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false,
> null);
> > + final AsyncLoggerContextSelector selector = new
> AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null,
> false, null);
> >
> > assertTrue(context instanceof AsyncLoggerContext);
> > }
> >
> > @Test
> > public void testLoggerContextsReturnsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new
> AsyncLoggerContextSelector();
> > - List<LoggerContext> list = selector.getLoggerContexts();
> > + final AsyncLoggerContextSelector selector = new
> AsyncLoggerContextSelector();
> > + final List<LoggerContext> list = selector.getLoggerContexts();
> >
> > assertEquals(1, list.size());
> > assertTrue(list.get(0) instanceof AsyncLoggerContext);
> > @@ -54,8 +54,8 @@ public class AsyncLoggerContextSelectorT
> >
> > @Test
> > public void testContextNameIsAsyncLoggerContext() {
> > - AsyncLoggerContextSelector selector = new
> AsyncLoggerContextSelector();
> > - LoggerContext context = selector.getContext(null, null, false);
> > + final AsyncLoggerContextSelector selector = new
> AsyncLoggerContextSelector();
> > + final LoggerContext context = selector.getContext(null, null,
> false);
> >
> > assertEquals("AsyncLoggerContext", context.getName());
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -30,7 +30,7 @@ public class AsyncLoggerContextTest {
> >
> > @Test
> > public void testNewInstanceReturnsAsyncLogger() {
> > - Logger logger = new AsyncLoggerContext("a").newInstance(
> > + final Logger logger = new AsyncLoggerContext("a").newInstance(
> > new LoggerContext("a"), "a", null);
> > assertTrue(logger instanceof AsyncLogger);
> >
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -49,22 +49,22 @@ public class AsyncLoggerLocationTest {
> >
> > @Test
> > public void testAsyncLogWritesToLog() throws Exception {
> > - File f = new File("target", "AsyncLoggerLocationTest.log");
> > + final File f = new File("target",
> "AsyncLoggerLocationTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Async logger msg with location";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Async logger msg with location";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new
> FileReader(f));
> > + final String line1 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > assertTrue("line1 correct", line1.contains(msg));
> >
> > - String location = "testAsyncLogWritesToLog";
> > + final String location = "testAsyncLogWritesToLog";
> > assertTrue("has location", line1.contains(location));
> > }
> >
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -49,22 +49,22 @@ public class AsyncLoggerTest {
> >
> > @Test
> > public void testAsyncLogWritesToLog() throws Exception {
> > - File f = new File("target", "AsyncLoggerTest.log");
> > + final File f = new File("target", "AsyncLoggerTest.log");
> > // System.out.println(f.getAbsolutePath());
> > f.delete();
> > - Logger log = LogManager.getLogger("com.foo.Bar");
> > - String msg = "Async logger msg";
> > + final Logger log = LogManager.getLogger("com.foo.Bar");
> > + final String msg = "Async logger msg";
> > log.info(msg);
> > ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
> >
> > - BufferedReader reader = new BufferedReader(new FileReader(f));
> > - String line1 = reader.readLine();
> > + final BufferedReader reader = new BufferedReader(new
> FileReader(f));
> > + final String line1 = reader.readLine();
> > reader.close();
> > f.delete();
> > assertNotNull("line1", line1);
> > assertTrue("line1 correct", line1.contains(msg));
> >
> > - String location = "testAsyncLogWritesToLog";
> > + final String location = "testAsyncLogWritesToLog";
> > assertTrue("no location", !line1.contains(location));
> > }
> >
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -22,23 +22,23 @@ import com.lmax.disruptor.collections.Hi
> >
> > public class MTPerfTest extends PerfTest {
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > new MTPerfTest().doMain(args);
> > }
> >
> > @Override
> > public void runTestAndPrintResult(final IPerfTestRunner runner,
> > - final String name, final int threadCount, String
> resultFile)
> > + final String name, final int threadCount, final
> String resultFile)
> > throws Exception {
> >
> > // ThreadContext.put("aKey", "mdcVal");
> > PerfTest.println("Warming up the JVM...");
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> >
> > // warmup at least 2 rounds and at most 1 minute
> > final Histogram warmupHist = PerfTest.createHistogram();
> > final long stop = System.currentTimeMillis() + (60 * 1000);
> > - Runnable run1 = new Runnable() {
> > + final Runnable run1 = new Runnable() {
> > @Override
> > public void run() {
> > for (int i = 0; i < 10; i++) {
> > @@ -50,8 +50,8 @@ public class MTPerfTest extends PerfTest
> > }
> > }
> > };
> > - Thread thread1 = new Thread(run1);
> > - Thread thread2 = new Thread(run1);
> > + final Thread thread1 = new Thread(run1);
> > + final Thread thread2 = new Thread(run1);
> > thread1.start();
> > thread2.start();
> > thread1.join();
> > @@ -74,7 +74,7 @@ public class MTPerfTest extends PerfTest
> > }
> >
> > private void multiThreadedTestRun(final IPerfTestRunner runner,
> > - final String name, final int threadCount, String
> resultFile)
> > + final String name, final int threadCount, final
> String resultFile)
> > throws Exception {
> >
> > final Histogram[] histograms = new Histogram[threadCount];
> > @@ -83,28 +83,28 @@ public class MTPerfTest extends PerfTest
> > }
> > final int LINES = 256 * 1024;
> >
> > - Thread[] threads = new Thread[threadCount];
> > + final Thread[] threads = new Thread[threadCount];
> > for (int i = 0; i < threads.length; i++) {
> > final Histogram histogram = histograms[i];
> > threads[i] = new Thread() {
> > @Override
> > public void run() {
> > // int latencyCount = threadCount >= 16 ?
> 1000000 : 5000000;
> > - int latencyCount = 5000000;
> > - int count = PerfTest.throughput ?
> LINES / threadCount
> > + final int latencyCount = 5000000;
> > + final int count =
> PerfTest.throughput ? LINES / threadCount
> > : latencyCount;
> > runTest(runner, count, "end",
> histogram, threadCount);
> > }
> > };
> > }
> > - for (Thread thread : threads) {
> > + for (final Thread thread : threads) {
> > thread.start();
> > }
> > - for (Thread thread : threads) {
> > + for (final Thread thread : threads) {
> > thread.join();
> > }
> >
> > - for (Histogram histogram : histograms) {
> > + for (final Histogram histogram : histograms) {
> > PerfTest.reportResult(resultFile, name, histogram);
> > }
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -33,7 +33,7 @@ public class PerfTest {
> > // determine how long it takes to call System.nanoTime() (on
> average)
> > static long calcNanoTimeCost() {
> > final long iterations = 10000000;
> > - long start = System.nanoTime();
> > + final long start = System.nanoTime();
> > long finish = start;
> >
> > for (int i = 0; i < iterations; i++) {
> > @@ -49,7 +49,7 @@ public class PerfTest {
> > }
> >
> > static Histogram createHistogram() {
> > - long[] intervals = new long[31];
> > + final long[] intervals = new long[31];
> > long intervalUpperBound = 1L;
> > for (int i = 0, size = intervals.length - 1; i < size;
> i++) {
> > intervalUpperBound *= 2;
> > @@ -60,17 +60,17 @@ public class PerfTest {
> > return new Histogram(intervals);
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > new PerfTest().doMain(args);
> > }
> >
> > - public void doMain(String[] args) throws Exception {
> > - String runnerClass = args[0];
> > - IPerfTestRunner runner = (IPerfTestRunner)
> Class.forName(runnerClass)
> > + public void doMain(final String[] args) throws Exception {
> > + final String runnerClass = args[0];
> > + final IPerfTestRunner runner = (IPerfTestRunner)
> Class.forName(runnerClass)
> > .newInstance();
> > - String name = args[1];
> > - String resultFile = args.length > 2 ? args[2] : null;
> > - for (String arg : args) {
> > + final String name = args[1];
> > + final String resultFile = args.length > 2 ? args[2] : null;
> > + for (final String arg : args) {
> > if (verbose && throughput) {
> > break;
> > }
> > @@ -81,7 +81,7 @@ public class PerfTest {
> > throughput = true;
> > }
> > }
> > - int threadCount = args.length > 2 ?
> Integer.parseInt(args[3]) : 3;
> > + final int threadCount = args.length > 2 ?
> Integer.parseInt(args[3]) : 3;
> > printf("Starting %s %s (%d)...%n",
> getClass().getSimpleName(), name,
> > threadCount);
> > runTestAndPrintResult(runner, name, threadCount,
> resultFile);
> > @@ -89,14 +89,14 @@ public class PerfTest {
> > System.exit(0);
> > }
> >
> > - public void runTestAndPrintResult(IPerfTestRunner runner,
> > - final String name, int threadCount, String
> resultFile)
> > + public void runTestAndPrintResult(final IPerfTestRunner runner,
> > + final String name, final int threadCount, final
> String resultFile)
> > throws Exception {
> > - Histogram warmupHist = createHistogram();
> > + final Histogram warmupHist = createHistogram();
> >
> > // ThreadContext.put("aKey", "mdcVal");
> > println("Warming up the JVM...");
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> >
> > // warmup at least 2 rounds and at most 1 minute
> > final long stop = System.currentTimeMillis() + (60 * 1000);
> > @@ -124,46 +124,46 @@ public class PerfTest {
> > runSingleThreadedTest(runner, name, resultFile);
> > }
> >
> > - private int runSingleThreadedTest(IPerfTestRunner runner, String
> name,
> > - String resultFile) throws IOException {
> > - Histogram latency = createHistogram();
> > + private int runSingleThreadedTest(final IPerfTestRunner runner,
> final String name,
> > + final String resultFile) throws IOException {
> > + final Histogram latency = createHistogram();
> > final int LINES = throughput ? 50000 : 5000000;
> > runTest(runner, LINES, "end", latency, 1);
> > reportResult(resultFile, name, latency);
> > return LINES;
> > }
> >
> > - static void reportResult(String file, String name, Histogram
> histogram)
> > + static void reportResult(final String file, final String name,
> final Histogram histogram)
> > throws IOException {
> > - String result = createSamplingReport(name, histogram);
> > + final String result = createSamplingReport(name,
> histogram);
> > println(result);
> >
> > if (file != null) {
> > - FileWriter writer = new FileWriter(file, true);
> > + final FileWriter writer = new FileWriter(file,
> true);
> > writer.write(result);
> > writer.write(System.getProperty("line.separator"));
> > writer.close();
> > }
> > }
> >
> > - static void printf(String msg, Object... objects) {
> > + static void printf(final String msg, final Object... objects) {
> > if (verbose) {
> > System.out.printf(msg, objects);
> > }
> > }
> >
> > - static void println(String msg) {
> > + static void println(final String msg) {
> > if (verbose) {
> > System.out.println(msg);
> > }
> > }
> >
> > - static String createSamplingReport(String name, Histogram
> histogram) {
> > - Histogram data = histogram;
> > + static String createSamplingReport(final String name, final
> Histogram histogram) {
> > + final Histogram data = histogram;
> > if (throughput) {
> > return data.getMax() + " operations/second";
> > }
> > - String result = String.format(
> > + final String result = String.format(
> > "avg=%.0f 99%%=%d 99.99%%=%d
> sampleCount=%d", data.getMean(), //
> > data.getTwoNinesUpperBound(), //
> > data.getFourNinesUpperBound(), //
> > @@ -172,12 +172,12 @@ public class PerfTest {
> > return result;
> > }
> >
> > - public void runTest(IPerfTestRunner runner, int lines, String
> finalMessage,
> > - Histogram histogram, int threadCount) {
> > + public void runTest(final IPerfTestRunner runner, final int lines,
> final String finalMessage,
> > + final Histogram histogram, final int threadCount) {
> > if (throughput) {
> > runner.runThroughputTest(lines, histogram);
> > } else {
> > - long nanoTimeCost = calcNanoTimeCost();
> > + final long nanoTimeCost = calcNanoTimeCost();
> > runner.runLatencyTest(lines, histogram,
> nanoTimeCost, threadCount);
> > }
> > if (finalMessage != null) {
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
> Tue Jul 9 06:08:25 2013
> > @@ -41,19 +41,19 @@ public class PerfTestDriver {
> > * Defines the setup for a java process running a performance test.
> > */
> > static class Setup implements Comparable<Setup> {
> > - private Class<?> _class;
> > - private String _log4jConfig;
> > - private String _name;
> > - private String[] _systemProperties;
> > - private int _threadCount;
> > - private File _temp;
> > + private final Class<?> _class;
> > + private final String _log4jConfig;
> > + private final String _name;
> > + private final String[] _systemProperties;
> > + private final int _threadCount;
> > + private final File _temp;
> > public Stats _stats;
> > - private WaitStrategy _wait;
> > - private String _runner;
> > + private final WaitStrategy _wait;
> > + private final String _runner;
> >
> > - public Setup(Class<?> klass, String runner, String name,
> > - String log4jConfig, int threadCount, WaitStrategy wait,
> > - String... systemProperties) throws IOException {
> > + public Setup(final Class<?> klass, final String runner, final
> String name,
> > + final String log4jConfig, final int threadCount, final
> WaitStrategy wait,
> > + final String... systemProperties) throws IOException {
> > _class = klass;
> > _runner = runner;
> > _name = name;
> > @@ -64,8 +64,8 @@ public class PerfTestDriver {
> > _temp = File.createTempFile("log4jperformance", ".txt");
> > }
> >
> > - List<String> processArguments(String java) {
> > - List<String> args = new ArrayList<String>();
> > + List<String> processArguments(final String java) {
> > + final List<String> args = new ArrayList<String>();
> > args.add(java);
> > args.add("-server");
> > args.add("-Xms1g");
> > @@ -84,7 +84,7 @@ public class PerfTestDriver {
> > args.add("-Dlog4j.configurationFile=" + _log4jConfig); //
> log4j 2
> > args.add("-Dlogback.configurationFile=" + _log4jConfig);//
> logback
> >
> > - int ringBufferSize = getUserSpecifiedRingBufferSize();
> > + final int ringBufferSize = getUserSpecifiedRingBufferSize();
> > if (ringBufferSize >= 128) {
> > args.add("-DAsyncLoggerConfig.RingBufferSize=" +
> ringBufferSize);
> > args.add("-DAsyncLogger.RingBufferSize=" + ringBufferSize);
> > @@ -108,23 +108,23 @@ public class PerfTestDriver {
> > try {
> > return
> Integer.parseInt(System.getProperty("RingBufferSize",
> > "-1"));
> > - } catch (Exception ignored) {
> > + } catch (final Exception ignored) {
> > return -1;
> > }
> > }
> >
> > - ProcessBuilder latencyTest(String java) {
> > + ProcessBuilder latencyTest(final String java) {
> > return new ProcessBuilder(processArguments(java));
> > }
> >
> > - ProcessBuilder throughputTest(String java) {
> > - List<String> args = processArguments(java);
> > + ProcessBuilder throughputTest(final String java) {
> > + final List<String> args = processArguments(java);
> > args.add("-throughput");
> > return new ProcessBuilder(args);
> > }
> >
> > @Override
> > - public int compareTo(Setup other) {
> > + public int compareTo(final Setup other) {
> > // largest ops/sec first
> > return (int) Math.signum(other._stats._averageOpsPerSec
> > - _stats._averageOpsPerSec);
> > @@ -137,7 +137,7 @@ public class PerfTestDriver {
> > } else if (MTPerfTest.class == _class) {
> > detail = _threadCount + " threads";
> > }
> > - String target = _runner.substring(_runner.indexOf(".Run") +
> 4);
> > + final String target =
> _runner.substring(_runner.indexOf(".Run") + 4);
> > return target + ": " + _name + " (" + detail + ")";
> > }
> > }
> > @@ -152,16 +152,16 @@ public class PerfTestDriver {
> > long _pct99_99;
> > double _latencyRowCount;
> > int _throughputRowCount;
> > - private long _averageOpsPerSec;
> > + private final long _averageOpsPerSec;
> >
> > // example line: avg=828 99%=1118 99.99%=5028 Count=3125
> > - public Stats(String raw) {
> > - String[] lines = raw.split("[\\r\\n]+");
> > + public Stats(final String raw) {
> > + final String[] lines = raw.split("[\\r\\n]+");
> > long totalOps = 0;
> > - for (String line : lines) {
> > + for (final String line : lines) {
> > if (line.startsWith("avg")) {
> > _latencyRowCount++;
> > - String[] parts = line.split(" ");
> > + final String[] parts = line.split(" ");
> > int i = 0;
> > _average += Long.parseLong(parts[i++].split("=")[1]);
> > _pct99 += Long.parseLong(parts[i++].split("=")[1]);
> > @@ -169,8 +169,8 @@ public class PerfTestDriver {
> > _count += Integer.parseInt(parts[i].split("=")[1]);
> > } else {
> > _throughputRowCount++;
> > - String number = line.substring(0, line.indexOf('
> '));
> > - long opsPerSec = Long.parseLong(number);
> > + final String number = line.substring(0,
> line.indexOf(' '));
> > + final long opsPerSec = Long.parseLong(number);
> > totalOps += opsPerSec;
> > }
> > }
> > @@ -179,7 +179,7 @@ public class PerfTestDriver {
> >
> > @Override
> > public String toString() {
> > - String fmt = "throughput: %,d ops/sec. latency(ns):
> avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> > + final String fmt = "throughput: %,d ops/sec. latency(ns):
> avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> > return String.format(fmt, _averageOpsPerSec, //
> > _average / _latencyRowCount, // mean latency
> > _pct99 / _latencyRowCount, // 99% observations less
> than
> > @@ -189,24 +189,24 @@ public class PerfTestDriver {
> > }
> >
> > // single-threaded performance test
> > - private static Setup s(String config, String runner, String name,
> > - String... systemProperties) throws IOException {
> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > + private static Setup s(final String config, final String runner,
> final String name,
> > + final String... systemProperties) throws IOException {
> > + final WaitStrategy wait =
> WaitStrategy.valueOf(System.getProperty(
> > "WaitStrategy", "Sleep"));
> > return new Setup(PerfTest.class, runner, name, config, 1, wait,
> > systemProperties);
> > }
> >
> > // multi-threaded performance test
> > - private static Setup m(String config, String runner, String name,
> > - int threadCount, String... systemProperties) throws
> IOException {
> > - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> > + private static Setup m(final String config, final String runner,
> final String name,
> > + final int threadCount, final String... systemProperties)
> throws IOException {
> > + final WaitStrategy wait =
> WaitStrategy.valueOf(System.getProperty(
> > "WaitStrategy", "Sleep"));
> > return new Setup(MTPerfTest.class, runner, name, config,
> threadCount,
> > wait, systemProperties);
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > + public static void main(final String[] args) throws Exception {
> > final String ALL_ASYNC = "-DLog4jContextSelector="
> > + AsyncLoggerContextSelector.class.getName();
> > final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
> > @@ -215,8 +215,8 @@ public class PerfTestDriver {
> > final String LOG20 = RunLog4j2.class.getName();
> > final String LOGBK = RunLogback.class.getName();
> >
> > - long start = System.nanoTime();
> > - List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> > + final long start = System.nanoTime();
> > + final List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> > // includeLocation=false
> > tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
> > ALL_ASYNC, SYSCLOCK));
> > @@ -285,29 +285,29 @@ public class PerfTestDriver {
> > // "RollFastFileAppender", i));
> > }
> >
> > - String java = args.length > 0 ? args[0] : "java";
> > - int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
> > + final String java = args.length > 0 ? args[0] : "java";
> > + final int repeat = args.length > 1 ? Integer.parseInt(args[1])
> : 5;
> > int x = 0;
> > - for (Setup config : tests) {
> > + for (final Setup config : tests) {
> > System.out.print(config.description());
> > - ProcessBuilder pb = config.throughputTest(java);
> > + final ProcessBuilder pb = config.throughputTest(java);
> > pb.redirectErrorStream(true); // merge System.out and
> System.err
> > - long t1 = System.nanoTime();
> > + final long t1 = System.nanoTime();
> > // int count = config._threadCount >= 16 ? 2 : repeat;
> > runPerfTest(repeat, x++, config, pb);
> > System.out.printf(" took %.1f seconds%n", (System.nanoTime() -
> t1)
> > / (1000.0 * 1000.0 * 1000.0));
> >
> > - FileReader reader = new FileReader(config._temp);
> > - CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> > + final FileReader reader = new FileReader(config._temp);
> > + final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> > reader.read(buffer);
> > reader.close();
> > config._temp.delete();
> > buffer.flip();
> >
> > - String raw = buffer.toString();
> > + final String raw = buffer.toString();
> > System.out.print(raw);
> > - Stats stats = new Stats(raw);
> > + final Stats stats = new Stats(raw);
> > System.out.println(stats);
> > System.out.println("-----");
> > config._stats = stats;
> > @@ -321,19 +321,19 @@ public class PerfTestDriver {
> > printRanking(tests.toArray(new Setup[tests.size()]));
> > }
> >
> > - private static void printRanking(Setup[] tests) {
> > + private static void printRanking(final Setup[] tests) {
> > System.out.println();
> > System.out.println("Ranking:");
> > Arrays.sort(tests);
> > for (int i = 0; i < tests.length; i++) {
> > - Setup setup = tests[i];
> > + final Setup setup = tests[i];
> > System.out.println((i + 1) + ". " + setup.description() + ": "
> > + setup._stats);
> > }
> > }
> >
> > - private static void runPerfTest(int repeat, int setupIndex, Setup
> config,
> > - ProcessBuilder pb) throws IOException, InterruptedException
> {
> > + private static void runPerfTest(final int repeat, final int
> setupIndex, final Setup config,
> > + final ProcessBuilder pb) throws IOException,
> InterruptedException {
> > for (int i = 0; i < repeat; i++) {
> > System.out.print(" (" + (i + 1) + "/" + repeat + ")...");
> > final Process process = pb.start();
> > @@ -343,7 +343,7 @@ public class PerfTestDriver {
> > process.waitFor();
> > stop[0] = true;
> >
> > - File gc = new File("gc" + setupIndex + "_" + i
> > + final File gc = new File("gc" + setupIndex + "_" + i
> > + config._log4jConfig + ".log");
> > if (gc.exists()) {
> > gc.delete();
> > @@ -355,17 +355,17 @@ public class PerfTestDriver {
> > private static Thread printProcessOutput(final Process process,
> > final boolean[] stop) {
> >
> > - Thread t = new Thread("OutputWriter") {
> > + final Thread t = new Thread("OutputWriter") {
> > @Override
> > public void run() {
> > - BufferedReader in = new BufferedReader(new
> InputStreamReader(
> > + final BufferedReader in = new BufferedReader(new
> InputStreamReader(
> > process.getInputStream()));
> > try {
> > String line = null;
> > while (!stop[0] && (line = in.readLine()) != null) {
> > System.out.println(line);
> > }
> > - } catch (Exception ignored) {
> > + } catch (final Exception ignored) {
> > }
> > }
> > };
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
> Tue Jul 9 06:08:25 2013
> > @@ -42,7 +42,7 @@ class PerfTestResultFormatter {
> > double latency99Pct;
> > double latency99_99Pct;
> >
> > - Stats(String throughput, String avg, String lat99, String
> lat99_99)
> > + Stats(final String throughput, final String avg, final
> String lat99, final String lat99_99)
> > throws ParseException {
> > this.throughput =
> NUM.parse(throughput.trim()).longValue();
> > this.avgLatency = Double.parseDouble(avg.trim());
> > @@ -51,40 +51,40 @@ class PerfTestResultFormatter {
> > }
> > }
> >
> > - private Map<String, Map<String, Stats>> results = new
> TreeMap<String, Map<String, Stats>>();
> > + private final Map<String, Map<String, Stats>> results = new
> TreeMap<String, Map<String, Stats>>();
> >
> > public PerfTestResultFormatter() {
> > }
> >
> > - public String format(String text) throws ParseException {
> > + public String format(final String text) throws ParseException {
> > results.clear();
> > - String[] lines = text.split("[\\r\\n]+");
> > - for (String line : lines) {
> > + final String[] lines = text.split("[\\r\\n]+");
> > + for (final String line : lines) {
> > process(line);
> > }
> > return latencyTable() + LF + throughputTable();
> > }
> >
> > private String latencyTable() {
> > - StringBuilder sb = new StringBuilder(4 * 1024);
> > - Set<String> subKeys =
> results.values().iterator().next().keySet();
> > - char[] tabs = new char[subKeys.size()];
> > + final StringBuilder sb = new StringBuilder(4 * 1024);
> > + final Set<String> subKeys =
> results.values().iterator().next().keySet();
> > + final char[] tabs = new char[subKeys.size()];
> > Arrays.fill(tabs, '\t');
> > - String sep = new String(tabs);
> > + final String sep = new String(tabs);
> > sb.append("\tAverage latency").append(sep).append("99%
> less than").append(sep).append("99.99% less than");
> > sb.append(LF);
> > for (int i = 0; i < 3; i++) {
> > - for (String subKey : subKeys) {
> > + for (final String subKey : subKeys) {
> > sb.append("\t").append(subKey);
> > }
> > }
> > sb.append(LF);
> > - for (String key : results.keySet()) {
> > + for (final String key : results.keySet()) {
> > sb.append(key);
> > for (int i = 0; i < 3; i++) {
> > - Map<String, Stats> sub = results.get(key);
> > - for (String subKey : sub.keySet()) {
> > - Stats stats = sub.get(subKey);
> > + final Map<String, Stats> sub =
> results.get(key);
> > + for (final String subKey : sub.keySet()) {
> > + final Stats stats =
> sub.get(subKey);
> > switch (i) {
> > case 0:
> >
> sb.append("\t").append((long) stats.avgLatency);
> > @@ -104,19 +104,19 @@ class PerfTestResultFormatter {
> > }
> >
> > private String throughputTable() {
> > - StringBuilder sb = new StringBuilder(4 * 1024);
> > - Set<String> subKeys =
> results.values().iterator().next().keySet();
> > + final StringBuilder sb = new StringBuilder(4 * 1024);
> > + final Set<String> subKeys =
> results.values().iterator().next().keySet();
> > sb.append("\tThroughput per thread (msg/sec)");
> > sb.append(LF);
> > - for (String subKey : subKeys) {
> > + for (final String subKey : subKeys) {
> > sb.append("\t").append(subKey);
> > }
> > sb.append(LF);
> > - for (String key : results.keySet()) {
> > + for (final String key : results.keySet()) {
> > sb.append(key);
> > - Map<String, Stats> sub = results.get(key);
> > - for (String subKey : sub.keySet()) {
> > - Stats stats = sub.get(subKey);
> > + final Map<String, Stats> sub = results.get(key);
> > + for (final String subKey : sub.keySet()) {
> > + final Stats stats = sub.get(subKey);
> > sb.append("\t").append(stats.throughput);
> > }
> > sb.append(LF);
> > @@ -124,19 +124,19 @@ class PerfTestResultFormatter {
> > return sb.toString();
> > }
> >
> > - private void process(String line) throws ParseException {
> > - String key = line.substring(line.indexOf('.') + 1,
> line.indexOf('('));
> > - String sub = line.substring(line.indexOf('(') + 1,
> line.indexOf(')'));
> > - String throughput =
> line.substring(line.indexOf("throughput: ")
> > + private void process(final String line) throws ParseException {
> > + final String key = line.substring(line.indexOf('.') + 1,
> line.indexOf('('));
> > + final String sub = line.substring(line.indexOf('(') + 1,
> line.indexOf(')'));
> > + final String throughput =
> line.substring(line.indexOf("throughput: ")
> > + "throughput: ".length(), line.indexOf("
> ops"));
> > - String avg = line.substring(line.indexOf("avg=") +
> "avg=".length(),
> > + final String avg = line.substring(line.indexOf("avg=") +
> "avg=".length(),
> > line.indexOf(" 99%"));
> > - String pct99 = line.substring(
> > + final String pct99 = line.substring(
> > line.indexOf("99% < ") + "99% < ".length(),
> > line.indexOf(" 99.99%"));
> > - String pct99_99 = line.substring(line.indexOf("99.99% < ")
> > + final String pct99_99 =
> line.substring(line.indexOf("99.99% < ")
> > + "99.99% < ".length(),
> line.lastIndexOf('(') - 1);
> > - Stats stats = new Stats(throughput, avg, pct99, pct99_99);
> > + final Stats stats = new Stats(throughput, avg, pct99,
> pct99_99);
> > Map<String, Stats> map = results.get(key.trim());
> > if (map == null) {
> > map = new TreeMap<String, Stats>(sort());
> > @@ -156,9 +156,9 @@ class PerfTestResultFormatter {
> > "64 threads");
> >
> > @Override
> > - public int compare(String o1, String o2) {
> > - int i1 = expected.indexOf(o1);
> > - int i2 = expected.indexOf(o2);
> > + public int compare(final String o1, final String
> o2) {
> > + final int i1 = expected.indexOf(o1);
> > + final int i2 = expected.indexOf(o2);
> > if (i1 < 0 || i2 < 0) {
> > return o1.compareTo(o2);
> > }
> > @@ -167,9 +167,9 @@ class PerfTestResultFormatter {
> > };
> > }
> >
> > - public static void main(String[] args) throws Exception {
> > - PerfTestResultFormatter fmt = new
> PerfTestResultFormatter();
> > - BufferedReader reader = new BufferedReader(new
> InputStreamReader(
> > + public static void main(final String[] args) throws Exception {
> > + final PerfTestResultFormatter fmt = new
> PerfTestResultFormatter();
> > + final BufferedReader reader = new BufferedReader(new
> InputStreamReader(
> > System.in));
> > String line;
> > while ((line = reader.readLine()) != null) {
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
> Tue Jul 9 06:08:25 2013
> > @@ -24,32 +24,32 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLog4j1 implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram
> histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 -
> s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram
> histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -62,8 +62,8 @@ public class RunLog4j1 implements IPerfT
> > }
> >
> > @Override
> > - public void log(String finalMessage) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void log(final String finalMessage) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > logger.info(finalMessage);
> > }
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
> Tue Jul 9 06:08:25 2013
> > @@ -25,33 +25,33 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLog4j2 implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram
> histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 -
> s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram
> histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> > // busy spin
> > }
> > @@ -66,8 +66,8 @@ public class RunLog4j2 implements IPerfT
> >
> >
> > @Override
> > - public void log(String finalMessage) {
> > - Logger logger = LogManager.getLogger(getClass());
> > + public void log(final String finalMessage) {
> > + final Logger logger = LogManager.getLogger(getClass());
> > logger.info(finalMessage);
> > }
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
> Tue Jul 9 06:08:25 2013
> > @@ -26,32 +26,32 @@ import com.lmax.disruptor.collections.Hi
> > public class RunLogback implements IPerfTestRunner {
> >
> > @Override
> > - public void runThroughputTest(int lines, Histogram histogram) {
> > - long s1 = System.nanoTime();
> > - Logger logger = (Logger)
> LoggerFactory.getLogger(getClass());
> > + public void runThroughputTest(final int lines, final Histogram
> histogram) {
> > + final long s1 = System.nanoTime();
> > + final Logger logger = (Logger)
> LoggerFactory.getLogger(getClass());
> > for (int j = 0; j < lines; j++) {
> > logger.info(THROUGHPUT_MSG);
> > }
> > - long s2 = System.nanoTime();
> > - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 -
> s1);
> > + final long s2 = System.nanoTime();
> > + final long opsPerSec = (1000L * 1000L * 1000L * lines) /
> (s2 - s1);
> > histogram.addObservation(opsPerSec);
> > }
> >
> > @Override
> > - public void runLatencyTest(int samples, Histogram histogram,
> > - long nanoTimeCost, int threadCount) {
> > - Logger logger = (Logger)
> LoggerFactory.getLogger(getClass());
> > + public void runLatencyTest(final int samples, final Histogram
> histogram,
> > + final long nanoTimeCost, final int threadCount) {
> > + final Logger logger = (Logger)
> LoggerFactory.getLogger(getClass());
> > for (int i = 0; i < samples; i++) {
> > - long s1 = System.nanoTime();
> > + final long s1 = System.nanoTime();
> > logger.info(LATENCY_MSG);
> > - long s2 = System.nanoTime();
> > - long value = s2 - s1 - nanoTimeCost;
> > + final long s2 = System.nanoTime();
> > + final long value = s2 - s1 - nanoTimeCost;
> > if (value > 0) {
> > histogram.addObservation(value);
> > }
> > // wait 1 microsec
> > final long PAUSE_NANOS = 10000 * threadCount;
> > - long pauseStart = System.nanoTime();
> > + final long pauseStart = System.nanoTime();
> > while (PAUSE_NANOS > (System.nanoTime() -
> pauseStart)) {
> > // busy spin
> > }
> > @@ -64,8 +64,8 @@ public class RunLogback implements IPerf
> > }
> >
> > @Override
> > - public void log(String msg) {
> > - Logger logger = (Logger)
> LoggerFactory.getLogger(getClass());
> > + public void log(final String msg) {
> > + final Logger logger = (Logger)
> LoggerFactory.getLogger(getClass());
> > logger.info(msg);
> > }
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -63,12 +63,12 @@ public class AdvertiserTest {
> > file.delete();
> > }
> >
> > - private void verifyExpectedEntriesAdvertised(Map<Object,
> Map<String, String>> entries) {
> > + private void verifyExpectedEntriesAdvertised(final Map<Object,
> Map<String, String>> entries) {
> > boolean foundFile1 = false;
> > boolean foundFile2 = false;
> > boolean foundSocket1 = false;
> > boolean foundSocket2 = false;
> > - for (Map<String, String>entry:entries.values()) {
> > + for (final Map<String, String>entry:entries.values()) {
> > if (foundFile1 && foundFile2 && foundSocket1 && foundSocket2) {
> > break;
> > }
> > @@ -103,7 +103,7 @@ public class AdvertiserTest {
> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> > ctx.stop();
> >
> > - Map<Object, Map<String, String>> entries =
> InMemoryAdvertiser.getAdvertisedEntries();
> > + final Map<Object, Map<String, String>> entries =
> InMemoryAdvertiser.getAdvertisedEntries();
> > assertTrue("Entries found: " + entries, entries.isEmpty());
> >
> > //reconfigure for subsequent testing
> > @@ -117,7 +117,7 @@ public class AdvertiserTest {
> > final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> > ctx.stop();
> >
> > - Map<Object, Map<String, String>> entries =
> InMemoryAdvertiser.getAdvertisedEntries();
> > + final Map<Object, Map<String, String>> entries =
> InMemoryAdvertiser.getAdvertisedEntries();
> > assertTrue("Entries found: " + entries, entries.isEmpty());
> >
> > ctx.start();
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -34,9 +34,9 @@ public class BaseConfigurationTest {
> > @Test
> > public void testMissingRootLogger() throws Exception {
> > PluginManager.addPackage("org.apache.logging.log4j.test.appender");
> > - LoggerContext ctx = Configurator.initialize("Test1", null,
> "missingRootLogger.xml");
> > + final LoggerContext ctx = Configurator.initialize("Test1",
> null, "missingRootLogger.xml");
> > final Logger logger = LogManager.getLogger("sample.Logger1");
> > - Configuration config = ctx.getConfiguration();
> > + final Configuration config = ctx.getConfiguration();
> > assertNotNull("Config not null", config);
> > // final String MISSINGROOT = "MissingRootTest";
> > // assertTrue("Incorrect Configuration. Expected " + MISSINGROOT
> + " but found " + config.getName(),
> > @@ -53,15 +53,15 @@ public class BaseConfigurationTest {
> > // only the sample logger, no root logger in loggerMap!
> > assertTrue("contains key=sample", loggerMap.containsKey("sample"));
> >
> > - LoggerConfig sample = loggerMap.get("sample");
> > - Map<String, Appender<?>> sampleAppenders =
> sample.getAppenders();
> > + final LoggerConfig sample = loggerMap.get("sample");
> > + final Map<String, Appender<?>> sampleAppenders =
> sample.getAppenders();
> > assertEquals("sampleAppenders Size", 1, sampleAppenders.size());
> > // sample only has List appender, not Console!
> > assertTrue("sample has appender List",
> sampleAppenders.containsKey("List"));
> >
> > - BaseConfiguration baseConfig = (BaseConfiguration) config;
> > - LoggerConfig root = baseConfig.getRootLogger();
> > - Map<String, Appender<?>> rootAppenders = root.getAppenders();
> > + final BaseConfiguration baseConfig = (BaseConfiguration) config;
> > + final LoggerConfig root = baseConfig.getRootLogger();
> > + final Map<String, Appender<?>> rootAppenders =
> root.getAppenders();
> > assertEquals("rootAppenders Size", 1, rootAppenders.size());
> > // root only has Console appender!
> > assertTrue("root has appender Console",
> rootAppenders.containsKey("Console"));
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
> Tue Jul 9 06:08:25 2013
> > @@ -28,20 +28,20 @@ public class InMemoryAdvertiser implemen
> >
> > public static Map<Object, Map<String, String>> getAdvertisedEntries()
> > {
> > - Map<Object, Map<String, String>> result = new HashMap<Object,
> Map<String, String>>();
> > + final Map<Object, Map<String, String>> result = new
> HashMap<Object, Map<String, String>>();
> > result.putAll(properties);
> > return result;
> > }
> >
> > @Override
> > - public Object advertise(Map<String, String> newEntry) {
> > - Object object = new Object();
> > + public Object advertise(final Map<String, String> newEntry) {
> > + final Object object = new Object();
> > properties.put(object, new HashMap<String, String>(newEntry));
> > return object;
> > }
> >
> > @Override
> > - public void unadvertise(Object advertisedObject) {
> > + public void unadvertise(final Object advertisedObject) {
> > properties.remove(advertisedObject);
> > }
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
> Tue Jul 9 06:08:25 2013
> > @@ -189,24 +189,24 @@ public class TestConfigurator {
> > public void testEnvironment() throws Exception {
> > final LoggerContext ctx = Configurator.initialize("-config", null,
> (String) null);
> > final Logger logger =
> LogManager.getLogger("org.apache.test.TestConfigurator");
> > - Configuration config = ctx.getConfiguration();
> > + final Configuration config = ctx.getConfiguration();
> > assertNotNull("No configuration", config);
> > assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + "
> but found " + config.getName(),
> > CONFIG_NAME.equals(config.getName()));
> > final Map<String, Appender<?>> map = config.getAppenders();
> > assertNotNull("No Appenders", map != null && map.size() > 0);
> > Appender<?> app = null;
> > - for (Map.Entry<String, Appender<?>> entry: map.entrySet()) {
> > + for (final Map.Entry<String, Appender<?>> entry:
> map.entrySet()) {
> > if (entry.getKey().equals("List2")) {
> > app = entry.getValue();
> > break;
> > }
> > }
> > assertNotNull("No ListAppender named List2", app);
> > - Layout layout = app.getLayout();
> > + final Layout layout = app.getLayout();
> > assertNotNull("Appender List2 does not have a Layout", layout);
> > assertTrue("Appender List2 is not configured with a
> PatternLayout", layout instanceof PatternLayout);
> > - String pattern = ((PatternLayout)
> layout).getConversionPattern();
> > + final String pattern = ((PatternLayout)
> layout).getConversionPattern();
> > assertNotNull("No conversion pattern for List2 PatternLayout",
> pattern);
> > assertFalse("Environment variable was not substituted",
> pattern.startsWith("${env:PATH}"));
> > }
> >
> > Modified:
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
> > URL:
> http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> >
> ==============================================================================
> > ---
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
> (original)
> > +++
> logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
> Tue Jul 9 06:08:25 2013
> > @@ -55,7 +55,7 @@ public class RegexFilterTest {
> >
> > @Test
> > public void TestNoMsg() {
> > - RegexFilter filter = RegexFilter.createFilter(".* test .*",
> null, null, null);
> > + final RegexFilter filter = RegexFilter.createFilter(".* test
> .*", null, null, null);
> > filter.start();
> > assertTrue(filter.isStarted());
> > assertTrue(filter.filter(null, Level.DEBUG, null, (String)null,
> (Throwable)null) == Filter.Result.DENY);
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: svn commit: r1501104 [4/5] - in /logging/log4j/log4j2/trunk: api/src/main/java/org/apache/logging/log4j/ api/src/main/java/org/apache/logging/log4j/message/ api/src/main/java/org/apache/logging/log4j/simple/ api/src/main/java/org/apache/logging/log4j/s...
Posted by Ralph Goers <ra...@dslextreme.com>.
After fixing the prior compiler error I then ran into this one:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project log4j-core: Compilation failure
[ERROR] /Users/rgoers/projects/apache/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java:[177,13] variable _averageOpsPerSec might already have been assigned
Can you please compile and test before committing?
Ralph
On Jul 8, 2013, at 11:08 PM, ggregory@apache.org wrote:
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> @@ -41,7 +41,7 @@ public class ContextStackAttributeConver
>
> @Test
> public void testConvertToDatabaseColumn01() {
> - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> Arrays.asList("value1", "another2"));
>
> assertEquals("The converted value is not correct.", "value1\nanother2",
> @@ -50,7 +50,7 @@ public class ContextStackAttributeConver
>
> @Test
> public void testConvertToDatabaseColumn02() {
> - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> Arrays.asList("key1", "value2", "my3"));
>
> assertEquals("The converted value is not correct.",
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ContextStackJsonAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> @@ -42,14 +42,14 @@ public class ContextStackJsonAttributeCo
> @Test
> public void testConvert01() {
> ThreadContext.clearStack();
> - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> Arrays.asList("value1", "another2"));
>
> - String converted = this.converter.convertToDatabaseColumn(stack);
> + final String converted = this.converter.convertToDatabaseColumn(stack);
>
> assertNotNull("The converted value should not be null.", converted);
>
> - ThreadContext.ContextStack reversed = this.converter
> + final ThreadContext.ContextStack reversed = this.converter
> .convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> @@ -60,14 +60,14 @@ public class ContextStackJsonAttributeCo
> @Test
> public void testConvert02() {
> ThreadContext.clearStack();
> - ThreadContext.ContextStack stack = new MutableThreadContextStack(
> + final ThreadContext.ContextStack stack = new MutableThreadContextStack(
> Arrays.asList("key1", "value2", "my3"));
>
> - String converted = this.converter.convertToDatabaseColumn(stack);
> + final String converted = this.converter.convertToDatabaseColumn(stack);
>
> assertNotNull("The converted value should not be null.", converted);
>
> - ThreadContext.ContextStack reversed = this.converter
> + final ThreadContext.ContextStack reversed = this.converter
> .convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MarkerAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> @@ -39,14 +39,14 @@ public class MarkerAttributeConverterTes
>
> @Test
> public void testConvert01() {
> - Marker marker = MarkerManager.getMarker("testConvert01");
> + final Marker marker = MarkerManager.getMarker("testConvert01");
>
> - String converted = this.converter.convertToDatabaseColumn(marker);
> + final String converted = this.converter.convertToDatabaseColumn(marker);
>
> assertNotNull("The converted value should not be null.", converted);
> assertEquals("The converted value is not correct.", "testConvert01", converted);
>
> - Marker reversed = this.converter.convertToEntityAttribute(converted);
> + final Marker reversed = this.converter.convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> assertEquals("The reversed value is not correct.", "testConvert01", marker.getName());
> @@ -54,19 +54,19 @@ public class MarkerAttributeConverterTes
>
> @Test
> public void testConvert02() {
> - Marker marker = MarkerManager.getMarker("testConvert02",
> + final Marker marker = MarkerManager.getMarker("testConvert02",
> MarkerManager.getMarker("anotherConvert02",
> MarkerManager.getMarker("finalConvert03")
> )
> );
>
> - String converted = this.converter.convertToDatabaseColumn(marker);
> + final String converted = this.converter.convertToDatabaseColumn(marker);
>
> assertNotNull("The converted value should not be null.", converted);
> assertEquals("The converted value is not correct.", "testConvert02[ anotherConvert02[ finalConvert03 ] ] ]",
> converted);
>
> - Marker reversed = this.converter.convertToEntityAttribute(converted);
> + final Marker reversed = this.converter.convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> assertEquals("The reversed value is not correct.", "testConvert02", marker.getName());
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/MessageAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> @@ -41,14 +41,14 @@ public class MessageAttributeConverterTe
>
> @Test
> public void testConvert01() {
> - Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
> + final Message message = log.getMessageFactory().newMessage("Message #{} said [{}].", 3, "Hello");
>
> - String converted = this.converter.convertToDatabaseColumn(message);
> + final String converted = this.converter.convertToDatabaseColumn(message);
>
> assertNotNull("The converted value should not be null.", converted);
> assertEquals("The converted value is not correct.", "Message #3 said [Hello].", converted);
>
> - Message reversed = this.converter.convertToEntityAttribute(converted);
> + final Message reversed = this.converter.convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> assertEquals("The reversed value is not correct.", "Message #3 said [Hello].", reversed.getFormattedMessage());
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/StackTraceElementAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> @@ -37,15 +37,15 @@ public class StackTraceElementAttributeC
>
> @Test
> public void testConvert01() {
> - StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
> + final StackTraceElement element = new StackTraceElement("TestNoPackage", "testConvert01", "TestNoPackage.java", 1234);
>
> - String converted = this.converter.convertToDatabaseColumn(element);
> + final String converted = this.converter.convertToDatabaseColumn(element);
>
> assertNotNull("The converted value should not be null.", converted);
> assertEquals("The converted value is not correct.", "TestNoPackage.testConvert01(TestNoPackage.java:1234)",
> converted);
>
> - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> assertEquals("The class name is not correct.", "TestNoPackage", reversed.getClassName());
> @@ -57,17 +57,17 @@ public class StackTraceElementAttributeC
>
> @Test
> public void testConvert02() {
> - StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
> + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestWithPackage",
> "testConvert02", "TestWithPackage.java", -1);
>
> - String converted = this.converter.convertToDatabaseColumn(element);
> + final String converted = this.converter.convertToDatabaseColumn(element);
>
> assertNotNull("The converted value should not be null.", converted);
> assertEquals("The converted value is not correct.",
> "org.apache.logging.TestWithPackage.testConvert02(TestWithPackage.java)",
> converted);
>
> - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> assertEquals("The class name is not correct.", "org.apache.logging.TestWithPackage", reversed.getClassName());
> @@ -79,17 +79,17 @@ public class StackTraceElementAttributeC
>
> @Test
> public void testConvert03() {
> - StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
> + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestNoSource",
> "testConvert03", null, -1);
>
> - String converted = this.converter.convertToDatabaseColumn(element);
> + final String converted = this.converter.convertToDatabaseColumn(element);
>
> assertNotNull("The converted value should not be null.", converted);
> assertEquals("The converted value is not correct.",
> "org.apache.logging.TestNoSource.testConvert03(Unknown Source)",
> converted);
>
> - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> assertEquals("The class name is not correct.", "org.apache.logging.TestNoSource", reversed.getClassName());
> @@ -101,17 +101,17 @@ public class StackTraceElementAttributeC
>
> @Test
> public void testConvert04() {
> - StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
> + final StackTraceElement element = new StackTraceElement("org.apache.logging.TestIsNativeMethod",
> "testConvert04", null, -2);
>
> - String converted = this.converter.convertToDatabaseColumn(element);
> + final String converted = this.converter.convertToDatabaseColumn(element);
>
> assertNotNull("The converted value should not be null.", converted);
> assertEquals("The converted value is not correct.",
> "org.apache.logging.TestIsNativeMethod.testConvert04(Native Method)",
> converted);
>
> - StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
> + final StackTraceElement reversed = this.converter.convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> assertEquals("The class name is not correct.", "org.apache.logging.TestIsNativeMethod",
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/db/jpa/converter/ThrowableAttributeConverterTest.java Tue Jul 9 06:08:25 2013
> @@ -39,16 +39,16 @@ public class ThrowableAttributeConverter
>
> @Test
> public void testConvert01() {
> - RuntimeException exception = new RuntimeException("My message 01.");
> + final RuntimeException exception = new RuntimeException("My message 01.");
>
> - String stackTrace = getStackTrace(exception);
> + final String stackTrace = getStackTrace(exception);
>
> - String converted = this.converter.convertToDatabaseColumn(exception);
> + final String converted = this.converter.convertToDatabaseColumn(exception);
>
> assertNotNull("The converted value is not correct.", converted);
> assertEquals("The converted value is not correct.", stackTrace, converted);
>
> - Throwable reversed = this.converter.convertToEntityAttribute(converted);
> + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
> @@ -56,18 +56,18 @@ public class ThrowableAttributeConverter
>
> @Test
> public void testConvert02() {
> - SQLException cause2 = new SQLException("This is a test cause.");
> - Error cause1 = new Error(cause2);
> - RuntimeException exception = new RuntimeException("My message 01.", cause1);
> + final SQLException cause2 = new SQLException("This is a test cause.");
> + final Error cause1 = new Error(cause2);
> + final RuntimeException exception = new RuntimeException("My message 01.", cause1);
>
> - String stackTrace = getStackTrace(exception);
> + final String stackTrace = getStackTrace(exception);
>
> - String converted = this.converter.convertToDatabaseColumn(exception);
> + final String converted = this.converter.convertToDatabaseColumn(exception);
>
> assertNotNull("The converted value is not correct.", converted);
> assertEquals("The converted value is not correct.", stackTrace, converted);
>
> - Throwable reversed = this.converter.convertToEntityAttribute(converted);
> + final Throwable reversed = this.converter.convertToEntityAttribute(converted);
>
> assertNotNull("The reversed value should not be null.", reversed);
> assertEquals("The reversed value is not correct.", stackTrace, getStackTrace(reversed));
> @@ -84,10 +84,10 @@ public class ThrowableAttributeConverter
> assertNull("The converted attribute should be null (2).", this.converter.convertToEntityAttribute(""));
> }
>
> - private static String getStackTrace(Throwable throwable) {
> + private static String getStackTrace(final Throwable throwable) {
> String returnValue = throwable.toString() + "\n";
>
> - for (StackTraceElement element : throwable.getStackTrace()) {
> + for (final StackTraceElement element : throwable.getStackTrace()) {
> returnValue += "\tat " + element.toString() + "\n";
> }
>
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/MapRewritePolicyTest.java Tue Jul 9 06:08:25 2013
> @@ -51,7 +51,7 @@ public class MapRewritePolicyTest {
> logEvent1 = new Log4jLogEvent("test", null, "MapRewritePolicyTest.setupClass()", Level.ERROR,
> new MapMessage(map), null, map, null, "none",
> new StackTraceElement("MapRewritePolicyTest", "setupClass", "MapRewritePolicyTest", 29), 2);
> - ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
> + final ThreadContextStack stack = new MutableThreadContextStack(new ArrayList<String>(map.values()));
> logEvent2 = new Log4jLogEvent("test", MarkerManager.getMarker("test"), "MapRewritePolicyTest.setupClass()",
> Level.TRACE, new StructuredDataMessage("test", "Nothing", "test", map), new RuntimeException("test"), null,
> stack, "none", new StackTraceElement("MapRewritePolicyTest",
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rewrite/RewriteAppenderTest.java Tue Jul 9 06:08:25 2013
> @@ -112,7 +112,7 @@ public class RewriteAppenderTest {
> StructuredDataMessage msg = new StructuredDataMessage("Test", "This is a test", "Service");
> msg.put("Key1", "Value2");
> msg.put("Key2", "Value1");
> - Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> + final Logger logger = LogManager.getLogger("org.apache.logging.log4j.core.Logging");
> logger.debug(msg);
> msg = new StructuredDataMessage("Test", "This is a test", "Service");
> msg.put("Key1", "Value1");
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/FastRollingFileManagerTest.java Tue Jul 9 06:08:25 2013
> @@ -40,23 +40,23 @@ public class FastRollingFileManagerTest
> */
> @Test
> public void testWrite_multiplesOfBufferSize() throws IOException {
> - File file = File.createTempFile("log4j2", "test");
> + final File file = File.createTempFile("log4j2", "test");
> file.deleteOnExit();
> - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> - OutputStream os = new FastRollingFileManager.DummyOutputStream();
> - boolean append = false;
> - boolean flushNow = false;
> - long triggerSize = Long.MAX_VALUE;
> - long time = System.currentTimeMillis();
> - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
> + final boolean append = false;
> + final boolean flushNow = false;
> + final long triggerSize = Long.MAX_VALUE;
> + final long time = System.currentTimeMillis();
> + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> triggerSize);
> - RolloverStrategy rolloverStrategy = null;
> - FastRollingFileManager manager = new FastRollingFileManager(raf,
> + final RolloverStrategy rolloverStrategy = null;
> + final FastRollingFileManager manager = new FastRollingFileManager(raf,
> file.getName(), "", os, append, flushNow, triggerSize, time,
> triggerPolicy, rolloverStrategy, null, null);
>
> - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> - byte[] data = new byte[size];
> + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3;
> + final byte[] data = new byte[size];
> manager.write(data, 0, data.length); // no buffer overflow exception
>
> // buffer is full but not flushed yet
> @@ -71,23 +71,23 @@ public class FastRollingFileManagerTest
> */
> @Test
> public void testWrite_dataExceedingBufferSize() throws IOException {
> - File file = File.createTempFile("log4j2", "test");
> + final File file = File.createTempFile("log4j2", "test");
> file.deleteOnExit();
> - RandomAccessFile raf = new RandomAccessFile(file, "rw");
> - OutputStream os = new FastRollingFileManager.DummyOutputStream();
> - boolean append = false;
> - boolean flushNow = false;
> - long triggerSize = 0;
> - long time = System.currentTimeMillis();
> - TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> + final RandomAccessFile raf = new RandomAccessFile(file, "rw");
> + final OutputStream os = new FastRollingFileManager.DummyOutputStream();
> + final boolean append = false;
> + final boolean flushNow = false;
> + final long triggerSize = 0;
> + final long time = System.currentTimeMillis();
> + final TriggeringPolicy triggerPolicy = new SizeBasedTriggeringPolicy(
> triggerSize);
> - RolloverStrategy rolloverStrategy = null;
> - FastRollingFileManager manager = new FastRollingFileManager(raf,
> + final RolloverStrategy rolloverStrategy = null;
> + final FastRollingFileManager manager = new FastRollingFileManager(raf,
> file.getName(), "", os, append, flushNow, triggerSize, time,
> triggerPolicy, rolloverStrategy, null, null);
>
> - int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
> - byte[] data = new byte[size];
> + final int size = FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3 + 1;
> + final byte[] data = new byte[size];
> manager.write(data, 0, data.length); // no exception
> assertEquals(FastRollingFileManager.DEFAULT_BUFFER_SIZE * 3,
> raf.length());
> @@ -98,12 +98,12 @@ public class FastRollingFileManagerTest
>
> @Test
> public void testAppendDoesNotOverwriteExistingFile() throws IOException {
> - boolean isAppend = true;
> - File file = File.createTempFile("log4j2", "test");
> + final boolean isAppend = true;
> + final File file = File.createTempFile("log4j2", "test");
> file.deleteOnExit();
> assertEquals(0, file.length());
>
> - byte[] bytes = new byte[4 * 1024];
> + final byte[] bytes = new byte[4 * 1024];
>
> // create existing file
> FileOutputStream fos = null;
> @@ -116,31 +116,31 @@ public class FastRollingFileManagerTest
> }
> assertEquals("all flushed to disk", bytes.length, file.length());
>
> - FastRollingFileManager manager = FastRollingFileManager
> + final FastRollingFileManager manager = FastRollingFileManager
> .getFastRollingFileManager(
> //
> file.getAbsolutePath(), "", isAppend, true,
> new SizeBasedTriggeringPolicy(Long.MAX_VALUE), //
> null, null, null);
> manager.write(bytes, 0, bytes.length);
> - int expected = bytes.length * 2;
> + final int expected = bytes.length * 2;
> assertEquals("appended, not overwritten", expected, file.length());
> }
>
> @Test
> public void testFileTimeBasedOnSystemClockWhenAppendIsFalse()
> throws IOException {
> - File file = File.createTempFile("log4j2", "test");
> + final File file = File.createTempFile("log4j2", "test");
> file.deleteOnExit();
> LockSupport.parkNanos(1000000); // 1 millisec
>
> // append is false deletes the file if it exists
> - boolean isAppend = false;
> - long expectedMin = System.currentTimeMillis();
> - long expectedMax = expectedMin + 50;
> + final boolean isAppend = false;
> + final long expectedMin = System.currentTimeMillis();
> + final long expectedMax = expectedMin + 50;
> assertTrue(file.lastModified() < expectedMin);
>
> - FastRollingFileManager manager = FastRollingFileManager
> + final FastRollingFileManager manager = FastRollingFileManager
> .getFastRollingFileManager(
> //
> file.getAbsolutePath(), "", isAppend, true,
> @@ -153,14 +153,14 @@ public class FastRollingFileManagerTest
> @Test
> public void testFileTimeBasedOnFileModifiedTimeWhenAppendIsTrue()
> throws IOException {
> - File file = File.createTempFile("log4j2", "test");
> + final File file = File.createTempFile("log4j2", "test");
> file.deleteOnExit();
> LockSupport.parkNanos(1000000); // 1 millisec
>
> - boolean isAppend = true;
> + final boolean isAppend = true;
> assertTrue(file.lastModified() < System.currentTimeMillis());
>
> - FastRollingFileManager manager = FastRollingFileManager
> + final FastRollingFileManager manager = FastRollingFileManager
> .getFastRollingFileManager(
> //
> file.getAbsolutePath(), "", isAppend, true,
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/appender/rolling/helper/FileRenameActionTest.java Tue Jul 9 06:08:25 2013
> @@ -35,7 +35,7 @@ public class FileRenameActionTest {
>
> @BeforeClass
> public static void beforeClass() throws Exception {
> - File file = new File(DIR);
> + final File file = new File(DIR);
> file.mkdirs();
> }
>
> @@ -51,15 +51,15 @@ public class FileRenameActionTest {
>
> @Test
> public void testRename1() throws Exception {
> - File file = new File("target/fileRename/fileRename.log");
> - PrintStream pos = new PrintStream(file);
> + final File file = new File("target/fileRename/fileRename.log");
> + final PrintStream pos = new PrintStream(file);
> for (int i = 0; i < 100; ++i) {
> pos.println("This is line " + i);
> }
> pos.close();
>
> - File dest = new File("target/fileRename/newFile.log");
> - FileRenameAction action = new FileRenameAction(file, dest, false);
> + final File dest = new File("target/fileRename/newFile.log");
> + final FileRenameAction action = new FileRenameAction(file, dest, false);
> action.execute();
> assertTrue("Renamed file does not exist", dest.exists());
> assertTrue("Old file exists", !file.exists());
> @@ -67,12 +67,12 @@ public class FileRenameActionTest {
>
> @Test
> public void testEmpty() throws Exception {
> - File file = new File("target/fileRename/fileRename.log");
> - PrintStream pos = new PrintStream(file);
> + final File file = new File("target/fileRename/fileRename.log");
> + final PrintStream pos = new PrintStream(file);
> pos.close();
>
> - File dest = new File("target/fileRename/newFile.log");
> - FileRenameAction action = new FileRenameAction(file, dest, false);
> + final File dest = new File("target/fileRename/newFile.log");
> + final FileRenameAction action = new FileRenameAction(file, dest, false);
> action.execute();
> assertTrue("Renamed file does not exist", !dest.exists());
> assertTrue("Old file does not exist", !file.exists());
> @@ -81,16 +81,16 @@ public class FileRenameActionTest {
>
> @Test
> public void testNoParent() throws Exception {
> - File file = new File("fileRename.log");
> - PrintStream pos = new PrintStream(file);
> + final File file = new File("fileRename.log");
> + final PrintStream pos = new PrintStream(file);
> for (int i = 0; i < 100; ++i) {
> pos.println("This is line " + i);
> }
> pos.close();
>
> - File dest = new File("newFile.log");
> + final File dest = new File("newFile.log");
> try {
> - FileRenameAction action = new FileRenameAction(file, dest, false);
> + final FileRenameAction action = new FileRenameAction(file, dest, false);
> action.execute();
> assertTrue("Renamed file does not exist", dest.exists());
> assertTrue("Old file exists", !file.exists());
> @@ -98,7 +98,7 @@ public class FileRenameActionTest {
> try {
> dest.delete();
> file.delete();
> - } catch (Exception ex) {
> + } catch (final Exception ex) {
> System.out.println("Unable to cleanup files written to main directory");
> }
> }
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerConfigTest.java Tue Jul 9 06:08:25 2013
> @@ -39,17 +39,17 @@ public class AsyncLoggerConfigTest {
>
> @Test
> public void testAdditivity() throws Exception {
> - File f = new File("target", "AsyncLoggerConfigTest.log");
> + final File f = new File("target", "AsyncLoggerConfigTest.log");
> // System.out.println(f.getAbsolutePath());
> f.delete();
> - Logger log = LogManager.getLogger("com.foo.Bar");
> - String msg = "Additive logging: 2 for the price of 1!";
> + final Logger log = LogManager.getLogger("com.foo.Bar");
> + final String msg = "Additive logging: 2 for the price of 1!";
> log.info(msg);
> ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>
> - BufferedReader reader = new BufferedReader(new FileReader(f));
> - String line1 = reader.readLine();
> - String line2 = reader.readLine();
> + final BufferedReader reader = new BufferedReader(new FileReader(f));
> + final String line1 = reader.readLine();
> + final String line2 = reader.readLine();
> reader.close();
> f.delete();
> assertNotNull("line1", line1);
> @@ -57,7 +57,7 @@ public class AsyncLoggerConfigTest {
> assertTrue("line1 correct", line1.contains(msg));
> assertTrue("line2 correct", line2.contains(msg));
>
> - String location = "testAdditivity";
> + final String location = "testAdditivity";
> assertTrue("location",
> line1.contains(location) || line2.contains(location));
> }
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextSelectorTest.java Tue Jul 9 06:08:25 2013
> @@ -29,24 +29,24 @@ public class AsyncLoggerContextSelectorT
>
> @Test
> public void testContextReturnsAsyncLoggerContext() {
> - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> - LoggerContext context = selector.getContext(null, null, false);
> + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> + final LoggerContext context = selector.getContext(null, null, false);
>
> assertTrue(context instanceof AsyncLoggerContext);
> }
>
> @Test
> public void testContext2ReturnsAsyncLoggerContext() {
> - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> - LoggerContext context = selector.getContext(null, null, false, null);
> + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> + final LoggerContext context = selector.getContext(null, null, false, null);
>
> assertTrue(context instanceof AsyncLoggerContext);
> }
>
> @Test
> public void testLoggerContextsReturnsAsyncLoggerContext() {
> - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> - List<LoggerContext> list = selector.getLoggerContexts();
> + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> + final List<LoggerContext> list = selector.getLoggerContexts();
>
> assertEquals(1, list.size());
> assertTrue(list.get(0) instanceof AsyncLoggerContext);
> @@ -54,8 +54,8 @@ public class AsyncLoggerContextSelectorT
>
> @Test
> public void testContextNameIsAsyncLoggerContext() {
> - AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> - LoggerContext context = selector.getContext(null, null, false);
> + final AsyncLoggerContextSelector selector = new AsyncLoggerContextSelector();
> + final LoggerContext context = selector.getContext(null, null, false);
>
> assertEquals("AsyncLoggerContext", context.getName());
> }
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerContextTest.java Tue Jul 9 06:08:25 2013
> @@ -30,7 +30,7 @@ public class AsyncLoggerContextTest {
>
> @Test
> public void testNewInstanceReturnsAsyncLogger() {
> - Logger logger = new AsyncLoggerContext("a").newInstance(
> + final Logger logger = new AsyncLoggerContext("a").newInstance(
> new LoggerContext("a"), "a", null);
> assertTrue(logger instanceof AsyncLogger);
>
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerLocationTest.java Tue Jul 9 06:08:25 2013
> @@ -49,22 +49,22 @@ public class AsyncLoggerLocationTest {
>
> @Test
> public void testAsyncLogWritesToLog() throws Exception {
> - File f = new File("target", "AsyncLoggerLocationTest.log");
> + final File f = new File("target", "AsyncLoggerLocationTest.log");
> // System.out.println(f.getAbsolutePath());
> f.delete();
> - Logger log = LogManager.getLogger("com.foo.Bar");
> - String msg = "Async logger msg with location";
> + final Logger log = LogManager.getLogger("com.foo.Bar");
> + final String msg = "Async logger msg with location";
> log.info(msg);
> ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>
> - BufferedReader reader = new BufferedReader(new FileReader(f));
> - String line1 = reader.readLine();
> + final BufferedReader reader = new BufferedReader(new FileReader(f));
> + final String line1 = reader.readLine();
> reader.close();
> f.delete();
> assertNotNull("line1", line1);
> assertTrue("line1 correct", line1.contains(msg));
>
> - String location = "testAsyncLogWritesToLog";
> + final String location = "testAsyncLogWritesToLog";
> assertTrue("has location", line1.contains(location));
> }
>
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/AsyncLoggerTest.java Tue Jul 9 06:08:25 2013
> @@ -49,22 +49,22 @@ public class AsyncLoggerTest {
>
> @Test
> public void testAsyncLogWritesToLog() throws Exception {
> - File f = new File("target", "AsyncLoggerTest.log");
> + final File f = new File("target", "AsyncLoggerTest.log");
> // System.out.println(f.getAbsolutePath());
> f.delete();
> - Logger log = LogManager.getLogger("com.foo.Bar");
> - String msg = "Async logger msg";
> + final Logger log = LogManager.getLogger("com.foo.Bar");
> + final String msg = "Async logger msg";
> log.info(msg);
> ((LifeCycle) LogManager.getContext()).stop(); // stop async thread
>
> - BufferedReader reader = new BufferedReader(new FileReader(f));
> - String line1 = reader.readLine();
> + final BufferedReader reader = new BufferedReader(new FileReader(f));
> + final String line1 = reader.readLine();
> reader.close();
> f.delete();
> assertNotNull("line1", line1);
> assertTrue("line1 correct", line1.contains(msg));
>
> - String location = "testAsyncLogWritesToLog";
> + final String location = "testAsyncLogWritesToLog";
> assertTrue("no location", !line1.contains(location));
> }
>
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/MTPerfTest.java Tue Jul 9 06:08:25 2013
> @@ -22,23 +22,23 @@ import com.lmax.disruptor.collections.Hi
>
> public class MTPerfTest extends PerfTest {
>
> - public static void main(String[] args) throws Exception {
> + public static void main(final String[] args) throws Exception {
> new MTPerfTest().doMain(args);
> }
>
> @Override
> public void runTestAndPrintResult(final IPerfTestRunner runner,
> - final String name, final int threadCount, String resultFile)
> + final String name, final int threadCount, final String resultFile)
> throws Exception {
>
> // ThreadContext.put("aKey", "mdcVal");
> PerfTest.println("Warming up the JVM...");
> - long t1 = System.nanoTime();
> + final long t1 = System.nanoTime();
>
> // warmup at least 2 rounds and at most 1 minute
> final Histogram warmupHist = PerfTest.createHistogram();
> final long stop = System.currentTimeMillis() + (60 * 1000);
> - Runnable run1 = new Runnable() {
> + final Runnable run1 = new Runnable() {
> @Override
> public void run() {
> for (int i = 0; i < 10; i++) {
> @@ -50,8 +50,8 @@ public class MTPerfTest extends PerfTest
> }
> }
> };
> - Thread thread1 = new Thread(run1);
> - Thread thread2 = new Thread(run1);
> + final Thread thread1 = new Thread(run1);
> + final Thread thread2 = new Thread(run1);
> thread1.start();
> thread2.start();
> thread1.join();
> @@ -74,7 +74,7 @@ public class MTPerfTest extends PerfTest
> }
>
> private void multiThreadedTestRun(final IPerfTestRunner runner,
> - final String name, final int threadCount, String resultFile)
> + final String name, final int threadCount, final String resultFile)
> throws Exception {
>
> final Histogram[] histograms = new Histogram[threadCount];
> @@ -83,28 +83,28 @@ public class MTPerfTest extends PerfTest
> }
> final int LINES = 256 * 1024;
>
> - Thread[] threads = new Thread[threadCount];
> + final Thread[] threads = new Thread[threadCount];
> for (int i = 0; i < threads.length; i++) {
> final Histogram histogram = histograms[i];
> threads[i] = new Thread() {
> @Override
> public void run() {
> // int latencyCount = threadCount >= 16 ? 1000000 : 5000000;
> - int latencyCount = 5000000;
> - int count = PerfTest.throughput ? LINES / threadCount
> + final int latencyCount = 5000000;
> + final int count = PerfTest.throughput ? LINES / threadCount
> : latencyCount;
> runTest(runner, count, "end", histogram, threadCount);
> }
> };
> }
> - for (Thread thread : threads) {
> + for (final Thread thread : threads) {
> thread.start();
> }
> - for (Thread thread : threads) {
> + for (final Thread thread : threads) {
> thread.join();
> }
>
> - for (Histogram histogram : histograms) {
> + for (final Histogram histogram : histograms) {
> PerfTest.reportResult(resultFile, name, histogram);
> }
> }
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTest.java Tue Jul 9 06:08:25 2013
> @@ -33,7 +33,7 @@ public class PerfTest {
> // determine how long it takes to call System.nanoTime() (on average)
> static long calcNanoTimeCost() {
> final long iterations = 10000000;
> - long start = System.nanoTime();
> + final long start = System.nanoTime();
> long finish = start;
>
> for (int i = 0; i < iterations; i++) {
> @@ -49,7 +49,7 @@ public class PerfTest {
> }
>
> static Histogram createHistogram() {
> - long[] intervals = new long[31];
> + final long[] intervals = new long[31];
> long intervalUpperBound = 1L;
> for (int i = 0, size = intervals.length - 1; i < size; i++) {
> intervalUpperBound *= 2;
> @@ -60,17 +60,17 @@ public class PerfTest {
> return new Histogram(intervals);
> }
>
> - public static void main(String[] args) throws Exception {
> + public static void main(final String[] args) throws Exception {
> new PerfTest().doMain(args);
> }
>
> - public void doMain(String[] args) throws Exception {
> - String runnerClass = args[0];
> - IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
> + public void doMain(final String[] args) throws Exception {
> + final String runnerClass = args[0];
> + final IPerfTestRunner runner = (IPerfTestRunner) Class.forName(runnerClass)
> .newInstance();
> - String name = args[1];
> - String resultFile = args.length > 2 ? args[2] : null;
> - for (String arg : args) {
> + final String name = args[1];
> + final String resultFile = args.length > 2 ? args[2] : null;
> + for (final String arg : args) {
> if (verbose && throughput) {
> break;
> }
> @@ -81,7 +81,7 @@ public class PerfTest {
> throughput = true;
> }
> }
> - int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
> + final int threadCount = args.length > 2 ? Integer.parseInt(args[3]) : 3;
> printf("Starting %s %s (%d)...%n", getClass().getSimpleName(), name,
> threadCount);
> runTestAndPrintResult(runner, name, threadCount, resultFile);
> @@ -89,14 +89,14 @@ public class PerfTest {
> System.exit(0);
> }
>
> - public void runTestAndPrintResult(IPerfTestRunner runner,
> - final String name, int threadCount, String resultFile)
> + public void runTestAndPrintResult(final IPerfTestRunner runner,
> + final String name, final int threadCount, final String resultFile)
> throws Exception {
> - Histogram warmupHist = createHistogram();
> + final Histogram warmupHist = createHistogram();
>
> // ThreadContext.put("aKey", "mdcVal");
> println("Warming up the JVM...");
> - long t1 = System.nanoTime();
> + final long t1 = System.nanoTime();
>
> // warmup at least 2 rounds and at most 1 minute
> final long stop = System.currentTimeMillis() + (60 * 1000);
> @@ -124,46 +124,46 @@ public class PerfTest {
> runSingleThreadedTest(runner, name, resultFile);
> }
>
> - private int runSingleThreadedTest(IPerfTestRunner runner, String name,
> - String resultFile) throws IOException {
> - Histogram latency = createHistogram();
> + private int runSingleThreadedTest(final IPerfTestRunner runner, final String name,
> + final String resultFile) throws IOException {
> + final Histogram latency = createHistogram();
> final int LINES = throughput ? 50000 : 5000000;
> runTest(runner, LINES, "end", latency, 1);
> reportResult(resultFile, name, latency);
> return LINES;
> }
>
> - static void reportResult(String file, String name, Histogram histogram)
> + static void reportResult(final String file, final String name, final Histogram histogram)
> throws IOException {
> - String result = createSamplingReport(name, histogram);
> + final String result = createSamplingReport(name, histogram);
> println(result);
>
> if (file != null) {
> - FileWriter writer = new FileWriter(file, true);
> + final FileWriter writer = new FileWriter(file, true);
> writer.write(result);
> writer.write(System.getProperty("line.separator"));
> writer.close();
> }
> }
>
> - static void printf(String msg, Object... objects) {
> + static void printf(final String msg, final Object... objects) {
> if (verbose) {
> System.out.printf(msg, objects);
> }
> }
>
> - static void println(String msg) {
> + static void println(final String msg) {
> if (verbose) {
> System.out.println(msg);
> }
> }
>
> - static String createSamplingReport(String name, Histogram histogram) {
> - Histogram data = histogram;
> + static String createSamplingReport(final String name, final Histogram histogram) {
> + final Histogram data = histogram;
> if (throughput) {
> return data.getMax() + " operations/second";
> }
> - String result = String.format(
> + final String result = String.format(
> "avg=%.0f 99%%=%d 99.99%%=%d sampleCount=%d", data.getMean(), //
> data.getTwoNinesUpperBound(), //
> data.getFourNinesUpperBound(), //
> @@ -172,12 +172,12 @@ public class PerfTest {
> return result;
> }
>
> - public void runTest(IPerfTestRunner runner, int lines, String finalMessage,
> - Histogram histogram, int threadCount) {
> + public void runTest(final IPerfTestRunner runner, final int lines, final String finalMessage,
> + final Histogram histogram, final int threadCount) {
> if (throughput) {
> runner.runThroughputTest(lines, histogram);
> } else {
> - long nanoTimeCost = calcNanoTimeCost();
> + final long nanoTimeCost = calcNanoTimeCost();
> runner.runLatencyTest(lines, histogram, nanoTimeCost, threadCount);
> }
> if (finalMessage != null) {
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestDriver.java Tue Jul 9 06:08:25 2013
> @@ -41,19 +41,19 @@ public class PerfTestDriver {
> * Defines the setup for a java process running a performance test.
> */
> static class Setup implements Comparable<Setup> {
> - private Class<?> _class;
> - private String _log4jConfig;
> - private String _name;
> - private String[] _systemProperties;
> - private int _threadCount;
> - private File _temp;
> + private final Class<?> _class;
> + private final String _log4jConfig;
> + private final String _name;
> + private final String[] _systemProperties;
> + private final int _threadCount;
> + private final File _temp;
> public Stats _stats;
> - private WaitStrategy _wait;
> - private String _runner;
> + private final WaitStrategy _wait;
> + private final String _runner;
>
> - public Setup(Class<?> klass, String runner, String name,
> - String log4jConfig, int threadCount, WaitStrategy wait,
> - String... systemProperties) throws IOException {
> + public Setup(final Class<?> klass, final String runner, final String name,
> + final String log4jConfig, final int threadCount, final WaitStrategy wait,
> + final String... systemProperties) throws IOException {
> _class = klass;
> _runner = runner;
> _name = name;
> @@ -64,8 +64,8 @@ public class PerfTestDriver {
> _temp = File.createTempFile("log4jperformance", ".txt");
> }
>
> - List<String> processArguments(String java) {
> - List<String> args = new ArrayList<String>();
> + List<String> processArguments(final String java) {
> + final List<String> args = new ArrayList<String>();
> args.add(java);
> args.add("-server");
> args.add("-Xms1g");
> @@ -84,7 +84,7 @@ public class PerfTestDriver {
> args.add("-Dlog4j.configurationFile=" + _log4jConfig); // log4j 2
> args.add("-Dlogback.configurationFile=" + _log4jConfig);// logback
>
> - int ringBufferSize = getUserSpecifiedRingBufferSize();
> + final int ringBufferSize = getUserSpecifiedRingBufferSize();
> if (ringBufferSize >= 128) {
> args.add("-DAsyncLoggerConfig.RingBufferSize=" + ringBufferSize);
> args.add("-DAsyncLogger.RingBufferSize=" + ringBufferSize);
> @@ -108,23 +108,23 @@ public class PerfTestDriver {
> try {
> return Integer.parseInt(System.getProperty("RingBufferSize",
> "-1"));
> - } catch (Exception ignored) {
> + } catch (final Exception ignored) {
> return -1;
> }
> }
>
> - ProcessBuilder latencyTest(String java) {
> + ProcessBuilder latencyTest(final String java) {
> return new ProcessBuilder(processArguments(java));
> }
>
> - ProcessBuilder throughputTest(String java) {
> - List<String> args = processArguments(java);
> + ProcessBuilder throughputTest(final String java) {
> + final List<String> args = processArguments(java);
> args.add("-throughput");
> return new ProcessBuilder(args);
> }
>
> @Override
> - public int compareTo(Setup other) {
> + public int compareTo(final Setup other) {
> // largest ops/sec first
> return (int) Math.signum(other._stats._averageOpsPerSec
> - _stats._averageOpsPerSec);
> @@ -137,7 +137,7 @@ public class PerfTestDriver {
> } else if (MTPerfTest.class == _class) {
> detail = _threadCount + " threads";
> }
> - String target = _runner.substring(_runner.indexOf(".Run") + 4);
> + final String target = _runner.substring(_runner.indexOf(".Run") + 4);
> return target + ": " + _name + " (" + detail + ")";
> }
> }
> @@ -152,16 +152,16 @@ public class PerfTestDriver {
> long _pct99_99;
> double _latencyRowCount;
> int _throughputRowCount;
> - private long _averageOpsPerSec;
> + private final long _averageOpsPerSec;
>
> // example line: avg=828 99%=1118 99.99%=5028 Count=3125
> - public Stats(String raw) {
> - String[] lines = raw.split("[\\r\\n]+");
> + public Stats(final String raw) {
> + final String[] lines = raw.split("[\\r\\n]+");
> long totalOps = 0;
> - for (String line : lines) {
> + for (final String line : lines) {
> if (line.startsWith("avg")) {
> _latencyRowCount++;
> - String[] parts = line.split(" ");
> + final String[] parts = line.split(" ");
> int i = 0;
> _average += Long.parseLong(parts[i++].split("=")[1]);
> _pct99 += Long.parseLong(parts[i++].split("=")[1]);
> @@ -169,8 +169,8 @@ public class PerfTestDriver {
> _count += Integer.parseInt(parts[i].split("=")[1]);
> } else {
> _throughputRowCount++;
> - String number = line.substring(0, line.indexOf(' '));
> - long opsPerSec = Long.parseLong(number);
> + final String number = line.substring(0, line.indexOf(' '));
> + final long opsPerSec = Long.parseLong(number);
> totalOps += opsPerSec;
> }
> }
> @@ -179,7 +179,7 @@ public class PerfTestDriver {
>
> @Override
> public String toString() {
> - String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> + final String fmt = "throughput: %,d ops/sec. latency(ns): avg=%.1f 99%% < %.1f 99.99%% < %.1f (%d samples)";
> return String.format(fmt, _averageOpsPerSec, //
> _average / _latencyRowCount, // mean latency
> _pct99 / _latencyRowCount, // 99% observations less than
> @@ -189,24 +189,24 @@ public class PerfTestDriver {
> }
>
> // single-threaded performance test
> - private static Setup s(String config, String runner, String name,
> - String... systemProperties) throws IOException {
> - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> + private static Setup s(final String config, final String runner, final String name,
> + final String... systemProperties) throws IOException {
> + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> "WaitStrategy", "Sleep"));
> return new Setup(PerfTest.class, runner, name, config, 1, wait,
> systemProperties);
> }
>
> // multi-threaded performance test
> - private static Setup m(String config, String runner, String name,
> - int threadCount, String... systemProperties) throws IOException {
> - WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> + private static Setup m(final String config, final String runner, final String name,
> + final int threadCount, final String... systemProperties) throws IOException {
> + final WaitStrategy wait = WaitStrategy.valueOf(System.getProperty(
> "WaitStrategy", "Sleep"));
> return new Setup(MTPerfTest.class, runner, name, config, threadCount,
> wait, systemProperties);
> }
>
> - public static void main(String[] args) throws Exception {
> + public static void main(final String[] args) throws Exception {
> final String ALL_ASYNC = "-DLog4jContextSelector="
> + AsyncLoggerContextSelector.class.getName();
> final String CACHEDCLOCK = "-Dlog4j.Clock=CachedClock";
> @@ -215,8 +215,8 @@ public class PerfTestDriver {
> final String LOG20 = RunLog4j2.class.getName();
> final String LOGBK = RunLogback.class.getName();
>
> - long start = System.nanoTime();
> - List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> + final long start = System.nanoTime();
> + final List<Setup> tests = new ArrayList<PerfTestDriver.Setup>();
> // includeLocation=false
> tests.add(s("perf3PlainNoLoc.xml", LOG20, "Loggers all async",
> ALL_ASYNC, SYSCLOCK));
> @@ -285,29 +285,29 @@ public class PerfTestDriver {
> // "RollFastFileAppender", i));
> }
>
> - String java = args.length > 0 ? args[0] : "java";
> - int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
> + final String java = args.length > 0 ? args[0] : "java";
> + final int repeat = args.length > 1 ? Integer.parseInt(args[1]) : 5;
> int x = 0;
> - for (Setup config : tests) {
> + for (final Setup config : tests) {
> System.out.print(config.description());
> - ProcessBuilder pb = config.throughputTest(java);
> + final ProcessBuilder pb = config.throughputTest(java);
> pb.redirectErrorStream(true); // merge System.out and System.err
> - long t1 = System.nanoTime();
> + final long t1 = System.nanoTime();
> // int count = config._threadCount >= 16 ? 2 : repeat;
> runPerfTest(repeat, x++, config, pb);
> System.out.printf(" took %.1f seconds%n", (System.nanoTime() - t1)
> / (1000.0 * 1000.0 * 1000.0));
>
> - FileReader reader = new FileReader(config._temp);
> - CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> + final FileReader reader = new FileReader(config._temp);
> + final CharBuffer buffer = CharBuffer.allocate(256 * 1024);
> reader.read(buffer);
> reader.close();
> config._temp.delete();
> buffer.flip();
>
> - String raw = buffer.toString();
> + final String raw = buffer.toString();
> System.out.print(raw);
> - Stats stats = new Stats(raw);
> + final Stats stats = new Stats(raw);
> System.out.println(stats);
> System.out.println("-----");
> config._stats = stats;
> @@ -321,19 +321,19 @@ public class PerfTestDriver {
> printRanking(tests.toArray(new Setup[tests.size()]));
> }
>
> - private static void printRanking(Setup[] tests) {
> + private static void printRanking(final Setup[] tests) {
> System.out.println();
> System.out.println("Ranking:");
> Arrays.sort(tests);
> for (int i = 0; i < tests.length; i++) {
> - Setup setup = tests[i];
> + final Setup setup = tests[i];
> System.out.println((i + 1) + ". " + setup.description() + ": "
> + setup._stats);
> }
> }
>
> - private static void runPerfTest(int repeat, int setupIndex, Setup config,
> - ProcessBuilder pb) throws IOException, InterruptedException {
> + private static void runPerfTest(final int repeat, final int setupIndex, final Setup config,
> + final ProcessBuilder pb) throws IOException, InterruptedException {
> for (int i = 0; i < repeat; i++) {
> System.out.print(" (" + (i + 1) + "/" + repeat + ")...");
> final Process process = pb.start();
> @@ -343,7 +343,7 @@ public class PerfTestDriver {
> process.waitFor();
> stop[0] = true;
>
> - File gc = new File("gc" + setupIndex + "_" + i
> + final File gc = new File("gc" + setupIndex + "_" + i
> + config._log4jConfig + ".log");
> if (gc.exists()) {
> gc.delete();
> @@ -355,17 +355,17 @@ public class PerfTestDriver {
> private static Thread printProcessOutput(final Process process,
> final boolean[] stop) {
>
> - Thread t = new Thread("OutputWriter") {
> + final Thread t = new Thread("OutputWriter") {
> @Override
> public void run() {
> - BufferedReader in = new BufferedReader(new InputStreamReader(
> + final BufferedReader in = new BufferedReader(new InputStreamReader(
> process.getInputStream()));
> try {
> String line = null;
> while (!stop[0] && (line = in.readLine()) != null) {
> System.out.println(line);
> }
> - } catch (Exception ignored) {
> + } catch (final Exception ignored) {
> }
> }
> };
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/PerfTestResultFormatter.java Tue Jul 9 06:08:25 2013
> @@ -42,7 +42,7 @@ class PerfTestResultFormatter {
> double latency99Pct;
> double latency99_99Pct;
>
> - Stats(String throughput, String avg, String lat99, String lat99_99)
> + Stats(final String throughput, final String avg, final String lat99, final String lat99_99)
> throws ParseException {
> this.throughput = NUM.parse(throughput.trim()).longValue();
> this.avgLatency = Double.parseDouble(avg.trim());
> @@ -51,40 +51,40 @@ class PerfTestResultFormatter {
> }
> }
>
> - private Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
> + private final Map<String, Map<String, Stats>> results = new TreeMap<String, Map<String, Stats>>();
>
> public PerfTestResultFormatter() {
> }
>
> - public String format(String text) throws ParseException {
> + public String format(final String text) throws ParseException {
> results.clear();
> - String[] lines = text.split("[\\r\\n]+");
> - for (String line : lines) {
> + final String[] lines = text.split("[\\r\\n]+");
> + for (final String line : lines) {
> process(line);
> }
> return latencyTable() + LF + throughputTable();
> }
>
> private String latencyTable() {
> - StringBuilder sb = new StringBuilder(4 * 1024);
> - Set<String> subKeys = results.values().iterator().next().keySet();
> - char[] tabs = new char[subKeys.size()];
> + final StringBuilder sb = new StringBuilder(4 * 1024);
> + final Set<String> subKeys = results.values().iterator().next().keySet();
> + final char[] tabs = new char[subKeys.size()];
> Arrays.fill(tabs, '\t');
> - String sep = new String(tabs);
> + final String sep = new String(tabs);
> sb.append("\tAverage latency").append(sep).append("99% less than").append(sep).append("99.99% less than");
> sb.append(LF);
> for (int i = 0; i < 3; i++) {
> - for (String subKey : subKeys) {
> + for (final String subKey : subKeys) {
> sb.append("\t").append(subKey);
> }
> }
> sb.append(LF);
> - for (String key : results.keySet()) {
> + for (final String key : results.keySet()) {
> sb.append(key);
> for (int i = 0; i < 3; i++) {
> - Map<String, Stats> sub = results.get(key);
> - for (String subKey : sub.keySet()) {
> - Stats stats = sub.get(subKey);
> + final Map<String, Stats> sub = results.get(key);
> + for (final String subKey : sub.keySet()) {
> + final Stats stats = sub.get(subKey);
> switch (i) {
> case 0:
> sb.append("\t").append((long) stats.avgLatency);
> @@ -104,19 +104,19 @@ class PerfTestResultFormatter {
> }
>
> private String throughputTable() {
> - StringBuilder sb = new StringBuilder(4 * 1024);
> - Set<String> subKeys = results.values().iterator().next().keySet();
> + final StringBuilder sb = new StringBuilder(4 * 1024);
> + final Set<String> subKeys = results.values().iterator().next().keySet();
> sb.append("\tThroughput per thread (msg/sec)");
> sb.append(LF);
> - for (String subKey : subKeys) {
> + for (final String subKey : subKeys) {
> sb.append("\t").append(subKey);
> }
> sb.append(LF);
> - for (String key : results.keySet()) {
> + for (final String key : results.keySet()) {
> sb.append(key);
> - Map<String, Stats> sub = results.get(key);
> - for (String subKey : sub.keySet()) {
> - Stats stats = sub.get(subKey);
> + final Map<String, Stats> sub = results.get(key);
> + for (final String subKey : sub.keySet()) {
> + final Stats stats = sub.get(subKey);
> sb.append("\t").append(stats.throughput);
> }
> sb.append(LF);
> @@ -124,19 +124,19 @@ class PerfTestResultFormatter {
> return sb.toString();
> }
>
> - private void process(String line) throws ParseException {
> - String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
> - String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
> - String throughput = line.substring(line.indexOf("throughput: ")
> + private void process(final String line) throws ParseException {
> + final String key = line.substring(line.indexOf('.') + 1, line.indexOf('('));
> + final String sub = line.substring(line.indexOf('(') + 1, line.indexOf(')'));
> + final String throughput = line.substring(line.indexOf("throughput: ")
> + "throughput: ".length(), line.indexOf(" ops"));
> - String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
> + final String avg = line.substring(line.indexOf("avg=") + "avg=".length(),
> line.indexOf(" 99%"));
> - String pct99 = line.substring(
> + final String pct99 = line.substring(
> line.indexOf("99% < ") + "99% < ".length(),
> line.indexOf(" 99.99%"));
> - String pct99_99 = line.substring(line.indexOf("99.99% < ")
> + final String pct99_99 = line.substring(line.indexOf("99.99% < ")
> + "99.99% < ".length(), line.lastIndexOf('(') - 1);
> - Stats stats = new Stats(throughput, avg, pct99, pct99_99);
> + final Stats stats = new Stats(throughput, avg, pct99, pct99_99);
> Map<String, Stats> map = results.get(key.trim());
> if (map == null) {
> map = new TreeMap<String, Stats>(sort());
> @@ -156,9 +156,9 @@ class PerfTestResultFormatter {
> "64 threads");
>
> @Override
> - public int compare(String o1, String o2) {
> - int i1 = expected.indexOf(o1);
> - int i2 = expected.indexOf(o2);
> + public int compare(final String o1, final String o2) {
> + final int i1 = expected.indexOf(o1);
> + final int i2 = expected.indexOf(o2);
> if (i1 < 0 || i2 < 0) {
> return o1.compareTo(o2);
> }
> @@ -167,9 +167,9 @@ class PerfTestResultFormatter {
> };
> }
>
> - public static void main(String[] args) throws Exception {
> - PerfTestResultFormatter fmt = new PerfTestResultFormatter();
> - BufferedReader reader = new BufferedReader(new InputStreamReader(
> + public static void main(final String[] args) throws Exception {
> + final PerfTestResultFormatter fmt = new PerfTestResultFormatter();
> + final BufferedReader reader = new BufferedReader(new InputStreamReader(
> System.in));
> String line;
> while ((line = reader.readLine()) != null) {
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j1.java Tue Jul 9 06:08:25 2013
> @@ -24,32 +24,32 @@ import com.lmax.disruptor.collections.Hi
> public class RunLog4j1 implements IPerfTestRunner {
>
> @Override
> - public void runThroughputTest(int lines, Histogram histogram) {
> - long s1 = System.nanoTime();
> - Logger logger = LogManager.getLogger(getClass());
> + public void runThroughputTest(final int lines, final Histogram histogram) {
> + final long s1 = System.nanoTime();
> + final Logger logger = LogManager.getLogger(getClass());
> for (int j = 0; j < lines; j++) {
> logger.info(THROUGHPUT_MSG);
> }
> - long s2 = System.nanoTime();
> - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> + final long s2 = System.nanoTime();
> + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> histogram.addObservation(opsPerSec);
> }
>
> @Override
> - public void runLatencyTest(int samples, Histogram histogram,
> - long nanoTimeCost, int threadCount) {
> - Logger logger = LogManager.getLogger(getClass());
> + public void runLatencyTest(final int samples, final Histogram histogram,
> + final long nanoTimeCost, final int threadCount) {
> + final Logger logger = LogManager.getLogger(getClass());
> for (int i = 0; i < samples; i++) {
> - long s1 = System.nanoTime();
> + final long s1 = System.nanoTime();
> logger.info(LATENCY_MSG);
> - long s2 = System.nanoTime();
> - long value = s2 - s1 - nanoTimeCost;
> + final long s2 = System.nanoTime();
> + final long value = s2 - s1 - nanoTimeCost;
> if (value > 0) {
> histogram.addObservation(value);
> }
> // wait 1 microsec
> final long PAUSE_NANOS = 10000 * threadCount;
> - long pauseStart = System.nanoTime();
> + final long pauseStart = System.nanoTime();
> while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> // busy spin
> }
> @@ -62,8 +62,8 @@ public class RunLog4j1 implements IPerfT
> }
>
> @Override
> - public void log(String finalMessage) {
> - Logger logger = LogManager.getLogger(getClass());
> + public void log(final String finalMessage) {
> + final Logger logger = LogManager.getLogger(getClass());
> logger.info(finalMessage);
> }
> }
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLog4j2.java Tue Jul 9 06:08:25 2013
> @@ -25,33 +25,33 @@ import com.lmax.disruptor.collections.Hi
> public class RunLog4j2 implements IPerfTestRunner {
>
> @Override
> - public void runThroughputTest(int lines, Histogram histogram) {
> - long s1 = System.nanoTime();
> - Logger logger = LogManager.getLogger(getClass());
> + public void runThroughputTest(final int lines, final Histogram histogram) {
> + final long s1 = System.nanoTime();
> + final Logger logger = LogManager.getLogger(getClass());
> for (int j = 0; j < lines; j++) {
> logger.info(THROUGHPUT_MSG);
> }
> - long s2 = System.nanoTime();
> - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> + final long s2 = System.nanoTime();
> + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> histogram.addObservation(opsPerSec);
> }
>
>
> @Override
> - public void runLatencyTest(int samples, Histogram histogram,
> - long nanoTimeCost, int threadCount) {
> - Logger logger = LogManager.getLogger(getClass());
> + public void runLatencyTest(final int samples, final Histogram histogram,
> + final long nanoTimeCost, final int threadCount) {
> + final Logger logger = LogManager.getLogger(getClass());
> for (int i = 0; i < samples; i++) {
> - long s1 = System.nanoTime();
> + final long s1 = System.nanoTime();
> logger.info(LATENCY_MSG);
> - long s2 = System.nanoTime();
> - long value = s2 - s1 - nanoTimeCost;
> + final long s2 = System.nanoTime();
> + final long value = s2 - s1 - nanoTimeCost;
> if (value > 0) {
> histogram.addObservation(value);
> }
> // wait 1 microsec
> final long PAUSE_NANOS = 10000 * threadCount;
> - long pauseStart = System.nanoTime();
> + final long pauseStart = System.nanoTime();
> while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> // busy spin
> }
> @@ -66,8 +66,8 @@ public class RunLog4j2 implements IPerfT
>
>
> @Override
> - public void log(String finalMessage) {
> - Logger logger = LogManager.getLogger(getClass());
> + public void log(final String finalMessage) {
> + final Logger logger = LogManager.getLogger(getClass());
> logger.info(finalMessage);
> }
> }
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/async/perftest/RunLogback.java Tue Jul 9 06:08:25 2013
> @@ -26,32 +26,32 @@ import com.lmax.disruptor.collections.Hi
> public class RunLogback implements IPerfTestRunner {
>
> @Override
> - public void runThroughputTest(int lines, Histogram histogram) {
> - long s1 = System.nanoTime();
> - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> + public void runThroughputTest(final int lines, final Histogram histogram) {
> + final long s1 = System.nanoTime();
> + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> for (int j = 0; j < lines; j++) {
> logger.info(THROUGHPUT_MSG);
> }
> - long s2 = System.nanoTime();
> - long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> + final long s2 = System.nanoTime();
> + final long opsPerSec = (1000L * 1000L * 1000L * lines) / (s2 - s1);
> histogram.addObservation(opsPerSec);
> }
>
> @Override
> - public void runLatencyTest(int samples, Histogram histogram,
> - long nanoTimeCost, int threadCount) {
> - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> + public void runLatencyTest(final int samples, final Histogram histogram,
> + final long nanoTimeCost, final int threadCount) {
> + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> for (int i = 0; i < samples; i++) {
> - long s1 = System.nanoTime();
> + final long s1 = System.nanoTime();
> logger.info(LATENCY_MSG);
> - long s2 = System.nanoTime();
> - long value = s2 - s1 - nanoTimeCost;
> + final long s2 = System.nanoTime();
> + final long value = s2 - s1 - nanoTimeCost;
> if (value > 0) {
> histogram.addObservation(value);
> }
> // wait 1 microsec
> final long PAUSE_NANOS = 10000 * threadCount;
> - long pauseStart = System.nanoTime();
> + final long pauseStart = System.nanoTime();
> while (PAUSE_NANOS > (System.nanoTime() - pauseStart)) {
> // busy spin
> }
> @@ -64,8 +64,8 @@ public class RunLogback implements IPerf
> }
>
> @Override
> - public void log(String msg) {
> - Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> + public void log(final String msg) {
> + final Logger logger = (Logger) LoggerFactory.getLogger(getClass());
> logger.info(msg);
> }
> }
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/AdvertiserTest.java Tue Jul 9 06:08:25 2013
> @@ -63,12 +63,12 @@ public class AdvertiserTest {
> file.delete();
> }
>
> - private void verifyExpectedEntriesAdvertised(Map<Object, Map<String, String>> entries) {
> + private void verifyExpectedEntriesAdvertised(final Map<Object, Map<String, String>> entries) {
> boolean foundFile1 = false;
> boolean foundFile2 = false;
> boolean foundSocket1 = false;
> boolean foundSocket2 = false;
> - for (Map<String, String>entry:entries.values()) {
> + for (final Map<String, String>entry:entries.values()) {
> if (foundFile1 && foundFile2 && foundSocket1 && foundSocket2) {
> break;
> }
> @@ -103,7 +103,7 @@ public class AdvertiserTest {
> final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> ctx.stop();
>
> - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> assertTrue("Entries found: " + entries, entries.isEmpty());
>
> //reconfigure for subsequent testing
> @@ -117,7 +117,7 @@ public class AdvertiserTest {
> final LoggerContext ctx = (LoggerContext) LogManager.getContext();
> ctx.stop();
>
> - Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> + final Map<Object, Map<String, String>> entries = InMemoryAdvertiser.getAdvertisedEntries();
> assertTrue("Entries found: " + entries, entries.isEmpty());
>
> ctx.start();
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/BaseConfigurationTest.java Tue Jul 9 06:08:25 2013
> @@ -34,9 +34,9 @@ public class BaseConfigurationTest {
> @Test
> public void testMissingRootLogger() throws Exception {
> PluginManager.addPackage("org.apache.logging.log4j.test.appender");
> - LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
> + final LoggerContext ctx = Configurator.initialize("Test1", null, "missingRootLogger.xml");
> final Logger logger = LogManager.getLogger("sample.Logger1");
> - Configuration config = ctx.getConfiguration();
> + final Configuration config = ctx.getConfiguration();
> assertNotNull("Config not null", config);
> // final String MISSINGROOT = "MissingRootTest";
> // assertTrue("Incorrect Configuration. Expected " + MISSINGROOT + " but found " + config.getName(),
> @@ -53,15 +53,15 @@ public class BaseConfigurationTest {
> // only the sample logger, no root logger in loggerMap!
> assertTrue("contains key=sample", loggerMap.containsKey("sample"));
>
> - LoggerConfig sample = loggerMap.get("sample");
> - Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
> + final LoggerConfig sample = loggerMap.get("sample");
> + final Map<String, Appender<?>> sampleAppenders = sample.getAppenders();
> assertEquals("sampleAppenders Size", 1, sampleAppenders.size());
> // sample only has List appender, not Console!
> assertTrue("sample has appender List", sampleAppenders.containsKey("List"));
>
> - BaseConfiguration baseConfig = (BaseConfiguration) config;
> - LoggerConfig root = baseConfig.getRootLogger();
> - Map<String, Appender<?>> rootAppenders = root.getAppenders();
> + final BaseConfiguration baseConfig = (BaseConfiguration) config;
> + final LoggerConfig root = baseConfig.getRootLogger();
> + final Map<String, Appender<?>> rootAppenders = root.getAppenders();
> assertEquals("rootAppenders Size", 1, rootAppenders.size());
> // root only has Console appender!
> assertTrue("root has appender Console", rootAppenders.containsKey("Console"));
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/InMemoryAdvertiser.java Tue Jul 9 06:08:25 2013
> @@ -28,20 +28,20 @@ public class InMemoryAdvertiser implemen
>
> public static Map<Object, Map<String, String>> getAdvertisedEntries()
> {
> - Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
> + final Map<Object, Map<String, String>> result = new HashMap<Object, Map<String, String>>();
> result.putAll(properties);
> return result;
> }
>
> @Override
> - public Object advertise(Map<String, String> newEntry) {
> - Object object = new Object();
> + public Object advertise(final Map<String, String> newEntry) {
> + final Object object = new Object();
> properties.put(object, new HashMap<String, String>(newEntry));
> return object;
> }
>
> @Override
> - public void unadvertise(Object advertisedObject) {
> + public void unadvertise(final Object advertisedObject) {
> properties.remove(advertisedObject);
> }
> }
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/config/TestConfigurator.java Tue Jul 9 06:08:25 2013
> @@ -189,24 +189,24 @@ public class TestConfigurator {
> public void testEnvironment() throws Exception {
> final LoggerContext ctx = Configurator.initialize("-config", null, (String) null);
> final Logger logger = LogManager.getLogger("org.apache.test.TestConfigurator");
> - Configuration config = ctx.getConfiguration();
> + final Configuration config = ctx.getConfiguration();
> assertNotNull("No configuration", config);
> assertTrue("Incorrect Configuration. Expected " + CONFIG_NAME + " but found " + config.getName(),
> CONFIG_NAME.equals(config.getName()));
> final Map<String, Appender<?>> map = config.getAppenders();
> assertNotNull("No Appenders", map != null && map.size() > 0);
> Appender<?> app = null;
> - for (Map.Entry<String, Appender<?>> entry: map.entrySet()) {
> + for (final Map.Entry<String, Appender<?>> entry: map.entrySet()) {
> if (entry.getKey().equals("List2")) {
> app = entry.getValue();
> break;
> }
> }
> assertNotNull("No ListAppender named List2", app);
> - Layout layout = app.getLayout();
> + final Layout layout = app.getLayout();
> assertNotNull("Appender List2 does not have a Layout", layout);
> assertTrue("Appender List2 is not configured with a PatternLayout", layout instanceof PatternLayout);
> - String pattern = ((PatternLayout) layout).getConversionPattern();
> + final String pattern = ((PatternLayout) layout).getConversionPattern();
> assertNotNull("No conversion pattern for List2 PatternLayout", pattern);
> assertFalse("Environment variable was not substituted", pattern.startsWith("${env:PATH}"));
> }
>
> Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java
> URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java?rev=1501104&r1=1501103&r2=1501104&view=diff
> ==============================================================================
> --- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java (original)
> +++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/filter/RegexFilterTest.java Tue Jul 9 06:08:25 2013
> @@ -55,7 +55,7 @@ public class RegexFilterTest {
>
> @Test
> public void TestNoMsg() {
> - RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
> + final RegexFilter filter = RegexFilter.createFilter(".* test .*", null, null, null);
> filter.start();
> assertTrue(filter.isStarted());
> assertTrue(filter.filter(null, Level.DEBUG, null, (String)null, (Throwable)null) == Filter.Result.DENY);
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org