DisassociationPhasepublic class DisassociationPhase extends DeploymentPhase This phase is responsible to disassociate an application from a target
It uses ServerDeploymentTarget, GroupDeploymentTarget to remove references |
Fields Summary |
---|
public static final Logger | sLoggerDeployment Logger object for this class | private static com.sun.enterprise.util.i18n.StringManager | localStringsstring manager |
Constructors Summary |
---|
public DisassociationPhase(DeploymentContext deploymentCtx)Creates a new instance of DisassociatePhase
this.deploymentCtx = deploymentCtx;
this.name = DISASSOCIATE;
|
Methods Summary |
---|
private com.sun.enterprise.deployment.backend.DeploymentEvent | getPostPhaseEvent(com.sun.enterprise.deployment.backend.DeploymentRequest req)Event that will be broadcasted at the end of the phase
return new DeploymentEvent(DeploymentEventType.POST_DISASSOCIATE,new DeploymentEventInfo(req));
| private com.sun.enterprise.deployment.backend.DeploymentEvent | getPrePhaseEvent(com.sun.enterprise.deployment.backend.DeploymentRequest req)Event that will be broadcasted at the start of the phase
return new DeploymentEvent(DeploymentEventType.PRE_DISASSOCIATE, new DeploymentEventInfo(req));
| public void | runPhase(DeploymentPhaseContext phaseCtx)This method disassociates the application from the target as specified
in request object
DeploymentStatus status = phaseCtx.getDeploymentStatus();
try {
//get the app directory on target's cache deleted
DeploymentRequest req = phaseCtx.getDeploymentRequest();
DeploymentTarget target = (DeploymentTarget)req.getTarget();
/*
*Remove the app ref and send the event unless this is part of a
*redeployment sequence of operations and the attributes for the app
*ref will not change as a result of the deployment, compared to
*their current values.
*/
ApplicationRef ref = ApplicationReferenceHelper.findCurrentAppRef(
deploymentCtx, target.getName(), req.getName());
boolean needToRemoveRef = true;
DeploymentContext.SavedApplicationRefInfo info = null;
if (req.isRedeployInProgress()) {
/*
*Save a pointer to the existing app ref for use during the later
*disassociate phase.
*/
info = deploymentCtx.saveAppRef(
req.getName(), target.getName(), ref, req);
needToRemoveRef = info.isChanging();
}
sLogger.fine("DisassociationPhase for " + req.getName() + " on " + target.getName() +
"; isRedeployInProgress = " + req.isRedeployInProgress() +
", savedAppRefInfo is " + (info != null ? info.toString() : "<null>" ) + "need to remove = " + needToRemoveRef);
if (needToRemoveRef) {
sLogger.fine("DisassociationPhase removing app ref for " + req.getName() + " on " + target.getName());
target.removeAppReference(req.getName());
sendDisassociateEvent(req);
}
status.setStageStatus(DeploymentStatus.SUCCESS);
}catch(Throwable t){
status.setStageStatus(DeploymentStatus.FAILURE);
status.setStageException(t);
status.setStageStatusMessage(t.getMessage());
}
| private void | sendDisassociateEvent(com.sun.enterprise.deployment.backend.DeploymentRequest req)
DeploymentTarget target = (DeploymentTarget)req.getTarget();
String moduleType;
if(req.isApplication()) {
moduleType = null;
} else {
moduleType = DeploymentServiceUtils.getModuleTypeString(req.getType());
}
int eventType = com.sun.enterprise.admin.event.BaseDeployEvent.APPLICATION_UNREFERENCED;
String appName = req.getName();
String targetName = target.getTarget().getName();
boolean success = DeploymentServiceUtils.multicastEvent(
eventType,
appName,
moduleType,
false,
true,
targetName);
sLogger.log(Level.FINE, "sendDisassociateEvent: success=" + success);
|
|