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/14 08:10:26 UTC
svn commit: r825016 -
/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
Author: fmeschbe
Date: Wed Oct 14 06:10:26 2009
New Revision: 825016
URL: http://svn.apache.org/viewvc?rev=825016&view=rev
Log:
FELIX-1666 JavaDoc for the helper method and accept STARTING bundles
only if they have the lazy activation policy header set.
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
Modified: felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java?rev=825016&r1=825015&r2=825016&view=diff
==============================================================================
--- felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java (original)
+++ felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentRegistry.java Wed Oct 14 06:10:26 2009
@@ -327,7 +327,22 @@
//---------- Helper method
- static boolean isBundleActive( Bundle bundle )
+ /**
+ * Returns <code>true</code> if the <code>bundle</code> is to be considered
+ * active from the perspective of declarative services.
+ * <p>
+ * As of R4.1 a bundle may have lazy activation policy which means a bundle
+ * remains in the STARTING state until a class is loaded from that bundle
+ * (unless that class is declared to not cause the bundle to start). And
+ * thus for DS 1.1 this means components are to be loaded for lazily started
+ * bundles being in the STARTING state (after the LAZY_ACTIVATION event) has
+ * been sent. Hence DS must consider a bundle active when it is really
+ * active and when it is a lazily activated bundle in the STARTING state.
+ *
+ * @throws NullPointerException if bundle is <code>null</code>.
+ * @see <a href="https://issues.apache.org/jira/browse/FELIX-1666">FELIX-1666</a>
+ */
+ static boolean isBundleActive( final Bundle bundle )
{
if ( bundle.getState() == Bundle.ACTIVE )
{
@@ -336,9 +351,11 @@
if ( bundle.getState() == Bundle.STARTING )
{
- // might want to check lazy start setting
-
- return true;
+ // according to the spec the activationPolicy header is only
+ // set to request a bundle to be lazily activated. So in this
+ // simple check we just verify the header is set to assume
+ // the bundle is considered a lazily activated bundle
+ return bundle.getHeaders().get( Constants.BUNDLE_ACTIVATIONPOLICY ) != null;
}
// fall back: bundle is not considered active