Re-org async job constant definition place

This commit is contained in:
Kelven Yang 2013-05-08 10:05:35 -07:00
parent 3c780a500d
commit 38e2964fd7
16 changed files with 76 additions and 48 deletions

View File

@ -3914,7 +3914,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
return true;
}
@Override
public synchronized CreateAnswer execute(CreateCommand cmd) {
if (s_logger.isInfoEnabled()) {

View File

@ -28,9 +28,9 @@ import org.apache.cloudstack.api.response.ExceptionResponse;
import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
import com.cloud.async.AsyncJobConstants;
import com.cloud.async.AsyncJobDispatcher;
import com.cloud.async.AsyncJobManager;
import com.cloud.async.AsyncJobResult;
import com.cloud.user.Account;
import com.cloud.user.UserContext;
import com.cloud.user.dao.AccountDao;
@ -84,7 +84,7 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat
_dispatcher.dispatch(cmdObj, params);
// serialize this to the async job table
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_SUCCEEDED, 0, cmdObj.getResponseObject());
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_SUCCEEDED, 0, cmdObj.getResponseObject());
} finally {
UserContext.unregisterContext();
}
@ -107,7 +107,7 @@ public class ApiAsyncJobDispatcher extends AdapterBase implements AsyncJobDispat
// FIXME: setting resultCode to ApiErrorCode.INTERNAL_ERROR is not right, usually executors have their exception handling
// and we need to preserve that as much as possible here
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), response);
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), response);
}
}
}

View File

@ -0,0 +1,24 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.async;
public interface AsyncJobConstants {
public static final int STATUS_IN_PROGRESS = 0;
public static final int STATUS_SUCCEEDED = 1;
public static final int STATUS_FAILED = 2;
}

View File

