Issue #2361 better logging of viz spring initialization of bundles

Change-Id: I9e8e9ec570b47e5b7052928206443eb2835e809b

Former-commit-id: a4ece1d116 [formerly 99500a22ff9b2f115b5bb6e35034f47adf3d0853]
Former-commit-id: 692ea76d75
This commit is contained in:
Nate Jensen 2013-11-12 13:02:49 -06:00
parent db61d36b4e
commit 6707d1aadf
3 changed files with 14 additions and 4 deletions

View file

@ -36,6 +36,7 @@ import org.osgi.framework.Constants;
* has been started
* Mar 05, 2013 1754 djohnson Catch exceptions and allow as much of the Spring container to boot as possible.
* May 23, 2013 2005 njensen Added springSuccess flag
* Nov 12, 2013 2361 njensen Print out time spent on each spring context
*
* </pre>
*
@ -153,10 +154,11 @@ public class Activator implements BundleActivator {
}
try {
long t0 = System.currentTimeMillis();
if (parentContexts.size() > 0) {
// Context with parent context
appCtx = new OSGIXmlApplicationContext(
new OSGIGroupApplicationContext(
new OSGIGroupApplicationContext(bundle,
parentContexts),
files.toArray(new String[0]), bundle);
} else {
@ -164,6 +166,9 @@ public class Activator implements BundleActivator {
appCtx = new OSGIXmlApplicationContext(
files.toArray(new String[0]), bundle);
}
System.out.println("Bundle " + bundle.getSymbolicName()
+ " spring init took: "
+ (System.currentTimeMillis() - t0));
} catch (Throwable t) {
// No access to the statusHandler yet, so print the
// stack trace to the console. By catching this, we also

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.viz.spring.dm;
import java.util.List;
import org.osgi.framework.Bundle;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.support.GenericApplicationContext;
@ -35,7 +36,8 @@ import org.springframework.context.support.GenericApplicationContext;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 1, 2012 mschenke Initial creation
* Nov 01, 2012 mschenke Initial creation
* Nov 12, 2013 2361 njensen call setDisplayName()
*
* </pre>
*
@ -45,8 +47,9 @@ import org.springframework.context.support.GenericApplicationContext;
public class OSGIGroupApplicationContext extends GenericApplicationContext {
public OSGIGroupApplicationContext(
public OSGIGroupApplicationContext(Bundle child,
List<OSGIXmlApplicationContext> contextGroup) {
this.setDisplayName("parent of " + child.getSymbolicName());
refresh(); // refresh first to avoid recreating bean definitions
DefaultListableBeanFactory factory = getDefaultListableBeanFactory();
// Register all bean definitions from other contexts into our factory

View file

@ -34,7 +34,8 @@ import org.springframework.context.support.AbstractXmlApplicationContext;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 30, 2012 mschenke Initial creation
* Oct 30, 2012 mschenke Initial creation
* Nov 12, 2013 2361 njensen call setDisplayName()
*
* </pre>
*
@ -53,6 +54,7 @@ public class OSGIXmlApplicationContext extends AbstractXmlApplicationContext {
super(parent);
setClassLoader(new OSGIXmlClassLoader(bundle, getClassLoader()));
setConfigLocations(configLocations);
this.setDisplayName(bundle.getSymbolicName());
refresh();
}