Return-Path: X-Original-To: apmail-felix-commits-archive@www.apache.org Delivered-To: apmail-felix-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 20E8F660F for ; Wed, 18 May 2011 15:00:18 +0000 (UTC) Received: (qmail 51068 invoked by uid 500); 18 May 2011 15:00:18 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 50969 invoked by uid 500); 18 May 2011 15:00:17 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 50962 invoked by uid 99); 18 May 2011 15:00:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 May 2011 15:00:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 May 2011 15:00:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5FF6B23889ED; Wed, 18 May 2011 14:59:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1124294 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: BundleRevisionImpl.java BundleWiringImpl.java Felix.java Date: Wed, 18 May 2011 14:59:53 -0000 To: commits@felix.apache.org From: rickhall@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110518145953.5FF6B23889ED@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rickhall Date: Wed May 18 14:59:52 2011 New Revision: 1124294 URL: http://svn.apache.org/viewvc?rev=1124294&view=rev Log: Lazy activation was being handled in two places; related metadata should be held in BundleRevisionImpl and class-loading tracking should be handled in BundleWiringImpl. (FELIX-2950) Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java?rev=1124294&r1=1124293&r2=1124294&view=diff ============================================================================== --- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java (original) +++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java Wed May 18 14:59:52 2011 @@ -163,14 +163,33 @@ public class BundleRevisionImpl implemen return m_declaredActivationPolicy; } - List getActivationExcludes() + boolean isActivationTrigger(String pkgName) { - return m_activationExcludes; - } + if ((m_activationIncludes == null) && (m_activationExcludes == null)) + { + return true; + } - List getActivationIncludes() - { - return m_activationIncludes; + // If there are no include filters then all classes are included + // by default, otherwise try to find one match. + boolean included = (m_activationIncludes == null); + for (int i = 0; + (!included) && (m_activationIncludes != null) && (i < m_activationIncludes.size()); + i++) + { + included = m_activationIncludes.get(i).equals(pkgName); + } + + // If there are no exclude filters then no classes are excluded + // by default, otherwise try to find one match. + boolean excluded = false; + for (int i = 0; + (!excluded) && (m_activationExcludes != null) && (i < m_activationExcludes.size()); + i++) + { + excluded = m_activationExcludes.get(i).equals(pkgName); + } + return included && !excluded; } URLStreamHandler getURLStreamHandler() @@ -285,40 +304,6 @@ public class BundleRevisionImpl implemen return m_declaredNativeLibs; } - synchronized boolean isActivationTriggered() - { - return m_isActivationTriggered; - } - - boolean isActivationTrigger(String pkgName) - { - if ((m_activationIncludes == null) && (m_activationExcludes == null)) - { - return true; - } - - // If there are no include filters then all classes are included - // by default, otherwise try to find one match. - boolean included = (m_activationIncludes == null); - for (int i = 0; - (!included) && (m_activationIncludes != null) && (i < m_activationIncludes.size()); - i++) - { - included = m_activationIncludes.get(i).equals(pkgName); - } - - // If there are no exclude filters then no classes are excluded - // by default, otherwise try to find one match. - boolean excluded = false; - for (int i = 0; - (!excluded) && (m_activationExcludes != null) && (i < m_activationExcludes.size()); - i++) - { - excluded = m_activationExcludes.get(i).equals(pkgName); - } - return included && !excluded; - } - public String getId() { return m_id; Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java?rev=1124294&r1=1124293&r2=1124294&view=diff ============================================================================== --- felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java (original) +++ felix/trunk/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java Wed May 18 14:59:52 2011 @@ -1188,38 +1188,6 @@ public class BundleWiringImpl implements return m_isActivationTriggered; } - boolean isActivationTrigger(String pkgName) - { - List activationIncludes = m_revision.getActivationIncludes(); - List activationExcludes = m_revision.getActivationExcludes(); - - if ((activationIncludes == null) && (activationExcludes == null)) - { - return true; - } - - // If there are no include filters then all classes are included - // by default, otherwise try to find one match. - boolean included = (activationIncludes == null); - for (int i = 0; - (!included) && (activationIncludes != null) && (i < activationIncludes.size()); - i++) - { - included = activationIncludes.get(i).equals(pkgName); - } - - // If there are no exclude filters then no classes are excluded - // by default, otherwise try to find one match. - boolean excluded = false; - for (int i = 0; - (!excluded) && (activationExcludes != null) && (i < activationExcludes.size()); - i++) - { - excluded = activationExcludes.get(i).equals(pkgName); - } - return included && !excluded; - } - static class ToLocalUrlEnumeration implements Enumeration { final Enumeration m_enumeration; @@ -1385,7 +1353,7 @@ public class BundleWiringImpl implements // circuit the trigger matching if the trigger is already // tripped. boolean isTriggerClass = m_isActivationTriggered - ? false : isActivationTrigger(pkgName); + ? false : m_revision.isActivationTrigger(pkgName); if (!m_isActivationTriggered && isTriggerClass && (activationPolicy == BundleRevisionImpl.LAZY_ACTIVATION) Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=1124294&r1=1124293&r2=1124294&view=diff ============================================================================== --- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original) +++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Wed May 18 14:59:52 2011 @@ -1850,7 +1850,8 @@ public class Felix extends BundleImpl im if (!bundle.isDeclaredActivationPolicyUsed() || (((BundleRevisionImpl) bundle.getCurrentRevision()) .getDeclaredActivationPolicy() != BundleRevisionImpl.LAZY_ACTIVATION) - || ((BundleRevisionImpl) bundle.getCurrentRevision()).isActivationTriggered()) + || ((BundleWiringImpl) bundle.getCurrentRevision().getWiring()) + .isActivationTriggered()) { // Record the event type for the final event and activate. eventType = BundleEvent.STARTED;