FELIX-601 Reactivation upon reconfiguration happens completeley asynchronous
FELIX-599 add a log message indicating successful wait for the service registration lock
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@663943 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
index fa9e043..1431d4c 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/AbstractComponentManager.java
@@ -148,7 +148,7 @@
public final void reconfigure()
{
log( LogService.LOG_DEBUG, "Deactivating and Activating to reconfigure", m_componentMetadata, null );
- reactivate();
+ reactivateAsynchronous();
}
@@ -164,7 +164,7 @@
{
// synchronously deactivate and schedule activation asynchronously
deactivate();
-
+
getActivator().schedule( new Runnable()
{
public void run()
@@ -173,6 +173,26 @@
}
} );
}
+
+
+ /**
+ * Cycles this component by deactivating it and - if still satisfied -
+ * activating it again asynchronously.
+ * <p>
+ * This method schedules the deactivation and reactivation for asynchronous
+ * execution.
+ */
+ public final void reactivateAsynchronous()
+ {
+ getActivator().schedule( new Runnable()
+ {
+ public void run()
+ {
+ deactivateInternal();
+ activateInternal();
+ }
+ } );
+ }
/**
@@ -739,7 +759,7 @@
{
if ( serviceRegistrationLockOwner != null )
{
- log( LogService.LOG_INFO, "Waiting for Service Registration owned " + serviceRegistrationLockOwner,
+ log( LogService.LOG_INFO, "Waiting for Service Registration owned by " + serviceRegistrationLockOwner,
m_componentMetadata, null );
int waitGuard = 10;
@@ -764,6 +784,7 @@
+ serviceRegistrationLockOwner );
}
+ log( LogService.LOG_INFO, "Service Registration is now ready", m_componentMetadata, null );
}
serviceRegistrationLockOwner = Thread.currentThread();
diff --git a/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java b/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
index b2875aa..103e319 100644
--- a/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
+++ b/scr/src/main/java/org/apache/felix/scr/impl/ImmediateComponentManager.java
@@ -392,7 +392,7 @@
{
log( LogService.LOG_DEBUG, "Deactivating and Activating to reconfigure from configuration",
getComponentMetadata(), null );
- reactivate();
+ reactivateAsynchronous();
}
}
}