From: Prasanth Pallamreddy Date: Wed, 18 Dec 2013 05:26:20 +0000 (-0800) Subject: Lazily initialize jaxb context in NB application X-Git-Tag: jenkins-controller-bulk-release-prepare-only-2-1~167^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=7f2e6aa488a5b99a331421684886b9afe47259d2 Lazily initialize jaxb context in NB application Change-Id: Ibac5614aa1b23ff360bcce3ea29091f0a7a78906 Signed-off-by: Prasanth Pallamreddy --- diff --git a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java index e97a562620..e164abaf95 100644 --- a/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java +++ b/opendaylight/northbound/commons/src/main/java/org/opendaylight/controller/northbound/commons/NorthboundApplication.java @@ -46,9 +46,12 @@ public class NorthboundApplication extends Application { public NorthboundApplication() { _singletons = new HashSet(); _singletons.add(new ContextResolver() { - JAXBContext jaxbContext = newJAXBContext(); + JAXBContext jaxbContext; @Override - public JAXBContext getContext(Class type) { + public synchronized JAXBContext getContext(Class type) { + if (jaxbContext == null) { + jaxbContext = newJAXBContext(); + } return jaxbContext; }