Details
-
Bug
-
Resolution: Obsolete
-
Major
-
None
-
None
-
None
Description
There is an inconsistency in the name DeployHandler uses when it adds a deployment to the repository vs. what SerializableDeploymentRepository.getModifiedDeployments() checks when looking for added content. Result is content that has already been added and deployed gets included in the modification list as ModifyStatus.ADDED, and the MainDeployer redeploys it..
For example, say I have a file whose VFS path name is "http-sr.war". I use the DeploymentManager to distribute and start it:
String name = file.getPathName();
DeploymentProgress progress = this.deploymentManager.distribute(name, DEPLOYMENT_PHASE, file.toURL());
progress.run();
progress = this.deploymentManager.start(DEPLOYMENT_PHASE, name);
progress.run();
This results in DeployHandler, start(...) making the following call:
VirtualFile vf = deploymentRepository.getDeploymentContent(name, dtID.getPhase());
...
deploymentRepository.addDeployment(vf.getName(), vfsd, dtID.getPhase());
where vf.getName() returns "http-sr.war"
However, getModifiedDeployments() uses the full URI of the virtual file when checking if a child is already deployed.
VirtualFile deployDir = VFS.getRoot(applicationDir.toURI());
List<VirtualFile> children = deployDir.getChildren();
for(VirtualFile vf : children)
{
String key = vf.toURI().toString();
if( applicationCtxs.containsKey(key) == false )
{
VFSDeployment ctx = loadDeploymentData(vf);
ModificationInfo info = new ModificationInfo(ctx, vf.getLastModified(), ModifyStatus.ADDED);
....
Result is the existing key is not found and the content is redeployed. (A duplicate key/value pair ends up in the applicationCtxs map as well, which likely will have bad effects.)