JobManager::removeJob() returns an error if the job is not stopped 89/139189/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Tue, 18 Jul 2017 01:21:27 +0000 (10:21 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Tue, 18 Jul 2017 01:21:27 +0000 (10:21 +0900)
Change-Id: Ie5589733472d0215b5b5a9a20e807d2013e3642a
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
src/server/JobManager.cpp

index aca4e9eaa29c401de6380d30d4f6a5eb035be932..a83c50442b9d7e5cd5686a7a990f9bb6e3b2e0cf 100644 (file)
@@ -174,7 +174,7 @@ int JobManager::stopJob(int jobId, IClient* owner)
        IF_FAIL_RETURN(jobRunner, E_PARAM);
 
        if (!jobRunner->isStarted()) {
-               _D("Job-%d of %s has stopped already", jobId, owner->getName().c_str());
+               _W("Job-%d of %s has stopped already", jobId, owner->getName().c_str());
                return E_RULE_OFF;
        }
 
@@ -191,6 +191,11 @@ int JobManager::removeJob(int jobId, IClient* owner)
        JobRunner* jobRunner = __getRunner(owner->getName(), jobId);
        IF_FAIL_RETURN_TAG(jobRunner, E_PARAM, _W, "Not found");
 
+       if (jobRunner->isStarted()) {
+               _W("Job-%d of %s is still running", jobId, owner->getName().c_str());
+               return E_RULE_ON;
+       }
+
        if (jobRunner->isPersistent())
                __jobInfoDatabase.remove(jobId);