@ -86,7 +86,7 @@ public class AsyncJobExecutionContext {
assert(_job != null);
AsyncJobJoinMapVO record = _joinMapDao.getJoinRecord(_job.getId(), joinedJobId);
if(record.getJoinStatus() == AsyncJobResult.STATUS_FAILED && record.getJoinResult() != null) {
if(record.getJoinStatus() == AsyncJobConstants.STATUS_FAILED && record.getJoinResult() != null) {
Object exception = SerializerHelper.fromObjectSerializedString(record.getJoinResult());
if(exception != null && exception instanceof Exception) {
if(exception instanceof InsufficientCapacityException)

View File

@ -51,13 +51,13 @@ public class AsyncJobMBeanImpl extends StandardMBean implements AsyncJobMBean {
public String getStatus() {
int jobStatus = _job.getStatus();
switch(jobStatus) {
case AsyncJobResult.STATUS_SUCCEEDED :
case AsyncJobConstants.STATUS_SUCCEEDED :
return "Completed";
case AsyncJobResult.STATUS_IN_PROGRESS:
case AsyncJobConstants.STATUS_IN_PROGRESS:
return "In preogress";
case AsyncJobResult.STATUS_FAILED:
case AsyncJobConstants.STATUS_FAILED:
return "failed";
}

View File

@ -197,7 +197,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
return;
}
if(job.getStatus() != AsyncJobResult.STATUS_IN_PROGRESS) {
if(job.getStatus() != AsyncJobConstants.STATUS_IN_PROGRESS) {
if(s_logger.isDebugEnabled()) {
s_logger.debug("job-" + jobId + " is already completed.");
}
@ -387,8 +387,8 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
jobResult.setResultCode(job.getResultCode());
jobResult.setUuid(job.getUuid());
if(job.getStatus() == AsyncJobResult.STATUS_SUCCEEDED ||
job.getStatus() == AsyncJobResult.STATUS_FAILED) {
if(job.getStatus() == AsyncJobConstants.STATUS_SUCCEEDED ||
job.getStatus() == AsyncJobConstants.STATUS_FAILED) {
if(s_logger.isDebugEnabled()) {
s_logger.debug("Async job-" + jobId + " completed");
@ -402,14 +402,14 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
s_logger.debug("Async job-" + jobId + " does not exist, invalid job id?");
}
jobResult.setJobStatus(AsyncJobResult.STATUS_FAILED);
jobResult.setJobStatus(AsyncJobConstants.STATUS_FAILED);
jobResult.setResult("job-" + jobId + " does not exist");
}
txt.commit();
} catch(Exception e) {
s_logger.error("Unexpected exception while querying async job-" + jobId + " status: ", e);
jobResult.setJobStatus(AsyncJobResult.STATUS_FAILED);
jobResult.setJobStatus(AsyncJobConstants.STATUS_FAILED);
jobResult.setResult("Exception: " + e.toString());
txt.rollback();
}
@ -480,7 +480,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
jobDispatcher.RunJob(job);
} else {
s_logger.error("Unable to find job dispatcher, job will be cancelled");
completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), null);
completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), null);
}
if (s_logger.isDebugEnabled()) {
@ -489,7 +489,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
} catch (Throwable e) {
s_logger.error("Unexpected exception", e);
completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), null);
completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, ApiErrorCode.INTERNAL_ERROR.getHttpCode(), null);
} finally {
// guard final clause as well
try {
@ -676,7 +676,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
if(blockItems != null && blockItems.size() > 0) {
for(SyncQueueItemVO item : blockItems) {
if(item.getContentType().equalsIgnoreCase(SyncQueueItem.AsyncJobContentType)) {
completeAsyncJob(item.getContentId(), AsyncJobResult.STATUS_FAILED, 0,
completeAsyncJob(item.getContentId(), AsyncJobConstants.STATUS_FAILED, 0,
getResetResultResponse("Job is cancelled as it has been blocking others for too long"));
}
@ -725,7 +725,7 @@ public class AsyncJobManagerImpl extends ManagerBase implements AsyncJobManager,
Long jobId = item.getContentId();
if(jobId != null) {
s_logger.warn("Mark job as failed as its correspoding queue-item has been discarded. job id: " + jobId);
completeAsyncJob(jobId, AsyncJobResult.STATUS_FAILED, 0, getResetResultResponse("Execution was cancelled because of server shutdown"));
completeAsyncJob(jobId, AsyncJobConstants.STATUS_FAILED, 0, getResetResultResponse("Execution was cancelled because of server shutdown"));
}
}
_queueMgr.purgeItem(item.getId());

View File

@ -19,9 +19,6 @@ package com.cloud.async;
import com.cloud.api.ApiSerializerHelper;
public class AsyncJobResult {
public static final int STATUS_IN_PROGRESS = 0;
public static final int STATUS_SUCCEEDED = 1;
public static final int STATUS_FAILED = 2;
private long jobId;
private int jobStatus;
@ -32,7 +29,7 @@ public class AsyncJobResult {
public AsyncJobResult(long jobId) {
this.jobId = jobId;
jobStatus = STATUS_IN_PROGRESS;
jobStatus = AsyncJobConstants.STATUS_IN_PROGRESS;
processStatus = 0;
resultCode = 0;
result = "";

View File

@ -23,6 +23,7 @@ import java.util.List;
import org.apache.log4j.Logger;
import com.cloud.async.AsyncJobConstants;
import com.cloud.async.AsyncJobResult;
import com.cloud.async.AsyncJobVO;
import com.cloud.utils.db.DB;
@ -68,7 +69,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
SearchCriteria<AsyncJobVO> sc = pendingAsyncJobSearch.create();
sc.setParameters("instanceType", instanceType);
sc.setParameters("instanceId", instanceId);
sc.setParameters("status", AsyncJobResult.STATUS_IN_PROGRESS);
sc.setParameters("status", AsyncJobConstants.STATUS_IN_PROGRESS);
List<AsyncJobVO> l = listIncludingRemovedBy(sc);
if(l != null && l.size() > 0) {
@ -88,7 +89,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
if (accountId != null) {
sc.setParameters("accountId", accountId);
}
sc.setParameters("status", AsyncJobResult.STATUS_IN_PROGRESS);
sc.setParameters("status", AsyncJobConstants.STATUS_IN_PROGRESS);
return listBy(sc);
}
@ -102,7 +103,7 @@ public class AsyncJobDaoImpl extends GenericDaoBase<AsyncJobVO, Long> implements
@DB
public void resetJobProcess(long msid, int jobResultCode, String jobResultMessage) {
String sql = "UPDATE async_job SET job_status=" + AsyncJobResult.STATUS_FAILED + ", job_result_code=" + jobResultCode
String sql = "UPDATE async_job SET job_status=" + AsyncJobConstants.STATUS_FAILED + ", job_result_code=" + jobResultCode
+ ", job_result='" + jobResultMessage + "' where job_status=0 AND (job_complete_msid=? OR (job_complete_msid IS NULL AND job_init_msid=?))";
Transaction txn = Transaction.currentTxn();

View File

@ -18,6 +18,7 @@ package com.cloud.async.dao;
import java.util.List;
import com.cloud.async.AsyncJobConstants;
import com.cloud.async.AsyncJobJoinMapVO;
import com.cloud.async.AsyncJobResult;
import com.cloud.utils.DateUtil;
@ -48,7 +49,7 @@ public class AsyncJobJoinMapDaoImpl extends GenericDaoBase<AsyncJobJoinMapVO, Lo
record.setJobId(jobId);
record.setJoinJobId(joinJobId);
record.setJoinMsid(joinMsid);
record.setJoinStatus(AsyncJobResult.STATUS_IN_PROGRESS);
record.setJoinStatus(AsyncJobConstants.STATUS_IN_PROGRESS);
this.persist(record);
return record.getId();

View File

@ -55,6 +55,7 @@ import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.agent.manager.Commands;
import com.cloud.api.commands.DestroyConsoleProxyCmd;
import com.cloud.async.AsyncJobConstants;
import com.cloud.async.AsyncJobExecutionContext;
import com.cloud.async.AsyncJobResult;
import com.cloud.certificate.dao.CertificateDao;
@ -2054,11 +2055,11 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
_itMgr.processVmStartWork(vm, ((VmWorkStart)work).getParams(),
user, account, ((VmWorkStart)work).getPlan());
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_SUCCEEDED, null);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_SUCCEEDED, null);
} catch(Exception e) {
s_logger.error("Exception in process VM-start work", e);
String result = SerializerHelper.toObjectSerializedString(e);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_FAILED, result);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_FAILED, result);
}
}
@ -2074,11 +2075,11 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
try {
_itMgr.processVmStopWork(vm, ((VmWorkStop)work).isForceStop(), user, account);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_SUCCEEDED, null);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_SUCCEEDED, null);
} catch(Exception e) {
s_logger.error("Exception in process VM-stop work", e);
String result = SerializerHelper.toObjectSerializedString(e);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_FAILED, result);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_FAILED, result);
}
}
}

