Modified agentgithandler to use the scheduledservice and the 
abstractasyncscheduledtask classes


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/35271840
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/35271840
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/35271840

Branch: refs/heads/master
Commit: 3527184018067b8c699d7916fc75025577923301
Parents: 4446d24
Author: Chamila de Alwis <[email protected]>
Authored: Mon Oct 20 15:45:24 2014 +0530
Committer: Chamila de Alwis <[email protected]>
Committed: Mon Oct 20 15:45:24 2014 +0530

----------------------------------------------------------------------
 .../modules/artifactmgt/git/agentgithandler.py          | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/35271840/tools/python-cartridge-agent/cartridgeagent/modules/artifactmgt/git/agentgithandler.py
----------------------------------------------------------------------
diff --git 
a/tools/python-cartridge-agent/cartridgeagent/modules/artifactmgt/git/agentgithandler.py
 
b/tools/python-cartridge-agent/cartridgeagent/modules/artifactmgt/git/agentgithandler.py
index 9e95be0..6da9c58 100644
--- 
a/tools/python-cartridge-agent/cartridgeagent/modules/artifactmgt/git/agentgithandler.py
+++ 
b/tools/python-cartridge-agent/cartridgeagent/modules/artifactmgt/git/agentgithandler.py
@@ -24,7 +24,7 @@ from ... util.log import LogFactory
 from ... util import cartridgeagentutils, extensionutils, 
cartridgeagentconstants
 from gitrepository import GitRepository
 from ... config import cartridgeagentconfiguration
-from ... util.asyncscheduledtask import AsyncScheduledTask
+from ... util.asyncscheduledtask import AbstractAsyncScheduledTask, 
ScheduledExecutor
 from ... artifactmgt.repositoryinformation import RepositoryInformation
 
 class AgentGitHandler:
@@ -449,7 +449,7 @@ class AgentGitHandler:
         if repo_context.scheduled_update_task is None:
             #TODO: make thread safe
             artifact_update_task = ArtifactUpdateTask(repo_info, 
auto_checkout, auto_commit)
-            async_task = AsyncScheduledTask(update_interval, 
artifact_update_task)
+            async_task = ScheduledExecutor(update_interval, 
artifact_update_task)
 
             repo_context.scheduled_update_task = async_task
             async_task.start()
@@ -481,16 +481,18 @@ class AgentGitHandler:
         return True
 
 
-class ArtifactUpdateTask(Thread):
+class ArtifactUpdateTask(AbstractAsyncScheduledTask):
+    """
+    Checks if the autocheckout and autocommit are enabled and executes 
respective tasks
+    """
 
     def __init__(self, repo_info, auto_checkout, auto_commit):
         self.log = LogFactory().get_log(__name__)
-        Thread.__init__(self)
         self.repo_info = repo_info
         self.auto_checkout = auto_checkout
         self.auto_commit = auto_commit
 
-    def run(self):
+    def execute_task(self):
         try:
             if self.auto_checkout:
                 AgentGitHandler.checkout(self.repo_info)

Reply via email to