Applied patch (FELIX-2406) to fix log ordering issue along with
a few minor modifications.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1085090 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/log/src/main/java/org/apache/felix/log/LogListenerThread.java b/log/src/main/java/org/apache/felix/log/LogListenerThread.java
index 4a2a38d..a13ce22 100644
--- a/log/src/main/java/org/apache/felix/log/LogListenerThread.java
+++ b/log/src/main/java/org/apache/felix/log/LogListenerThread.java
@@ -18,10 +18,9 @@
*/
package org.apache.felix.log;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import java.util.Stack;
-import java.util.Vector;
import org.osgi.service.log.LogEntry;
import org.osgi.service.log.LogListener;
@@ -34,12 +33,12 @@
*/
final class LogListenerThread extends Thread
{
- /** Whether the thread is stopping or not. */
+ // Whether the thread is stopping or not.
private boolean m_stopping = false;
- /** The stack of entries waiting to be delivered to the log listeners. **/
- private final Stack m_entriesToDeliver = new Stack();
- /** The list of listeners. */
- private final List m_listeners = new Vector();
+ // The list of entries waiting to be delivered to the log listeners.
+ private final List m_entriesToDeliver = new ArrayList();
+ // The list of listeners.
+ private final List m_listeners = new ArrayList();
/**
* Add an entry to the list of messages to deliver.
@@ -92,10 +91,9 @@
*/
void shutdown()
{
- m_stopping = true;
-
synchronized (m_entriesToDeliver)
{
+ m_stopping = true;
m_entriesToDeliver.notifyAll();
}
}
@@ -114,7 +112,7 @@
{
if (!m_entriesToDeliver.isEmpty())
{
- LogEntry entry = (LogEntry) m_entriesToDeliver.pop();
+ LogEntry entry = (LogEntry) m_entriesToDeliver.remove(0);
synchronized (m_listeners)
{