use of org.motechproject.mds.exception.init.MdsEntityWireException in project motech by motech.
the class EntitiesBundleMonitor method start.
/**
* Starts the entities bundle and waits until it will be started and its context will be
* initialized.
*/
public void start() {
LOGGER.info("Starting the entities bundle");
try {
Bundle entitiesBundle = getEntitiesBundle();
if (entitiesBundle != null && entitiesBundle.getState() != Bundle.STARTING && entitiesBundle.getState() != Bundle.ACTIVE) {
entitiesBundle.start();
} else {
LOGGER.warn("No entities bundle to start");
return;
}
} catch (BundleException e) {
if (e.getType() == BundleException.RESOLVE_ERROR) {
throw new MdsEntityWireException(e);
} else {
throw new MdsException("Unable to start the entities bundle", e);
}
}
waitUntil(new Condition() {
@Override
public boolean await() {
return !bundleStarted;
}
}, "started");
LOGGER.info("Started the entities bundle");
waitForEntitiesContext();
}
Aggregations