View File

@ -2846,7 +2846,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
if (asyncExecutionContext != null) {
job = asyncExecutionContext.getJob();
_asyncMgr.updateAsyncJobAttachment(job.getId(), Upload.Type.VOLUME.toString(), volumeId);
_asyncMgr.updateAsyncJobStatus(job.getId(), AsyncJobResult.STATUS_IN_PROGRESS, resultObj);
_asyncMgr.updateAsyncJobStatus(job.getId(), AsyncJobConstants.STATUS_IN_PROGRESS, resultObj);
}
String value = _configs.get(Config.CopyVolumeWait.toString());
int copyvolumewait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
@ -2867,7 +2867,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
resultObj.setResultString(errorString);
resultObj.setUploadStatus(UploadVO.Status.COPY_ERROR.toString());
if (asyncExecutionContext != null) {
_asyncMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, 0, resultObj);
_asyncMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, 0, resultObj);
}
// Update the DB that volume couldn't be copied

View File

@ -51,6 +51,7 @@ import com.cloud.agent.api.check.CheckSshCommand;
import com.cloud.agent.api.to.NicTO;
import com.cloud.agent.api.to.VirtualMachineTO;
import com.cloud.agent.manager.Commands;
import com.cloud.async.AsyncJobConstants;
import com.cloud.async.AsyncJobExecutionContext;
import com.cloud.async.AsyncJobResult;
import com.cloud.capacity.dao.CapacityDao;
@ -1498,11 +1499,11 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
_itMgr.processVmStartWork(vm, ((VmWorkStart)work).getParams(),
user, account, ((VmWorkStart)work).getPlan());
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_SUCCEEDED, null);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_SUCCEEDED, null);
} catch(Exception e) {
s_logger.error("Exception in process VM-start work", e);
String result = SerializerHelper.toObjectSerializedString(e);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_FAILED, result);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_FAILED, result);
}
}
@ -1518,11 +1519,11 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
try {
_itMgr.processVmStopWork(vm, ((VmWorkStop)work).isForceStop(), user, account);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_SUCCEEDED, null);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_SUCCEEDED, null);
} catch(Exception e) {
s_logger.error("Exception in process VM-stop work", e);
String result = SerializerHelper.toObjectSerializedString(e);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobResult.STATUS_FAILED, result);
AsyncJobExecutionContext.getCurrentExecutionContext().completeJobAndJoin(AsyncJobConstants.STATUS_FAILED, result);
}
}
}

