Project: springxd
Issue XD-2851: Module loading error handling improvement
Modules are loaded in the container as such (in DeploymentListener): {code} try {	module = (ModuleType.job.toString().equals(moduleType)) ?	deployJobModule(client, unitName, moduleLabel, properties) :	deployStreamModule(client, unitName, moduleType, moduleLabel, properties);	if (module == null) {	status = new ModuleDeploymentStatus(container, moduleSequence, key, ModuleDeploymentStatus.State.failed,	"Module deployment returned null");	}	else {	status = new ModuleDeploymentStatus(container, moduleSequence, key,	ModuleDeploymentStatus.State.deployed, null);	} } catch (Exception e) {	status = new ModuleDeploymentStatus(container, moduleSequence, key, ModuleDeploymentStatus.State.failed,	ZooKeeperUtils.getStackTrace(e));	logger.error("Exception deploying module", e); } try {	writeModuleMetadata(client, module, path);	client.setData().forPath(status.buildPath(), ZooKeeperUtils.mapToBytes(status.toMap())); } catch (KeeperException.NoNodeException e) {	logger.warn("During deployment of module {} of type {} for {} with sequence number {}," +	"an undeployment request was detected; this module will be undeployed.", moduleLabel,	moduleType, unitName, moduleSequence);	if (logger.isTraceEnabled()) {	logger.trace("Path " + path + " was removed", e);	} } {code} The problem is if an {{Error}} is thrown, such as {{NoClassDefFoundError}} or {{NoSuchMethodError}}. We need to make a best effort when writing the deployment status to prevent the supervisor from timing out waiting for a status.
Story points: 2