Author: dejanb Date: Tue Nov 17 13:19:35 2009 New Revision: 881270 URL: http://svn.apache.org/viewvc?rev=881270&view=rev Log: https://issues.apache.org/activemq/browse/AMQ-2499 - reverting previous commit Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/NIODataFileAppender.java activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java activemq/trunk/activemq-core/src/test/resources/log4j.properties Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java?rev=881270&r1=881269&r2=881270&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFileAppender.java Tue Nov 17 13:19:35 2009 @@ -21,7 +21,6 @@ import java.io.RandomAccessFile; import java.util.Map; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicReference; import org.apache.activemq.util.ByteSequence; import org.apache.activemq.util.DataByteArrayOutputStream; @@ -49,7 +48,7 @@ protected final CountDownLatch shutdownDone = new CountDownLatch(1); protected int maxWriteBatchSize = DEFAULT_MAX_BATCH_SIZE; - protected boolean running; + private boolean running; private Thread thread; public static class WriteKey { @@ -83,7 +82,6 @@ public final WriteCommand first; public final CountDownLatch latch = new CountDownLatch(1); public int size; - public AtomicReference exception = new AtomicReference(); public WriteBatch(DataFile dataFile, WriteCommand write) throws IOException { this.dataFile = dataFile; @@ -181,10 +179,6 @@ } catch (InterruptedException e) { throw new InterruptedIOException(); } - IOException exception = batch.exception.get(); - if (exception != null) { - throw exception; - } } return location; @@ -222,7 +216,10 @@ if (shutdown) { throw new IOException("Async Writter Thread Shutdown"); } - + if (firstAsyncException != null) { + throw firstAsyncException; + } + if (!running) { running = true; thread = new Thread() { @@ -234,11 +231,6 @@ thread.setDaemon(true); thread.setName("ActiveMQ Data File Writer"); thread.start(); - firstAsyncException = null; - } - - if (firstAsyncException != null) { - throw firstAsyncException; } if (nextWriteBatch == null) { @@ -306,7 +298,6 @@ protected void processQueue() { DataFile dataFile = null; RandomAccessFile file = null; - WriteBatch wb = null; try { DataByteArrayOutputStream buff = new DataByteArrayOutputStream(maxWriteBatchSize); @@ -330,7 +321,7 @@ enqueueMutex.notify(); } - wb = (WriteBatch)o; + WriteBatch wb = (WriteBatch)o; if (dataFile != wb.dataFile) { if (file != null) { dataFile.closeRandomAccessFile(file); @@ -415,14 +406,6 @@ } catch (IOException e) { synchronized (enqueueMutex) { firstAsyncException = e; - if (wb != null) { - wb.latch.countDown(); - wb.exception.set(e); - } - if (nextWriteBatch != null) { - nextWriteBatch.latch.countDown(); - nextWriteBatch.exception.set(e); - } } } catch (InterruptedException e) { } finally { Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/NIODataFileAppender.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/NIODataFileAppender.java?rev=881270&r1=881269&r2=881270&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/NIODataFileAppender.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/NIODataFileAppender.java Tue Nov 17 13:19:35 2009 @@ -47,7 +47,6 @@ DataFile dataFile = null; RandomAccessFile file = null; FileChannel channel = null; - WriteBatch wb = null; try { @@ -82,14 +81,13 @@ enqueueMutex.notify(); } - wb = (WriteBatch)o; + WriteBatch wb = (WriteBatch)o; if (dataFile != wb.dataFile) { if (file != null) { dataFile.closeRandomAccessFile(file); } dataFile = wb.dataFile; file = dataFile.openRandomAccessFile(true); - System.out.println("new channel?"); channel = file.getChannel(); } @@ -182,33 +180,16 @@ } catch (IOException e) { synchronized (enqueueMutex) { firstAsyncException = e; - if (wb != null) { - wb.latch.countDown(); - wb.exception.set(e); - } - if (nextWriteBatch != null) { - nextWriteBatch.latch.countDown(); - nextWriteBatch.exception.set(e); - } } } catch (InterruptedException e) { } finally { try { if (file != null) { dataFile.closeRandomAccessFile(file); - dataFile = null; - file.close(); - file = null; - } - if (channel != null) { - System.out.println("Closing channel"); - channel.close(); - channel = null; } } catch (IOException e) { } shutdownDone.countDown(); - running = false; } } Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java?rev=881270&r1=881269&r2=881270&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java (original) +++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/IntrospectionSupport.java Tue Nov 17 13:19:35 2009 @@ -262,28 +262,23 @@ boolean first = true; for (Iterator iter = entrySet.iterator(); iter.hasNext();) { Map.Entry entry = (Map.Entry)iter.next(); - Object value = entry.getValue(); - Object key = entry.getKey(); if (first) { first = false; } else { buffer.append(", "); } - buffer.append(key); + buffer.append(entry.getKey()); buffer.append(" = "); - - appendToString(buffer, key, value); + appendToString(buffer, entry.getValue()); } buffer.append("}"); return buffer.toString(); } - protected static void appendToString(StringBuffer buffer, Object key, Object value) { + protected static void appendToString(StringBuffer buffer, Object value) { if (value instanceof ActiveMQDestination) { ActiveMQDestination destination = (ActiveMQDestination)value; buffer.append(destination.getQualifiedName()); - } else if (key.toString().contains("password")){ - buffer.append("*****"); } else { buffer.append(value); } Modified: activemq/trunk/activemq-core/src/test/resources/log4j.properties URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/resources/log4j.properties?rev=881270&r1=881269&r2=881270&view=diff ============================================================================== --- activemq/trunk/activemq-core/src/test/resources/log4j.properties (original) +++ activemq/trunk/activemq-core/src/test/resources/log4j.properties Tue Nov 17 13:19:35 2009 @@ -18,7 +18,7 @@ # # The logging properties used during tests.. # -log4j.rootLogger=DEBUG, out, stdout +log4j.rootLogger=INFO, out, stdout #log4j.logger.org.apache.activemq=DEBUG