mirror of https://github.com/apache/cloudstack.git
Merge branch 'bugfix/CID-1114591'
This commit is contained in:
commit
765d402d69
|
|
@ -35,39 +35,35 @@ public abstract class DownloadActiveState extends DownloadState {
|
|||
s_logger.trace("handleAnswer, answer status=" + answer.getDownloadStatus() + ", curr state=" + getName());
|
||||
}
|
||||
switch (answer.getDownloadStatus()) {
|
||||
case DOWNLOAD_IN_PROGRESS:
|
||||
getDownloadListener().scheduleStatusCheck(RequestType.GET_STATUS);
|
||||
return Status.DOWNLOAD_IN_PROGRESS.toString();
|
||||
case DOWNLOADED:
|
||||
getDownloadListener().cancelTimeoutTask();
|
||||
return Status.DOWNLOADED.toString();
|
||||
case NOT_DOWNLOADED:
|
||||
getDownloadListener().scheduleStatusCheck(RequestType.GET_STATUS);
|
||||
return Status.NOT_DOWNLOADED.toString();
|
||||
case DOWNLOAD_ERROR:
|
||||
getDownloadListener().cancelStatusTask();
|
||||
getDownloadListener().cancelTimeoutTask();
|
||||
return Status.DOWNLOAD_ERROR.toString();
|
||||
case UNKNOWN:
|
||||
getDownloadListener().cancelStatusTask();
|
||||
getDownloadListener().cancelTimeoutTask();
|
||||
return Status.DOWNLOAD_ERROR.toString();
|
||||
default:
|
||||
return null;
|
||||
case DOWNLOAD_IN_PROGRESS:
|
||||
getDownloadListener().scheduleStatusCheck(RequestType.GET_STATUS);
|
||||
return Status.DOWNLOAD_IN_PROGRESS.toString();
|
||||
case DOWNLOADED:
|
||||
getDownloadListener().cancelTimeoutTask();
|
||||
return Status.DOWNLOADED.toString();
|
||||
case NOT_DOWNLOADED:
|
||||
getDownloadListener().scheduleStatusCheck(RequestType.GET_STATUS);
|
||||
return Status.NOT_DOWNLOADED.toString();
|
||||
case DOWNLOAD_ERROR:
|
||||
getDownloadListener().cancelStatusTask();
|
||||
getDownloadListener().cancelTimeoutTask();
|
||||
return Status.DOWNLOAD_ERROR.toString();
|
||||
case UNKNOWN:
|
||||
getDownloadListener().cancelStatusTask();
|
||||
getDownloadListener().cancelTimeoutTask();
|
||||
return Status.DOWNLOAD_ERROR.toString();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntry(String prevState, DownloadEvent event, Object evtObj) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
getDownloadListener().log("onEntry, prev state= " + prevState + ", curr state=" + getName() + ", event=" + event, Level.TRACE);
|
||||
}
|
||||
super.onEntry(prevState, event, evtObj);
|
||||
|
||||
if (event == DownloadEvent.DOWNLOAD_ANSWER) {
|
||||
getDownloadListener().callback((DownloadAnswer)evtObj);
|
||||
getDownloadListener().setLastUpdated();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -79,7 +75,7 @@ public abstract class DownloadActiveState extends DownloadState {
|
|||
if (s_logger.isTraceEnabled()) {
|
||||
getDownloadListener().log("handleTimeout, updateMs=" + updateMs + ", curr state= " + getName(), Level.TRACE);
|
||||
}
|
||||
String newState = this.getName();
|
||||
String newState = getName();
|
||||
if (updateMs > 5 * DownloadListener.STATUS_POLL_INTERVAL) {
|
||||
newState = Status.DOWNLOAD_ERROR.toString();
|
||||
getDownloadListener().log("timeout: transitioning to download error state, currstate=" + getName(), Level.DEBUG);
|
||||
|
|
|
|||
|
|
@ -45,26 +45,26 @@ public abstract class UploadActiveState extends UploadState {
|
|||
s_logger.debug("handleAnswer, answer status=" + answer.getUploadStatus() + ", curr state=" + getName());
|
||||
}
|
||||
switch (answer.getUploadStatus()) {
|
||||
case UPLOAD_IN_PROGRESS:
|
||||
getUploadListener().scheduleStatusCheck(RequestType.GET_STATUS);
|
||||
return Status.UPLOAD_IN_PROGRESS.toString();
|
||||
case UPLOADED:
|
||||
getUploadListener().scheduleImmediateStatusCheck(RequestType.PURGE);
|
||||
getUploadListener().cancelTimeoutTask();
|
||||
return Status.UPLOADED.toString();
|
||||
case NOT_UPLOADED:
|
||||
getUploadListener().scheduleStatusCheck(RequestType.GET_STATUS);
|
||||
return Status.NOT_UPLOADED.toString();
|
||||
case UPLOAD_ERROR:
|
||||
getUploadListener().cancelStatusTask();
|
||||
getUploadListener().cancelTimeoutTask();
|
||||
return Status.UPLOAD_ERROR.toString();
|
||||
case UNKNOWN:
|
||||
getUploadListener().cancelStatusTask();
|
||||
getUploadListener().cancelTimeoutTask();
|
||||
return Status.UPLOAD_ERROR.toString();
|
||||
default:
|
||||
return null;
|
||||
case UPLOAD_IN_PROGRESS:
|
||||
getUploadListener().scheduleStatusCheck(RequestType.GET_STATUS);
|
||||
return Status.UPLOAD_IN_PROGRESS.toString();
|
||||
case UPLOADED:
|
||||
getUploadListener().scheduleImmediateStatusCheck(RequestType.PURGE);
|
||||
getUploadListener().cancelTimeoutTask();
|
||||
return Status.UPLOADED.toString();
|
||||
case NOT_UPLOADED:
|
||||
getUploadListener().scheduleStatusCheck(RequestType.GET_STATUS);
|
||||
return Status.NOT_UPLOADED.toString();
|
||||
case UPLOAD_ERROR:
|
||||
getUploadListener().cancelStatusTask();
|
||||
getUploadListener().cancelTimeoutTask();
|
||||
return Status.UPLOAD_ERROR.toString();
|
||||
case UNKNOWN:
|
||||
getUploadListener().cancelStatusTask();
|
||||
getUploadListener().cancelTimeoutTask();
|
||||
return Status.UPLOAD_ERROR.toString();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ public abstract class UploadActiveState extends UploadState {
|
|||
if (s_logger.isTraceEnabled()) {
|
||||
getUploadListener().log("handleTimeout, updateMs=" + updateMs + ", curr state= " + getName(), Level.TRACE);
|
||||
}
|
||||
String newState = this.getName();
|
||||
String newState = getName();
|
||||
if (updateMs > 5 * UploadListener.STATUS_POLL_INTERVAL) {
|
||||
newState = Status.UPLOAD_ERROR.toString();
|
||||
getUploadListener().log("timeout: transitioning to upload error state, currstate=" + getName(), Level.DEBUG);
|
||||
|
|
@ -90,12 +90,9 @@ public abstract class UploadActiveState extends UploadState {
|
|||
|
||||
@Override
|
||||
public void onEntry(String prevState, UploadEvent event, Object evtObj) {
|
||||
if (s_logger.isTraceEnabled()) {
|
||||
getUploadListener().log("onEntry, prev state= " + prevState + ", curr state=" + getName() + ", event=" + event, Level.TRACE);
|
||||
}
|
||||
super.onEntry(prevState, event, evtObj);
|
||||
|
||||
if (event == UploadEvent.UPLOAD_ANSWER) {
|
||||
getUploadListener().updateDatabase((UploadAnswer)evtObj);
|
||||
getUploadListener().setLastUpdated();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue