String currentBackend = backendService.getCurrentBackend();
// If currentBackend contains ':' it is actually a B type module (see b/12893879)
if (currentBackend != null && currentBackend.indexOf(':') == -1) {
backend = currentBackend;
} else {
ModulesService modulesService = ModulesServiceFactory.getModulesService();
module = modulesService.getCurrentModule();
version = modulesService.getCurrentVersion();
}
} else {
final ModulesService modulesService = ModulesServiceFactory.getModulesService();
if (module.equals(modulesService.getCurrentModule())) {
version = modulesService.getCurrentVersion();
} else {
// TODO(user): we may want to support providing a version for a module
final String requestedModule = module;
version = runWithRetries(new Callable<String>() {
@Override public String call() {
return modulesService.getDefaultVersion(requestedModule);
}
}, QUEUE_RETRY_PARAMS, MODULES_EXCEPTION_HANDLER);
}
}
}