From 7f2e6aa488a5b99a331421684886b9afe47259d2 Mon Sep 17 00:00:00 2001 From: Prasanth Pallamreddy Date: Tue, 17 Dec 2013 21:26:20 -0800 Subject: [PATCH] Lazily initialize jaxb context in NB application Change-Id: Ibac5614aa1b23ff360bcce3ea29091f0a7a78906 Signed-off-by: Prasanth Pallamreddy --- .../northbound/commons/NorthboundApplication.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; } -- 2.36.6