You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mx...@apache.org on 2017/05/24 06:22:23 UTC

incubator-ariatosca git commit: removed busy wait

Repository: incubator-ariatosca
Updated Branches:
  refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution 1d98728d8 -> ec8effbdb


removed busy wait


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

Branch: refs/heads/ARIA-185-NullPool-logging-messages-appear-during-execution
Commit: ec8effbdb431cabbdcdba3c06a0586718cf7bddc
Parents: 1d98728
Author: max-orlov <ma...@gigaspaces.com>
Authored: Wed May 24 09:22:02 2017 +0300
Committer: max-orlov <ma...@gigaspaces.com>
Committed: Wed May 24 09:22:02 2017 +0300

----------------------------------------------------------------------
 .../orchestrator/execution_plugin/ctx_proxy/server.py | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/ec8effbd/aria/orchestrator/execution_plugin/ctx_proxy/server.py
----------------------------------------------------------------------
diff --git a/aria/orchestrator/execution_plugin/ctx_proxy/server.py b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
index 2e17674..d59e7bf 100644
--- a/aria/orchestrator/execution_plugin/ctx_proxy/server.py
+++ b/aria/orchestrator/execution_plugin/ctx_proxy/server.py
@@ -39,7 +39,6 @@ class CtxProxy(object):
         self.server = None
         self.bottle_server = None
         self._started = Queue.Queue(1)
-        self._terminated = Queue.Queue(1)
         self.thread = self._start_server()
         self._started.get(timeout=5)
 
@@ -47,10 +46,9 @@ class CtxProxy(object):
         proxy = self
 
         class BottleServerAdapter(bottle.ServerAdapter):
-            def __init__(self, _session, _terminated, *args, **kwargs):
+            def __init__(self, _session, *args, **kwargs):
                 super(BottleServerAdapter, self).__init__(*args, **kwargs)
                 self._session = _session
-                self._terminated = _terminated
 
             def run(self, app):
 
@@ -65,10 +63,8 @@ class CtxProxy(object):
                         try:
                             wsgiref.simple_server.WSGIServer.serve_forever(self, poll_interval)
                             # Once shutdown is called, we need to close the session
-                            self.bottle_server._session.remove()
                         finally:
-                            # only after we tried to close the session, we can proceed.
-                            self.bottle_server._terminated.put(True)
+                            self.bottle_server._session.remove()
 
                 class Handler(wsgiref.simple_server.WSGIRequestHandler):
                     def address_string(self):
@@ -100,8 +96,7 @@ class CtxProxy(object):
                 port=self.port,
                 quiet=True,
                 server=BottleServerAdapter,
-                _session=proxy.ctx.model.log._session,
-                _terminated=self._terminated)
+                _session=proxy.ctx.model.log._session)
         thread = threading.Thread(target=serve)
         thread.daemon = True
         thread.start()
@@ -110,9 +105,6 @@ class CtxProxy(object):
     def close(self):
         if self.server:
             self.server.shutdown()
-            while self._started.not_empty and self._terminated.empty():
-                # wait for the process of shutdown to complete (i.e. the session is terminated)
-                pass
             self.server.server_close()
 
     def _request_handler(self):