You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by wa...@apache.org on 2007/09/11 12:33:58 UTC
svn commit: r574544 -
/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
Author: walkerr
Date: Tue Sep 11 03:33:58 2007
New Revision: 574544
URL: http://svn.apache.org/viewvc?rev=574544&view=rev
Log:
Fixed issue were external termination of Felix EventDispatcher.java was not handled or detected and prevented a restart of future Felix instances in the same VM (FELIX-363).
Modified:
felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java?rev=574544&r1=574543&r2=574544&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/util/EventDispatcher.java Tue Sep 11 03:33:58 2007
@@ -82,12 +82,17 @@
synchronized (m_threadLock)
{
// Start event dispatching thread if necessary.
- if (m_thread == null)
+ if (m_thread == null || !m_thread.isAlive())
{
m_thread = new Thread(new Runnable() {
public void run()
{
EventDispatcher.run();
+ // Ensure we update state even if stopped by external cause
+ // e.g. an Applet VM forceably killing threads
+ m_thread = null;
+ m_stopped = true;
+ m_stopping = false;
}
}, "FelixDispatchQueue");
m_thread.start();
@@ -125,21 +130,6 @@
{
m_requestList.notify();
}
-
- // Wait for dispatch thread to stop.
- while (!m_stopped)
- {
- try
- {
- m_threadLock.wait();
- }
- catch (InterruptedException ex)
- {
- }
- }
-
- // remove the thread reference
- m_thread = null;
}
}
@@ -786,11 +776,6 @@
// has been called then exit, otherwise dispatch event.
if ((m_requestList.size() == 0) && (m_stopping))
{
- synchronized (m_threadLock)
- {
- m_stopped = true;
- m_threadLock.notifyAll();
- }
return;
}