Merge "Issue #2361 static lazy initialization of SubscriptionOverlapService's JAXBManager" into development
Former-commit-id:eed4c8604b
[formerly 2279e785ab3e47008afee489c1a4e96972f26b79] Former-commit-id:3f86a3735e
This commit is contained in:
commit
b71f2463da
1 changed files with 23 additions and 14 deletions
|
@ -54,6 +54,7 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
* Sept 23, 2013 2283 dhladky Updated for multiple configs
|
||||
* Oct 03, 2013 2386 mpduff Moved the subscription overlap rules files into the rules directory.
|
||||
* Oct 25, 2013 2292 mpduff Move overlap checks to edex.
|
||||
* Nov 12, 2013 2361 njensen Made JAXBManager static and initialized on first use
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
|
@ -62,6 +63,7 @@ import com.raytheon.uf.common.util.FileUtil;
|
|||
|
||||
public class SubscriptionOverlapService<T extends Time, C extends Coverage>
|
||||
implements ISubscriptionOverlapService<T, C> {
|
||||
|
||||
private static final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SubscriptionOverlapService.class);
|
||||
|
||||
|
@ -73,7 +75,22 @@ public class SubscriptionOverlapService<T extends Time, C extends Coverage>
|
|||
private static final String SUBSCRIPTION_OVERLAP_CONFIG_FILE_PATH = FileUtil
|
||||
.join("datadelivery", "systemManagement", "rules", File.separator);
|
||||
|
||||
private final JAXBManager jaxbManager;
|
||||
private static JAXBManager jaxbManager;
|
||||
|
||||
private static synchronized JAXBManager getJaxbManager() {
|
||||
if (jaxbManager == null) {
|
||||
try {
|
||||
Class<?>[] clazzes = new Class<?>[] {
|
||||
SubscriptionOverlapConfig.class,
|
||||
GridSubscriptionOverlapConfig.class,
|
||||
PointSubscriptionOverlapConfig.class };
|
||||
jaxbManager = new JAXBManager(clazzes);
|
||||
} catch (JAXBException e) {
|
||||
throw new ExceptionInInitializerError(e);
|
||||
}
|
||||
}
|
||||
return jaxbManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
@ -81,15 +98,7 @@ public class SubscriptionOverlapService<T extends Time, C extends Coverage>
|
|||
* @param duplicateChecker
|
||||
*/
|
||||
public SubscriptionOverlapService() {
|
||||
try {
|
||||
@SuppressWarnings("rawtypes")
|
||||
Class[] clazzes = new Class[] { SubscriptionOverlapConfig.class,
|
||||
GridSubscriptionOverlapConfig.class,
|
||||
PointSubscriptionOverlapConfig.class };
|
||||
jaxbManager = new JAXBManager(clazzes);
|
||||
} catch (JAXBException e) {
|
||||
throw new ExceptionInInitializerError(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,7 +128,7 @@ public class SubscriptionOverlapService<T extends Time, C extends Coverage>
|
|||
|
||||
final LocalizationFile configFile = pathManager.getLocalizationFile(
|
||||
context, fileName);
|
||||
configFile.jaxbMarshal(config, jaxbManager);
|
||||
configFile.jaxbMarshal(config, getJaxbManager());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -148,11 +157,11 @@ public class SubscriptionOverlapService<T extends Time, C extends Coverage>
|
|||
|
||||
if (type == DataType.GRID) {
|
||||
config = localizationFile.jaxbUnmarshal(
|
||||
GridSubscriptionOverlapConfig.class, jaxbManager);
|
||||
GridSubscriptionOverlapConfig.class, getJaxbManager());
|
||||
|
||||
} else if (type == DataType.POINT) {
|
||||
config = localizationFile.jaxbUnmarshal(
|
||||
PointSubscriptionOverlapConfig.class, jaxbManager);
|
||||
PointSubscriptionOverlapConfig.class, getJaxbManager());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue