use of org.nhindirect.common.tx.TxService in project nhin-d by DirectProject.
the class AbstractNotificationAwareMailet method createTxServices.
/**
* Creates the Tx services
* @param initModules The initial Guice modules created by the init() method
*/
protected void createTxServices(final Collection<Module> initModules) {
Collection<Module> modules = initModules;
// now try to get the TxParser
// attempt to use the existing modules first
final boolean usingDefaultTxServiceMoudles = (modules == null);
if (modules == null) {
// create a default module for the TxService
modules = createDefaultTxServiceModules();
}
Injector txInjector = Guice.createInjector(modules);
try {
txParser = txInjector.getInstance(TxDetailParser.class);
txService = txInjector.getInstance(TxService.class);
} catch (Exception e) {
LOGGER.debug("First attempt to create message monitoring service failed.", e);
if (!usingDefaultTxServiceMoudles)
LOGGER.debug("Will attempt to create from default Tx service Guice module.");
else
///CLOVER:OFF
LOGGER.warn("Monitoring service already attempted to use the defualt Tx service Guice module. Monitoring will be disabled.");
///CLOVER:ON
}
// try again using the default Guice module
if ((txParser == null || txService == null) && !usingDefaultTxServiceMoudles) {
try {
// create a default module for the TxService
modules = createDefaultTxServiceModules();
txInjector = Guice.createInjector(modules);
if (txParser == null)
txParser = txInjector.getInstance(TxDetailParser.class);
if (txService == null)
txService = txInjector.getInstance(TxService.class);
}///CLOVER:OFF
catch (Exception e) {
LOGGER.warn("Failed to create message monitoring service. Monitoring will be disabled");
}
///CLOVER:ON
}
}
Aggregations