Issue #2361 better logging of viz spring initialization of bundles
Change-Id: I9e8e9ec570b47e5b7052928206443eb2835e809b Former-commit-id:6707d1aadf
[formerly692ea76d75
] [formerly6707d1aadf
[formerly692ea76d75
] [formerlya4ece1d116
[formerly 99500a22ff9b2f115b5bb6e35034f47adf3d0853]]] Former-commit-id:a4ece1d116
Former-commit-id:4b329513e5
[formerly2e86520b53
] Former-commit-id:5c7be238a0
This commit is contained in:
parent
db3a33864f
commit
ec0025a309
3 changed files with 14 additions and 4 deletions
|
@ -36,6 +36,7 @@ import org.osgi.framework.Constants;
|
||||||
* has been started
|
* has been started
|
||||||
* Mar 05, 2013 1754 djohnson Catch exceptions and allow as much of the Spring container to boot as possible.
|
* 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
|
* May 23, 2013 2005 njensen Added springSuccess flag
|
||||||
|
* Nov 12, 2013 2361 njensen Print out time spent on each spring context
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -153,10 +154,11 @@ public class Activator implements BundleActivator {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
long t0 = System.currentTimeMillis();
|
||||||
if (parentContexts.size() > 0) {
|
if (parentContexts.size() > 0) {
|
||||||
// Context with parent context
|
// Context with parent context
|
||||||
appCtx = new OSGIXmlApplicationContext(
|
appCtx = new OSGIXmlApplicationContext(
|
||||||
new OSGIGroupApplicationContext(
|
new OSGIGroupApplicationContext(bundle,
|
||||||
parentContexts),
|
parentContexts),
|
||||||
files.toArray(new String[0]), bundle);
|
files.toArray(new String[0]), bundle);
|
||||||
} else {
|
} else {
|
||||||
|
@ -164,6 +166,9 @@ public class Activator implements BundleActivator {
|
||||||
appCtx = new OSGIXmlApplicationContext(
|
appCtx = new OSGIXmlApplicationContext(
|
||||||
files.toArray(new String[0]), bundle);
|
files.toArray(new String[0]), bundle);
|
||||||
}
|
}
|
||||||
|
System.out.println("Bundle " + bundle.getSymbolicName()
|
||||||
|
+ " spring init took: "
|
||||||
|
+ (System.currentTimeMillis() - t0));
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// No access to the statusHandler yet, so print the
|
// No access to the statusHandler yet, so print the
|
||||||
// stack trace to the console. By catching this, we also
|
// stack trace to the console. By catching this, we also
|
||||||
|
|
|
@ -21,6 +21,7 @@ package com.raytheon.uf.viz.spring.dm;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.osgi.framework.Bundle;
|
||||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||||
import org.springframework.context.support.GenericApplicationContext;
|
import org.springframework.context.support.GenericApplicationContext;
|
||||||
|
@ -35,7 +36,8 @@ import org.springframework.context.support.GenericApplicationContext;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Nov 1, 2012 mschenke Initial creation
|
* Nov 01, 2012 mschenke Initial creation
|
||||||
|
* Nov 12, 2013 2361 njensen call setDisplayName()
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -45,8 +47,9 @@ import org.springframework.context.support.GenericApplicationContext;
|
||||||
|
|
||||||
public class OSGIGroupApplicationContext extends GenericApplicationContext {
|
public class OSGIGroupApplicationContext extends GenericApplicationContext {
|
||||||
|
|
||||||
public OSGIGroupApplicationContext(
|
public OSGIGroupApplicationContext(Bundle child,
|
||||||
List<OSGIXmlApplicationContext> contextGroup) {
|
List<OSGIXmlApplicationContext> contextGroup) {
|
||||||
|
this.setDisplayName("parent of " + child.getSymbolicName());
|
||||||
refresh(); // refresh first to avoid recreating bean definitions
|
refresh(); // refresh first to avoid recreating bean definitions
|
||||||
DefaultListableBeanFactory factory = getDefaultListableBeanFactory();
|
DefaultListableBeanFactory factory = getDefaultListableBeanFactory();
|
||||||
// Register all bean definitions from other contexts into our factory
|
// Register all bean definitions from other contexts into our factory
|
||||||
|
|
|
@ -34,7 +34,8 @@ import org.springframework.context.support.AbstractXmlApplicationContext;
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Oct 30, 2012 mschenke Initial creation
|
* Oct 30, 2012 mschenke Initial creation
|
||||||
|
* Nov 12, 2013 2361 njensen call setDisplayName()
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -53,6 +54,7 @@ public class OSGIXmlApplicationContext extends AbstractXmlApplicationContext {
|
||||||
super(parent);
|
super(parent);
|
||||||
setClassLoader(new OSGIXmlClassLoader(bundle, getClassLoader()));
|
setClassLoader(new OSGIXmlClassLoader(bundle, getClassLoader()));
|
||||||
setConfigLocations(configLocations);
|
setConfigLocations(configLocations);
|
||||||
|
this.setDisplayName(bundle.getSymbolicName());
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue