if (deployments.size() > 0) {
BundleDeployment bundleDeployment = deployments.get(0);
SchedulerLocal scheduler = LookupUtil.getSchedulerBean();
JobDetail jobDetail = context.getJobDetail();
BundleDeploymentStatus bundleDeploymentStatus = bundleManager.determineBundleDeploymentStatus(bundleDeployment.getId());
if (bundleDeploymentStatus.isTerminal()) {
// delete this job, we've assigned a final status
try {
context.setResult(bundleDeploymentStatus); // Return status to possible listeners
scheduler.deleteJob(jobDetail.getName(), jobDetail.getGroup());