View File

@ -36,6 +36,7 @@ import org.apache.cloudstack.api.ApiConstants;
import com.cloud.api.ApiDispatcher;
import com.cloud.api.ApiGsonHelper;
import com.cloud.user.Account;
import com.cloud.async.AsyncJobConstants;
import com.cloud.async.AsyncJobManager;
import com.cloud.async.AsyncJobResult;
import com.cloud.async.AsyncJobVO;
@ -141,14 +142,14 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
Long asyncJobId = snapshotSchedule.getAsyncJobId();
AsyncJobVO asyncJob = _asyncJobDao.findById(asyncJobId);
switch (asyncJob.getStatus()) {
case AsyncJobResult.STATUS_SUCCEEDED:
case AsyncJobConstants.STATUS_SUCCEEDED:
// The snapshot has been successfully backed up.
// The snapshot state has also been cleaned up.
// We can schedule the next job for this snapshot.
// Remove the existing entry in the snapshot_schedule table.
scheduleNextSnapshotJob(snapshotSchedule);
break;
case AsyncJobResult.STATUS_FAILED:
case AsyncJobConstants.STATUS_FAILED:
// Check the snapshot status.
Long snapshotId = snapshotSchedule.getSnapshotId();
if (snapshotId == null) {
@ -186,7 +187,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
}
break;
case AsyncJobResult.STATUS_IN_PROGRESS:
case AsyncJobConstants.STATUS_IN_PROGRESS:
// There is no way of knowing from here whether
// 1) Another management server is processing this snapshot job
// 2) The management server has crashed and this snapshot is lying

View File

@ -44,6 +44,7 @@ import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd;
import org.apache.cloudstack.api.response.ExtractResponse;
import com.cloud.api.ApiDBUtils;
import com.cloud.async.AsyncJobConstants;
import com.cloud.async.AsyncJobManager;
import com.cloud.async.AsyncJobResult;
import com.cloud.exception.AgentUnavailableException;
@ -364,7 +365,7 @@ public class UploadListener implements Listener {
resultObj.setResultString(uploadErrorString);
resultObj.setState(state.toString());
asyncMgr.updateAsyncJobAttachment(asyncJobId, type.toString(), 1L);
asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobResult.STATUS_IN_PROGRESS, resultObj);
asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobConstants.STATUS_IN_PROGRESS, resultObj);
UploadVO vo = uploadDao.createForUpdate();
vo.setUploadState(state);
@ -377,7 +378,7 @@ public class UploadListener implements Listener {
resultObj.setResultString(uploadErrorString);
resultObj.setState(state.toString());
asyncMgr.updateAsyncJobAttachment(asyncJobId, type.toString(), 1L);
asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobResult.STATUS_IN_PROGRESS, resultObj);
asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobConstants.STATUS_IN_PROGRESS, resultObj);
UploadVO vo = uploadDao.createForUpdate();
@ -406,12 +407,12 @@ public class UploadListener implements Listener {
if (answer.getUploadStatus() == Status.UPLOAD_IN_PROGRESS){
asyncMgr.updateAsyncJobAttachment(asyncJobId, type.toString(), 1L);
asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobResult.STATUS_IN_PROGRESS, resultObj);
asyncMgr.updateAsyncJobStatus(asyncJobId, AsyncJobConstants.STATUS_IN_PROGRESS, resultObj);
}else if(answer.getUploadStatus() == Status.UPLOADED){
resultObj.setResultString("Success");
asyncMgr.completeAsyncJob(asyncJobId, AsyncJobResult.STATUS_SUCCEEDED, 1, resultObj);
asyncMgr.completeAsyncJob(asyncJobId, AsyncJobConstants.STATUS_SUCCEEDED, 1, resultObj);
}else{
asyncMgr.completeAsyncJob(asyncJobId, AsyncJobResult.STATUS_FAILED, 2, resultObj);
asyncMgr.completeAsyncJob(asyncJobId, AsyncJobConstants.STATUS_FAILED, 2, resultObj);
}
UploadVO updateBuilder = uploadDao.createForUpdate();
updateBuilder.setUploadPercent(answer.getUploadPct());

