JBoss-OSGI SVN: r93663 - in projects/jboss-osgi/trunk/testsuite: example/src/test/java/org/jboss/test/osgi/example/blueprint and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-17 18:55:20 -0400 (Thu, 17 Sep 2009)
New Revision: 93663
Modified:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
[JBOSGI-155] OutOfMemoryError on repeated install/unstall bundle
Restore -Xmx1024m for jbossmc
Still seeing uncollected Capabilities
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java 2009-09-17 22:43:31 UTC (rev 93662)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java 2009-09-17 22:55:20 UTC (rev 93663)
@@ -32,7 +32,6 @@
import org.jboss.osgi.spi.testing.OSGiTestHelper;
import org.jboss.test.osgi.example.blueprint.bundle.ServiceA;
import org.jboss.test.osgi.example.blueprint.bundle.ServiceB;
-import org.jboss.virtual.VirtualFile;
import org.junit.Ignore;
import org.junit.Test;
import org.osgi.service.blueprint.container.BlueprintContainer;
@@ -45,8 +44,6 @@
*/
public class BlueprintStressTestCase
{
- private static int RUN_COUNT = 100;
-
@Test
@Ignore
public void testBlueprintBundleInstall() throws Exception
@@ -56,7 +53,7 @@
try
{
long lastTime = System.currentTimeMillis();
- for (int i = 0; i < RUN_COUNT; i++)
+ for (int i = 0; i < 100; i++)
{
runtime.addCapability(blueprintCapability);
@@ -76,9 +73,9 @@
runtime.removeCapability(blueprintCapability);
long currTime = System.currentTimeMillis();
- //System.out.println("#" + (i + 1) + " " + (currTime - lastTime) + "ms " + VirtualFile.getCount());
+ System.out.println("#" + (i + 1) + " " + (currTime - lastTime) + "ms ");
- Thread.sleep(3000);
+ //Thread.sleep(2000);
lastTime = currTime;
}
}
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd 2009-09-17 22:43:31 UTC (rev 93662)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd 2009-09-17 22:55:20 UTC (rev 93663)
@@ -7,12 +7,12 @@
Import-Package: \
javax.management, \
org.jboss.osgi.blueprint, \
- org.jboss.osgi.husky;resolution=optional, \
- org.jboss.osgi.husky.annotation;resolution=optional, \
+ org.jboss.osgi.husky, \
+ org.jboss.osgi.husky.annotation, \
org.jboss.osgi.spi.capability, \
org.jboss.osgi.spi.testing, \
org.jboss.virtual, \
- org.junit;resolution=optional, \
+ org.junit, \
org.osgi.framework, \
org.osgi.service.blueprint.*
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-09-17 22:43:31 UTC (rev 93662)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-09-17 22:55:20 UTC (rev 93663)
@@ -29,7 +29,6 @@
import org.jboss.osgi.spi.testing.OSGiBundle;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
-import org.jboss.virtual.VirtualFile;
import org.junit.Test;
import org.osgi.framework.Bundle;
@@ -51,25 +50,14 @@
try
{
runtime.addCapability(logCapability);
-
- long lastTime = System.currentTimeMillis();
- for (int i = 0; i < 1; i++)
- {
-
- OSGiBundle bundleA = runtime.installBundle("jbosgi99-bundleA.jar");
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
- bundleA.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
+ OSGiBundle bundleA = runtime.installBundle("jbosgi99-bundleA.jar");
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
- bundleA.uninstall();
-
- long currTime = System.currentTimeMillis();
- //System.out.println("#" + (i + 1) + " " + (currTime - lastTime) + "ms " + VirtualFile.getCount());
+ bundleA.start();
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
- //Thread.sleep(10000);
- lastTime = currTime;
- }
+ bundleA.uninstall();
}
finally
{
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-09-17 22:43:31 UTC (rev 93662)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-09-17 22:55:20 UTC (rev 93663)
@@ -246,6 +246,16 @@
<scope>provided</scope>
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Xmx1024m</argLine>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</profile>
<profile>
<id>framework-default</id>
@@ -267,7 +277,7 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <!-- argLine>-agentlib:yjpagent</argLine -->
+ <!--argLine>-agentlib:yjpagent</argLine-->
</configuration>
</plugin>
</plugins>
16 years, 10 months
JBoss-OSGI SVN: r93661 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins: facade/classloading and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-17 18:33:22 -0400 (Thu, 17 Sep 2009)
New Revision: 93661
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleCapability.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleRequirement.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
Log:
[JBOSGI-155] OutOfMemoryError on repeated install/unstall bundle
Fix leak in BundleResolver
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java 2009-09-17 21:04:22 UTC (rev 93660)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java 2009-09-17 22:33:22 UTC (rev 93661)
@@ -222,15 +222,6 @@
}
/**
- * Destroy this bundle state
- */
- void destroy()
- {
- lastModified = System.currentTimeMillis();
- osgiMetaData = null;
- }
-
- /**
* Get the osgiMetaData.
*
* @return the osgiMetaData.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-09-17 21:04:22 UTC (rev 93660)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-09-17 22:33:22 UTC (rev 93661)
@@ -447,7 +447,7 @@
try
{
deployerClient.undeploy(unit.getName());
- bundleState.destroy();
+ bundleState.modified();
}
catch (DeploymentException e)
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-09-17 21:04:22 UTC (rev 93660)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-09-17 22:33:22 UTC (rev 93661)
@@ -386,11 +386,4 @@
if (rethrow != null)
throw rethrow;
}
-
- @Override
- void destroy()
- {
- super.destroy();
- unit = null;
- }
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java 2009-09-17 21:04:22 UTC (rev 93660)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/classloading/OSGiPackageRequirement.java 2009-09-17 22:33:22 UTC (rev 93661)
@@ -52,6 +52,8 @@
/** The attributes */
private PackageAttribute requirePackage;
+
+ public static long count;
/**
* Create a new OSGiPackageRequirement.
@@ -110,7 +112,15 @@
if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
setOptional(true);
}
+
+ count++;
}
+
+ @Override
+ protected void finalize() throws Throwable
+ {
+ count--;
+ }
/**
* Get the requirePackage metadata.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleCapability.java 2009-09-17 21:04:22 UTC (rev 93660)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleCapability.java 2009-09-17 22:33:22 UTC (rev 93661)
@@ -31,7 +31,6 @@
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
import org.jboss.osgi.plugins.facade.classloading.OSGiPackageCapability;
import org.jboss.osgi.plugins.facade.classloading.OSGiPackageRequirement;
-import org.osgi.framework.Bundle;
/**
* An association of bundle/capability.
@@ -41,17 +40,22 @@
*/
public class BundleCapability
{
- private Bundle bundle;
+ private OSGiBundleState bundle;
private PackageCapability packageCapability;
private List<BundleRequirement> wires;
- BundleCapability(Bundle bundle, PackageCapability packageCapability)
+ BundleCapability(OSGiBundleState bundle, PackageCapability packageCapability)
{
+ if (bundle == null)
+ throw new IllegalArgumentException("Null bundle");
+ if (packageCapability == null)
+ throw new IllegalArgumentException("Null packageCapability");
+
this.bundle = bundle;
this.packageCapability = packageCapability;
}
- public Bundle getExportingBundle()
+ public OSGiBundleState getExportingBundle()
{
return bundle;
}
@@ -68,27 +72,52 @@
return packageCapability;
}
- public List<BundleRequirement> getWires()
+ public List<BundleRequirement> getWiredRequirements()
{
+ if (wires == null)
+ return Collections.emptyList();
+
return Collections.unmodifiableList(wires);
}
- void addWire(BundleRequirement bundleRequirement)
+ boolean matches(BundleRequirement bundleRequirement)
{
+ OSGiPackageCapability osgiPackageCapability = (OSGiPackageCapability)packageCapability;
+ OSGiPackageRequirement osgiPackageRequirement = (OSGiPackageRequirement)bundleRequirement.getPackageRequirement();
+ return osgiPackageCapability.match(osgiPackageRequirement);
+ }
+
+ void wireRequirement(BundleRequirement bundleRequirement)
+ {
if (wires == null)
wires = new ArrayList<BundleRequirement>();
wires.add(bundleRequirement);
}
- boolean matches(BundleRequirement bundleRequirement)
+ void unwireRequirement(BundleRequirement bundleRequirement)
{
- OSGiPackageCapability osgiPackageCapability = (OSGiPackageCapability)packageCapability;
- OSGiPackageRequirement osgiPackageRequirement = (OSGiPackageRequirement)bundleRequirement.getPackageRequirement();
- return osgiPackageCapability.match(osgiPackageRequirement);
+ if (wires != null)
+ wires.remove(bundleRequirement);
}
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof BundleCapability == false)
+ return false;
+ if (obj == this)
+ return true;
+ return toString().equals(obj.toString());
+ }
@Override
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ @Override
public String toString()
{
String name = packageCapability.getName();
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleRequirement.java 2009-09-17 21:04:22 UTC (rev 93660)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleRequirement.java 2009-09-17 22:33:22 UTC (rev 93661)
@@ -22,7 +22,7 @@
package org.jboss.osgi.plugins.resolver;
import org.jboss.classloading.plugins.metadata.PackageRequirement;
-import org.osgi.framework.Bundle;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleState;
/**
* An association of bundle/requirement.
@@ -32,36 +32,66 @@
*/
public class BundleRequirement
{
- private Bundle bundle;
+ private OSGiBundleState bundle;
private PackageRequirement packageRequirement;
private BundleCapability wire;
- BundleRequirement(Bundle bundle, PackageRequirement packageRequirement)
+ BundleRequirement(OSGiBundleState bundle, PackageRequirement packageRequirement)
{
+ if (bundle == null)
+ throw new IllegalArgumentException("Null bundle");
+ if (packageRequirement == null)
+ throw new IllegalArgumentException("Null packageRequirement");
+
this.bundle = bundle;
this.packageRequirement = packageRequirement;
}
+
+ public BundleCapability getWiredCapability()
+ {
+ return wire;
+ }
- void setWire(BundleCapability bundleCapability)
+ public OSGiBundleState getImportingBundle()
{
+ return bundle;
+ }
+
+ public PackageRequirement getPackageRequirement()
+ {
+ return packageRequirement;
+ }
+
+ void wireCapability(BundleCapability bundleCapability)
+ {
wire = bundleCapability;
if (bundleCapability != null)
- bundleCapability.addWire(this);
+ bundleCapability.wireRequirement(this);
}
- public BundleCapability getWire()
+ void unwireCapability()
{
- return wire;
+ if (wire != null)
+ {
+ wire.unwireRequirement(this);
+ wire = null;
+ }
}
-
- public Bundle getImportingBundle()
+
+ @Override
+ public boolean equals(Object obj)
{
- return bundle;
+ if (obj instanceof BundleRequirement == false)
+ return false;
+ if (obj == this)
+ return true;
+ return toString().equals(obj.toString());
}
- public PackageRequirement getPackageRequirement()
+ @Override
+ public int hashCode()
{
- return packageRequirement;
+ return toString().hashCode();
}
@Override
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java 2009-09-17 21:04:22 UTC (rev 93660)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java 2009-09-17 22:33:22 UTC (rev 93661)
@@ -60,9 +60,8 @@
private static final Logger log = Logger.getLogger(BundleResolver.class);
private OSGiBundleManager bundleManager;
- private List<BundleCapability> allCapabilities = new ArrayList<BundleCapability>();
- private Map<Bundle, List<BundleCapability>> bundleCapabilitiesMap = new HashMap<Bundle, List<BundleCapability>>();
- private Map<Bundle, List<BundleRequirement>> bundleRequirementsMap = new HashMap<Bundle, List<BundleRequirement>>();
+ private Map<OSGiBundleState, List<BundleCapability>> bundleCapabilitiesMap = new HashMap<OSGiBundleState, List<BundleCapability>>();
+ private Map<OSGiBundleState, List<BundleRequirement>> bundleRequirementsMap = new HashMap<OSGiBundleState, List<BundleRequirement>>();
public BundleResolver(OSGiBundleManager bundleManager)
{
@@ -91,6 +90,13 @@
int resolved = 1;
int resolveRounds = 0;
+ // Get the list of all capabilities
+ List<BundleCapability> allCapabilities = new ArrayList<BundleCapability>();
+ for (List<BundleCapability> list : bundleCapabilitiesMap.values())
+ {
+ allCapabilities.addAll(list);
+ }
+
List<OSGiBundleState> resolvedBundles = new ArrayList<OSGiBundleState>();
while (resolved > 0 && unresolvedBundles.isEmpty() == false)
{
@@ -105,7 +111,7 @@
{
OSGiBundleState bundleState = it.next();
log.debug("Resolving: " + bundleState);
- if (resolveBundle(bundleState))
+ if (resolveBundle(allCapabilities, bundleState))
{
resolvedBundles.add(bundleState);
it.remove();
@@ -117,7 +123,7 @@
log.debug("END *****************************************************************");
// Log the unresolved bundles
- for (Bundle bundle : unresolvedBundles)
+ for (OSGiBundleState bundle : unresolvedBundles)
{
StringBuffer message = new StringBuffer("Unresolved bundle: " + bundle);
message.append("\n Cannot find exporter for");
@@ -139,22 +145,18 @@
public void removeBundle(Bundle bundle)
{
- //System.out.println("removeBundle: " + bundle);
+ OSGiBundleState bundleState = assertBundleState(bundle);
- OSGiBundleState bundleState = assertBundleState(bundle);
- Iterator<BundleCapability> it = allCapabilities.iterator();
- while (it.hasNext())
+ bundleCapabilitiesMap.remove(bundleState);
+
+ List<BundleRequirement> bundleRequirements = bundleRequirementsMap.remove(bundleState);
+ if (bundleRequirements != null)
{
- BundleCapability aux = it.next();
- if (aux.getExportingBundle().equals(bundleState))
- it.remove();
+ for (BundleRequirement requirement : bundleRequirements)
+ {
+ requirement.unwireCapability();
+ }
}
- bundleCapabilitiesMap.remove(bundleState);
- bundleRequirementsMap.remove(bundleState);
-
- //System.out.println("allCapabilities: " + allCapabilities.size());
- //System.out.println("bundleCapabilitiesMap: " + bundleCapabilitiesMap.size());
- //System.out.println("bundleRequirementsMap: " + bundleRequirementsMap.size());
}
public BundleCapability getMatchingCapability(Module module, PackageRequirement packageRequirement)
@@ -173,7 +175,7 @@
{
if (req.getPackageRequirement() == packageRequirement)
{
- result = req.getWire();
+ result = req.getWiredCapability();
break;
}
}
@@ -181,7 +183,7 @@
return result;
}
- private boolean resolveBundle(OSGiBundleState bundle)
+ private boolean resolveBundle(List<BundleCapability> allCapabilities, OSGiBundleState bundle)
{
List<BundleCapability> bundleCapabilities = getBundleCapabilities(bundle);
List<BundleRequirement> bundleRequirements = getBundleRequirements(bundle);
@@ -197,14 +199,14 @@
if (bestMatch == null && packreq.isOptional() == false && packreq.isDynamic() == false)
return false;
- requirement.setWire(bestMatch);
+ requirement.wireCapability(bestMatch);
}
// Remove optional or dynamic requirements that don't have a wire
Iterator<BundleRequirement> it = bundleRequirements.iterator();
while (it.hasNext())
{
- if (it.next().getWire() == null)
+ if (it.next().getWiredCapability() == null)
it.remove();
}
@@ -271,7 +273,7 @@
for (int i = 0; i < (nameLengthMax - packNameVersion.length()); i++)
line.append(" ");
- BundleCapability wire = requirement.getWire();
+ BundleCapability wire = requirement.getWiredCapability();
if (wire == null)
{
line.append(" <= null");
@@ -315,7 +317,7 @@
/**
* Get the set of bundle capabilities
*/
- private List<BundleCapability> getBundleCapabilities(Bundle bundle)
+ private List<BundleCapability> getBundleCapabilities(OSGiBundleState bundle)
{
List<BundleCapability> result = new ArrayList<BundleCapability>();
@@ -341,7 +343,7 @@
/**
* Get the set of bundle requirements
*/
- private List<BundleRequirement> getBundleRequirements(Bundle bundle)
+ private List<BundleRequirement> getBundleRequirements(OSGiBundleState bundle)
{
List<BundleRequirement> result = new ArrayList<BundleRequirement>();
@@ -415,7 +417,7 @@
OSGiPackageRequirement newPackageRequirement = new OSGiPackageRequirement(bundle, packageName, versionRange, null);
BundleRequirement newBundleRequirement = new BundleRequirement(bundle, newPackageRequirement);
- newBundleRequirement.setWire(otherCapability);
+ newBundleRequirement.wireCapability(otherCapability);
bundleRequirements.add(newBundleRequirement);
if (Constants.VISIBILITY_REEXPORT.equals(visibility))
16 years, 10 months
JBoss-OSGI SVN: r93655 - in projects/jboss-osgi/trunk/testsuite: example/src/test/java/org/jboss/test/osgi/example/blueprint and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-17 14:04:37 -0400 (Thu, 17 Sep 2009)
New Revision: 93655
Modified:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
[JBOSGI-155] VirtualFile instance leak
WIP
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java 2009-09-17 17:58:52 UTC (rev 93654)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java 2009-09-17 18:04:37 UTC (rev 93655)
@@ -74,9 +74,9 @@
bundle.uninstall();
runtime.removeCapability(blueprintCapability);
-
+
long currTime = System.currentTimeMillis();
- System.out.println("#" + (i + 1) + " " + (currTime - lastTime) + "ms " + VirtualFile.getCount());
+ //System.out.println("#" + (i + 1) + " " + (currTime - lastTime) + "ms " + VirtualFile.getCount());
Thread.sleep(3000);
lastTime = currTime;
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-09-17 17:58:52 UTC (rev 93654)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-09-17 18:04:37 UTC (rev 93655)
@@ -65,7 +65,7 @@
bundleA.uninstall();
long currTime = System.currentTimeMillis();
- System.out.println("#" + (i + 1) + " " + (currTime - lastTime) + "ms " + VirtualFile.getCount());
+ //System.out.println("#" + (i + 1) + " " + (currTime - lastTime) + "ms " + VirtualFile.getCount());
//Thread.sleep(10000);
lastTime = currTime;
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-09-17 17:58:52 UTC (rev 93654)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-09-17 18:04:37 UTC (rev 93655)
@@ -267,7 +267,7 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>-agentlib:yjpagent</argLine>
+ <!-- argLine>-agentlib:yjpagent</argLine -->
</configuration>
</plugin>
</plugins>
16 years, 10 months
JBoss-OSGI SVN: r93654 - projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-17 13:58:52 -0400 (Thu, 17 Sep 2009)
New Revision: 93654
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
Log:
[JBOSGI-155] VirtualFile instance leak
WIP
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java 2009-09-17 16:16:11 UTC (rev 93653)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java 2009-09-17 17:58:52 UTC (rev 93654)
@@ -139,7 +139,7 @@
public void removeBundle(Bundle bundle)
{
- System.out.println("removeBundle: " + bundle);
+ //System.out.println("removeBundle: " + bundle);
OSGiBundleState bundleState = assertBundleState(bundle);
Iterator<BundleCapability> it = allCapabilities.iterator();
@@ -152,9 +152,9 @@
bundleCapabilitiesMap.remove(bundleState);
bundleRequirementsMap.remove(bundleState);
- System.out.println("allCapabilities: " + allCapabilities.size());
- System.out.println("bundleCapabilitiesMap: " + bundleCapabilitiesMap.size());
- System.out.println("bundleRequirementsMap: " + bundleRequirementsMap.size());
+ //System.out.println("allCapabilities: " + allCapabilities.size());
+ //System.out.println("bundleCapabilitiesMap: " + bundleCapabilitiesMap.size());
+ //System.out.println("bundleRequirementsMap: " + bundleRequirementsMap.size());
}
public BundleCapability getMatchingCapability(Module module, PackageRequirement packageRequirement)
16 years, 10 months
JBoss-OSGI SVN: r93653 - in projects/jboss-osgi/trunk/testsuite: example/src/test/java/org/jboss/test/osgi/example/blueprint and 5 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-17 12:16:11 -0400 (Thu, 17 Sep 2009)
New Revision: 93653
Added:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java
Modified:
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/bundleA/ActivatorBundleA.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
[JBOSGI-155] VirtualFile instance leak
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintStressTestCase.java 2009-09-17 16:16:11 UTC (rev 93653)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.example.blueprint;
+
+//$Id: BlueprintTestCase.java 91550 2009-07-22 13:10:41Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertNotNull;
+
+import org.jboss.osgi.blueprint.BlueprintCapability;
+import org.jboss.osgi.spi.testing.OSGiBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiServiceReference;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.test.osgi.example.blueprint.bundle.ServiceA;
+import org.jboss.test.osgi.example.blueprint.bundle.ServiceB;
+import org.jboss.virtual.VirtualFile;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.osgi.service.blueprint.container.BlueprintContainer;
+
+/**
+ * A simple Blueprint Container test.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 12-Jul-2009
+ */
+public class BlueprintStressTestCase
+{
+ private static int RUN_COUNT = 100;
+
+ @Test
+ @Ignore
+ public void testBlueprintBundleInstall() throws Exception
+ {
+ OSGiRuntime runtime = new OSGiTestHelper().getDefaultRuntime();
+ BlueprintCapability blueprintCapability = new BlueprintCapability();
+ try
+ {
+ long lastTime = System.currentTimeMillis();
+ for (int i = 0; i < RUN_COUNT; i++)
+ {
+ runtime.addCapability(blueprintCapability);
+
+ OSGiBundle bundle = runtime.installBundle("example-blueprint.jar");
+ bundle.start();
+
+ OSGiServiceReference sref = runtime.getServiceReference(BlueprintContainer.class.getName());
+ assertNotNull("BlueprintContainer service not null", sref);
+
+ OSGiServiceReference srefA = runtime.getServiceReference(ServiceA.class.getName());
+ assertNotNull("ServiceA not null", srefA);
+
+ OSGiServiceReference srefB = runtime.getServiceReference(ServiceB.class.getName());
+ assertNotNull("ServiceB not null", srefB);
+
+ bundle.uninstall();
+ runtime.removeCapability(blueprintCapability);
+
+ long currTime = System.currentTimeMillis();
+ System.out.println("#" + (i + 1) + " " + (currTime - lastTime) + "ms " + VirtualFile.getCount());
+
+ Thread.sleep(3000);
+ lastTime = currTime;
+ }
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-09-17 16:13:51 UTC (rev 93652)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-09-17 16:16:11 UTC (rev 93653)
@@ -21,6 +21,8 @@
<!-- [JBOSGI-145] JAXB classes are loaded from the system classpath -->
com.sun.xml.internal.bind.v2,
+ com.yourkit.runtime,
+
org.jboss.beans.metadata.plugins;version=2.0,
org.jboss.beans.metadata.plugins.builder;version=2.0,
org.jboss.beans.metadata.spi;version=2.0,
@@ -28,6 +30,7 @@
org.jboss.dependency.spi;version=2.0,
org.jboss.kernel.spi.dependency;version=2.0,
org.jboss.logging;version=2.0,
+ org.jboss.virtual;version=2.1,
org.jboss.osgi.spi;version=1.0,
org.jboss.osgi.spi.capability;version=1.0,
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd 2009-09-17 16:13:51 UTC (rev 93652)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd 2009-09-17 16:16:11 UTC (rev 93653)
@@ -7,11 +7,12 @@
Import-Package: \
javax.management, \
org.jboss.osgi.blueprint, \
- org.jboss.osgi.husky, \
- org.jboss.osgi.husky.annotation, \
+ org.jboss.osgi.husky;resolution=optional, \
+ org.jboss.osgi.husky.annotation;resolution=optional, \
org.jboss.osgi.spi.capability, \
org.jboss.osgi.spi.testing, \
- org.junit, \
+ org.jboss.virtual, \
+ org.junit;resolution=optional, \
org.osgi.framework, \
org.osgi.service.blueprint.*
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-09-17 16:13:51 UTC (rev 93652)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-09-17 16:16:11 UTC (rev 93653)
@@ -25,9 +25,11 @@
import static org.junit.Assert.assertEquals;
+import org.jboss.osgi.spi.capability.LogServiceCapability;
import org.jboss.osgi.spi.testing.OSGiBundle;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.virtual.VirtualFile;
import org.junit.Test;
import org.osgi.framework.Bundle;
@@ -45,15 +47,29 @@
public void testInstallOnly() throws Exception
{
OSGiRuntime runtime = new OSGiTestHelper().getDefaultRuntime();
+ LogServiceCapability logCapability = new LogServiceCapability();
try
{
- OSGiBundle bundleA = runtime.installBundle("jbosgi99-bundleA.jar");
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
+ runtime.addCapability(logCapability);
+
+ long lastTime = System.currentTimeMillis();
+ for (int i = 0; i < 1; i++)
+ {
+
+ OSGiBundle bundleA = runtime.installBundle("jbosgi99-bundleA.jar");
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
- bundleA.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
-
- bundleA.uninstall();
+ bundleA.start();
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
+
+ bundleA.uninstall();
+
+ long currTime = System.currentTimeMillis();
+ System.out.println("#" + (i + 1) + " " + (currTime - lastTime) + "ms " + VirtualFile.getCount());
+
+ //Thread.sleep(10000);
+ lastTime = currTime;
+ }
}
finally
{
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/bundleA/ActivatorBundleA.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/bundleA/ActivatorBundleA.java 2009-09-17 16:13:51 UTC (rev 93652)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/bundleA/ActivatorBundleA.java 2009-09-17 16:16:11 UTC (rev 93653)
@@ -25,14 +25,26 @@
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
public class ActivatorBundleA implements BundleActivator
{
+ private LogService log;
+
public void start(BundleContext context)
{
+ ServiceReference sref = context.getServiceReference(LogService.class.getName());
+ if (sref != null)
+ {
+ log = (LogService)context.getService(sref);
+ log.log(LogService.LOG_INFO, "ActivatorBundleA.start()");
+ }
}
public void stop(BundleContext context)
{
+ if (log != null)
+ log.log(LogService.LOG_INFO, "ActivatorBundleA.stop()");
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-09-17 16:13:51 UTC (rev 93652)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-09-17 16:16:11 UTC (rev 93653)
@@ -21,6 +21,8 @@
<!-- [JBOSGI-145] JAXB classes are loaded from the system classpath -->
com.sun.xml.internal.bind.v2,
+ com.yourkit.runtime,
+
org.jboss.beans.metadata.plugins;version=2.0,
org.jboss.beans.metadata.plugins.builder;version=2.0,
org.jboss.beans.metadata.spi;version=2.0,
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-09-17 16:13:51 UTC (rev 93652)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-09-17 16:16:11 UTC (rev 93653)
@@ -170,27 +170,6 @@
<profiles>
<!--
- Name: framework-default
- Descr: Setup for default framework integration testing
- -->
- <profile>
- <id>framework-default</id>
- <activation>
- <property>
- <name>!framework</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-runtime-microcontainer</artifactId>
- <version>${version.jboss.osgi.runtime.jbossmc}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
- </profile>
-
- <!--
Name: framework-equinox
Descr: Setup for Equinox framework integration testing
-->
@@ -267,12 +246,28 @@
<scope>provided</scope>
</dependency>
</dependencies>
+ </profile>
+ <profile>
+ <id>framework-default</id>
+ <activation>
+ <property>
+ <name>!framework</name>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-runtime-microcontainer</artifactId>
+ <version>${version.jboss.osgi.runtime.jbossmc}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
- <argLine>-Xmx1024m</argLine>
+ <argLine>-agentlib:yjpagent</argLine>
</configuration>
</plugin>
</plugins>
16 years, 10 months
JBoss-OSGI SVN: r93652 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins: metadata and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-17 12:13:51 -0400 (Thu, 17 Sep 2009)
New Revision: 93652
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleCapability.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleRequirement.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
Log:
Cache symbolicname and version
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java 2009-09-17 15:04:01 UTC (rev 93651)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/AbstractBundleState.java 2009-09-17 16:13:51 UTC (rev 93652)
@@ -96,6 +96,12 @@
/** The services in use */
protected Map<OSGiServiceState, Integer> servicesInUse = new ConcurrentHashMap<OSGiServiceState, Integer>();
+
+ /** The cached symbolic name */
+ private String symbolicName;
+
+ /** The cached */
+ private Version version;
/**
* Create a new BundleState for the system bundle.
@@ -125,15 +131,21 @@
public String getSymbolicName()
{
- String symbolicName = osgiMetaData.getBundleSymbolicName();
if (symbolicName == null)
- throw new IllegalStateException("Cannot obtain " + Constants.BUNDLE_SYMBOLICNAME);
+ {
+ symbolicName = osgiMetaData.getBundleSymbolicName();
+ if (symbolicName == null)
+ throw new IllegalStateException("Cannot obtain " + Constants.BUNDLE_SYMBOLICNAME);
+ }
return symbolicName;
}
public Version getVersion()
{
- return osgiMetaData.getBundleVersion();
+ if (version == null)
+ version = osgiMetaData.getBundleVersion();
+
+ return version;
}
public int getState()
@@ -210,6 +222,15 @@
}
/**
+ * Destroy this bundle state
+ */
+ void destroy()
+ {
+ lastModified = System.currentTimeMillis();
+ osgiMetaData = null;
+ }
+
+ /**
* Get the osgiMetaData.
*
* @return the osgiMetaData.
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-09-17 15:04:01 UTC (rev 93651)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-09-17 16:13:51 UTC (rev 93652)
@@ -439,26 +439,15 @@
if (id == 0)
throw new IllegalArgumentException("Cannot uninstall system bundle");
- OSGiBundleState state = (OSGiBundleState)getBundleById(id);
- if (state == null)
+ OSGiBundleState bundleState = (OSGiBundleState)getBundleById(id);
+ if (bundleState == null)
throw new BundleException(bundle + " not installed");
- uninstall(state);
- }
-
- /**
- * Uninstall a bundle
- *
- * @param bundleState the bundle state
- * @throws BundleException for any error
- */
- public void uninstall(OSGiBundleState bundleState) throws BundleException
- {
DeploymentUnit unit = bundleState.getDeploymentUnit();
try
{
deployerClient.undeploy(unit.getName());
- bundleState.modified();
+ bundleState.destroy();
}
catch (DeploymentException e)
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-09-17 15:04:01 UTC (rev 93651)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleState.java 2009-09-17 16:13:51 UTC (rev 93652)
@@ -386,4 +386,11 @@
if (rethrow != null)
throw rethrow;
}
+
+ @Override
+ void destroy()
+ {
+ super.destroy();
+ unit = null;
+ }
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java 2009-09-17 15:04:01 UTC (rev 93651)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/metadata/AbstractOSGiMetaData.java 2009-09-17 16:13:51 UTC (rev 93652)
@@ -196,7 +196,7 @@
public Version getBundleVersion()
{
- return get(BUNDLE_VERSION, VERSION_VC , new Version("0.0.0"));
+ return get(BUNDLE_VERSION, VERSION_VC , Version.emptyVersion);
}
public List<PackageAttribute> getDynamicImports()
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleCapability.java 2009-09-17 15:04:01 UTC (rev 93651)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleCapability.java 2009-09-17 16:13:51 UTC (rev 93652)
@@ -87,4 +87,11 @@
OSGiPackageRequirement osgiPackageRequirement = (OSGiPackageRequirement)bundleRequirement.getPackageRequirement();
return osgiPackageCapability.match(osgiPackageRequirement);
}
+
+ @Override
+ public String toString()
+ {
+ String name = packageCapability.getName();
+ return "BundleCapability[" + name + "," + bundle + "]";
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleRequirement.java 2009-09-17 15:04:01 UTC (rev 93651)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleRequirement.java 2009-09-17 16:13:51 UTC (rev 93652)
@@ -63,4 +63,11 @@
{
return packageRequirement;
}
+
+ @Override
+ public String toString()
+ {
+ String name = packageRequirement.getName();
+ return "BundleRequirement[" + name + "," + bundle + "]";
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java 2009-09-17 15:04:01 UTC (rev 93651)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/resolver/BundleResolver.java 2009-09-17 16:13:51 UTC (rev 93652)
@@ -139,6 +139,8 @@
public void removeBundle(Bundle bundle)
{
+ System.out.println("removeBundle: " + bundle);
+
OSGiBundleState bundleState = assertBundleState(bundle);
Iterator<BundleCapability> it = allCapabilities.iterator();
while (it.hasNext())
@@ -149,6 +151,10 @@
}
bundleCapabilitiesMap.remove(bundleState);
bundleRequirementsMap.remove(bundleState);
+
+ System.out.println("allCapabilities: " + allCapabilities.size());
+ System.out.println("bundleCapabilitiesMap: " + bundleCapabilitiesMap.size());
+ System.out.println("bundleRequirementsMap: " + bundleRequirementsMap.size());
}
public BundleCapability getMatchingCapability(Module module, PackageRequirement packageRequirement)
16 years, 10 months
JBoss-OSGI SVN: r93649 - projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-17 10:50:55 -0400 (Thu, 17 Sep 2009)
New Revision: 93649
Modified:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
Log:
Remove Before/AfterClass
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-09-17 14:43:57 UTC (rev 93648)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi99/OSGI99TestCase.java 2009-09-17 14:50:55 UTC (rev 93649)
@@ -28,11 +28,8 @@
import org.jboss.osgi.spi.testing.OSGiBundle;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
import org.junit.Test;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
/**
* [JBOSGI-99] No explicit control over bundle.start()
@@ -44,30 +41,23 @@
*/
public class OSGI99TestCase
{
- private static OSGiRuntime runtime;
-
- @BeforeClass
- public static void beforeClass() throws BundleException
- {
- runtime = new OSGiTestHelper().getDefaultRuntime();
- }
-
- @AfterClass
- public static void afterClass() throws BundleException
- {
- if (runtime != null)
- runtime.shutdown();
- }
-
@Test
public void testInstallOnly() throws Exception
{
- OSGiBundle bundleA = runtime.installBundle("jbosgi99-bundleA.jar");
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
+ OSGiRuntime runtime = new OSGiTestHelper().getDefaultRuntime();
+ try
+ {
+ OSGiBundle bundleA = runtime.installBundle("jbosgi99-bundleA.jar");
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
- bundleA.start();
- assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
-
- bundleA.uninstall();
+ bundleA.start();
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
+
+ bundleA.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
}
}
\ No newline at end of file
16 years, 10 months
JBoss-OSGI SVN: r93632 - in projects/jboss-osgi/projects: bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-17 02:18:06 -0400 (Thu, 17 Sep 2009)
New Revision: 93632
Modified:
projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/DeploymentRegistryServiceImpl.java
projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java
projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java
projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/InstallActionExt.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeployment.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeploymentFactory.java
Log:
Use String instead of non-serializable Version
Modified: projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/DeploymentRegistryServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/DeploymentRegistryServiceImpl.java 2009-09-17 05:57:09 UTC (rev 93631)
+++ projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/DeploymentRegistryServiceImpl.java 2009-09-17 06:18:06 UTC (rev 93632)
@@ -66,7 +66,7 @@
for (BundleDeployment auxDep : deployments)
{
String auxName = auxDep.getSymbolicName();
- Version auxVersion = auxDep.getVersion();
+ String auxVersion = auxDep.getVersion();
if (symbolicName.equals(auxName) && version.equals(auxVersion))
{
dep = auxDep;
Modified: projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java
===================================================================
--- projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java 2009-09-17 05:57:09 UTC (rev 93631)
+++ projects/jboss-osgi/projects/bundles/common/trunk/src/main/java/org/jboss/osgi/common/internal/SystemDeployerService.java 2009-09-17 06:18:06 UTC (rev 93632)
@@ -192,7 +192,7 @@
private Bundle getBundle(BundleDeployment dep)
{
String symbolicName = dep.getSymbolicName();
- Version version = dep.getVersion();
+ Version version = Version.parseVersion(dep.getVersion());
Bundle bundle = null;
for (Bundle aux : context.getBundles())
Modified: projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java 2009-09-17 05:57:09 UTC (rev 93631)
+++ projects/jboss-osgi/projects/bundles/hotdeploy/trunk/src/main/java/org/jboss/osgi/hotdeploy/internal/DeploymentScannerImpl.java 2009-09-17 06:18:06 UTC (rev 93632)
@@ -318,7 +318,7 @@
private Bundle getBundle(BundleDeployment dep)
{
String symbolicName = dep.getSymbolicName();
- Version version = dep.getVersion();
+ Version version = Version.parseVersion(dep.getVersion());
Bundle bundle = null;
for (Bundle aux : context.getBundles())
Modified: projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/InstallActionExt.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/InstallActionExt.java 2009-09-17 05:57:09 UTC (rev 93631)
+++ projects/jboss-osgi/projects/bundles/webconsole/trunk/src/main/java/org/jboss/osgi/webconsole/internal/plugins/InstallActionExt.java 2009-09-17 06:18:06 UTC (rev 93632)
@@ -87,7 +87,7 @@
private Bundle getBundle(BundleDeployment info)
{
String symbolicName = info.getSymbolicName();
- Version version = info.getVersion();
+ Version version = Version.parseVersion(info.getVersion());
Bundle bundle = null;
for (Bundle aux : getBundleContext().getBundles())
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-09-17 05:57:09 UTC (rev 93631)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-09-17 06:18:06 UTC (rev 93632)
@@ -68,9 +68,10 @@
public OSGiBundle installBundle(String location) throws BundleException
{
URL bundleURL = getTestHelper().getTestArchiveURL(location);
+
BundleDeployment bundleDep = BundleDeploymentFactory.createBundleDeployment(bundleURL);
String symbolicName = bundleDep.getSymbolicName();
- Version version = bundleDep.getVersion();
+ Version version = Version.parseVersion(bundleDep.getVersion());
OSGiBundle bundle;
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeployment.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeployment.java 2009-09-17 05:57:09 UTC (rev 93631)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeployment.java 2009-09-17 06:18:06 UTC (rev 93632)
@@ -24,8 +24,6 @@
import java.io.Serializable;
import java.net.URL;
-import org.osgi.framework.Version;
-
//$Id$
/**
@@ -40,18 +38,21 @@
private URL location;
private String symbolicName;
- private Version version;
+ private String version;
private int startLevel;
private boolean autoStart;
private Object metadata;
- public BundleDeployment(URL location, String symbolicName, Version version)
+ public BundleDeployment(URL location, String symbolicName, String version)
{
if (location == null)
throw new IllegalArgumentException("Location cannot be null");
if (symbolicName == null)
throw new IllegalArgumentException("Symbolic name cannot be null");
+ if (version == null)
+ version = "0.0.0";
+
this.symbolicName = symbolicName;
this.location = location;
this.version = version;
@@ -76,7 +77,7 @@
/**
* Get the bundle version
*/
- public Version getVersion()
+ public String getVersion()
{
return version;
}
@@ -148,6 +149,6 @@
@Override
public String toString()
{
- return "[" + symbolicName + ":" + version + "]";
+ return "[" + symbolicName + "-" + version + ",url=" + location + "]";
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeploymentFactory.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeploymentFactory.java 2009-09-17 05:57:09 UTC (rev 93631)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleDeploymentFactory.java 2009-09-17 06:18:06 UTC (rev 93632)
@@ -31,7 +31,6 @@
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
/**
* A factory for bundle deployments.
@@ -61,8 +60,7 @@
if (symbolicName == null)
throw new BundleException("Cannot obtain Bundle-SymbolicName for: " + url);
- String versionStr = attribs.getValue(Constants.BUNDLE_VERSION);
- Version version = Version.parseVersion(versionStr);
+ String version = attribs.getValue(Constants.BUNDLE_VERSION);
return new BundleDeployment(url, symbolicName, version);
}
}
\ No newline at end of file
16 years, 10 months
JBoss-OSGI SVN: r93630 - projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-17 00:48:13 -0400 (Thu, 17 Sep 2009)
New Revision: 93630
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
Log:
Fix handling of default framework
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-09-17 04:18:07 UTC (rev 93629)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-09-17 04:48:13 UTC (rev 93630)
@@ -192,21 +192,21 @@
public String getFramework()
{
- return System.getProperty("framework");
+ return System.getProperty("framework", "jbossmc");
}
public boolean isFrameworkEquinox()
{
- return "equinox".equals(getTargetContainer());
+ return "equinox".equals(getFramework());
}
public boolean isFrameworkFelix()
{
- return "felix".equals(getTargetContainer());
+ return "felix".equals(getFramework());
}
public boolean isFrameworkJBossMC()
{
- return "jbossmc".equals(getTargetContainer());
+ return "jbossmc".equals(getFramework());
}
}
16 years, 10 months
JBoss-OSGI SVN: r93613 - projects/jboss-osgi/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-09-16 10:31:27 -0400 (Wed, 16 Sep 2009)
New Revision: 93613
Modified:
projects/jboss-osgi/trunk/pom.xml
Log:
Use jboss-osgi-runtime-microcontainer-1.0.0-SNAPSHOT
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-09-16 14:30:42 UTC (rev 93612)
+++ projects/jboss-osgi/trunk/pom.xml 2009-09-16 14:31:27 UTC (rev 93613)
@@ -56,7 +56,7 @@
<version.jboss.osgi.runtime.equinox>3.5-SNAPSHOT</version.jboss.osgi.runtime.equinox>
<version.jboss.osgi.runtime.felix>1.9.0-SNAPSHOT</version.jboss.osgi.runtime.felix>
<version.jboss.osgi.runtime.jbossas>1.0.1-SNAPSHOT</version.jboss.osgi.runtime.jbossas>
- <version.jboss.osgi.runtime.jbossmc>1.0.2-SNAPSHOT</version.jboss.osgi.runtime.jbossmc>
+ <version.jboss.osgi.runtime.jbossmc>1.0.0-SNAPSHOT</version.jboss.osgi.runtime.jbossmc>
<version.jboss.osgi.spi>1.0.1-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.webconsole>1.0.1-SNAPSHOT</version.jboss.osgi.webconsole>
<version.jboss.osgi.xml.binding>2.0.1-SNAPSHOT</version.jboss.osgi.xml.binding>
16 years, 10 months