You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by fm...@apache.org on 2009/10/30 18:26:25 UTC
svn commit: r831396 - in
/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl: Activator.java
BundleComponentActivator.java ComponentActorThread.java
Author: fmeschbe
Date: Fri Oct 30 17:26:25 2009
New Revision: 831396
URL: http://svn.apache.org/viewvc?rev=831396&view=rev
Log:
FELIX-1833 Make the ComponentActorThread a Runnable handled to a standard
Thread as target and better cleanup of the BundleComponentActivator
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java?rev=831396&r1=831395&r2=831396&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/Activator.java Fri Oct 30 17:26:25 2009
@@ -92,7 +92,9 @@
// create and start the component actor
m_componentActor = new ComponentActorThread();
- m_componentActor.start();
+ Thread t = new Thread(m_componentActor, "SCR Component Actor");
+ t.setDaemon( true );
+ t.start();
// register for bundle updates
context.addBundleListener( this );
@@ -136,21 +138,11 @@
// dispose component registry
m_componentRegistry.dispose();
- // terminate the actor thread and wait for it for a limited time
+ // terminate the actor thread
if ( m_componentActor != null )
{
- // terminate asynchrounous updates
m_componentActor.terminate();
-
- // wait for all updates to terminate
- try
- {
- m_componentActor.join( 5000 );
- }
- catch ( InterruptedException ie )
- {
- // don't really care
- }
+ m_componentActor = null;
}
}
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java?rev=831396&r1=831395&r2=831396&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/BundleComponentActivator.java Fri Oct 30 17:26:25 2009
@@ -332,6 +332,13 @@
log( LogService.LOG_DEBUG, "BundleComponentActivator : Bundle [{0}] STOPPED", new Object[]
{ new Long( m_context.getBundle().getBundleId() ) }, null, null );
+ if (m_logService != null) {
+ m_logService.close();
+ m_logService = null;
+ }
+
+ m_componentActor = null;
+ m_componentRegistry = null;
m_context = null;
}
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java?rev=831396&r1=831395&r2=831396&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java Fri Oct 30 17:26:25 2009
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -28,7 +28,7 @@
* The <code>ComponentActorThread</code> is the thread used to act upon registered
* components of the service component runtime.
*/
-class ComponentActorThread extends Thread
+class ComponentActorThread implements Runnable
{
// sentinel task to terminate this thread
@@ -51,7 +51,6 @@
ComponentActorThread()
{
- super( "SCR Component Actor" );
tasks = new LinkedList();
}
@@ -65,7 +64,7 @@
{
for ( ;; )
{
- Runnable task;
+ final Runnable task;
synchronized ( tasks )
{
while ( tasks.isEmpty() )