View File

@ -56,6 +56,7 @@ import com.cloud.agent.manager.allocator.HostAllocator;
import com.cloud.alert.AlertManager;
import com.cloud.api.ApiSerializerHelper;
import com.cloud.async.AsyncJob;
import com.cloud.async.AsyncJobConstants;
import com.cloud.async.AsyncJobExecutionContext;
import com.cloud.async.AsyncJobManager;
import com.cloud.async.AsyncJobResult;
@ -712,7 +713,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
return true;
VmWorkJobVO workJob = _workJobDao.findById(jobId);
if(workJob.getStatus() != AsyncJobResult.STATUS_IN_PROGRESS)
if(workJob.getStatus() != AsyncJobConstants.STATUS_IN_PROGRESS)
return true;
return false;
@ -1152,7 +1153,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
return true;
VmWorkJobVO workJob = _workJobDao.findById(jobId);
if(workJob.getStatus() != AsyncJobResult.STATUS_IN_PROGRESS)
if(workJob.getStatus() != AsyncJobConstants.STATUS_IN_PROGRESS)
return true;
return false;

View File

@ -26,6 +26,7 @@ import org.apache.log4j.Logger;
import com.cloud.api.ApiSerializerHelper;
import com.cloud.async.AsyncJob;
import com.cloud.async.AsyncJobConstants;
import com.cloud.async.AsyncJobDispatcher;
import com.cloud.async.AsyncJobManager;
import com.cloud.async.AsyncJobResult;
@ -74,15 +75,15 @@ public class VmWorkJobDispatcher extends AdapterBase implements AsyncJobDispatch
Method handler = getHandler(guru, cmd);
if(handler != null) {
handler.invoke(guru, work);
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_SUCCEEDED, 0, null);
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_SUCCEEDED, 0, null);
} else {
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, 0, null);
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, 0, null);
}
} finally {
UserContext.unregisterContext();
}
} catch(Throwable e) {
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobResult.STATUS_FAILED, 0, null);
_asyncJobMgr.completeAsyncJob(job.getId(), AsyncJobConstants.STATUS_FAILED, 0, null);
}
}