[REF] netrpc: removed.
[odoo/odoo.git] / openerp / service / __init__.py
index c714c01..9f92134 100644 (file)
@@ -28,16 +28,16 @@ import sys
 import threading
 import time
 
-import netrpc_server
+import cron
 import web_services
+import web_services
+import wsgi_server
 
-import openerp.cron
 import openerp.modules
 import openerp.netsvc
 import openerp.osv
 from openerp.release import nt_service_name
 import openerp.tools
-import openerp.service.wsgi_server
 
 #.apidoc title: RPC Services
 
@@ -73,37 +73,27 @@ def start_internal():
         return
     openerp.netsvc.init_logger()
     openerp.modules.loading.open_openerp_namespace()
-    # Instantiate local services (this is a legacy design).
-    openerp.osv.osv.start_object_proxy()
+
     # Export (for RPC) services.
-    web_services.start_web_services()
+    web_services.start_service()
+
     load_server_wide_modules()
     start_internal_done = True
 
 def start_services():
-    """ Start all services including http, netrpc and cron """
+    """ Start all services including http, and cron """
     start_internal()
-
-    # Initialize the HTTP stack.
-    netrpc_server.init_servers()
-
-    # Start the main cron thread.
-    if openerp.conf.max_cron_threads:
-        openerp.cron.start_master_thread()
-
-    # Start the top-level servers threads (normally HTTP, HTTPS, and NETRPC).
-    openerp.netsvc.Server.startAll()
-
     # Start the WSGI server.
-    openerp.service.wsgi_server.start_server()
+    wsgi_server.start_service()
+    # Start the main cron thread.
+    cron.start_service()
 
 def stop_services():
     """ Stop all services. """
-    # stop scheduling new jobs; we will have to wait for the jobs to complete below
-    openerp.cron.cancel_all()
+    # stop services
+    cron.stop_service()
+    wsgi_server.stop_service()
 
-    openerp.netsvc.Server.quitAll()
-    openerp.service.wsgi_server.stop_server()
     _logger.info("Initiating shutdown")
     _logger.info("Hit CTRL-C again or send a second signal to force the shutdown.")
 
@@ -134,7 +124,7 @@ def start_services_workers():
 def _reexec():
     """reexecute openerp-server process with (nearly) the same arguments"""
     if openerp.tools.osutil.is_running_as_nt_service():
-        subprocess.call('sc stop {0} && sc start {0}'.format(nt_service_name), shell=True)
+        subprocess.call('net stop {0} && net start {0}'.format(nt_service_name), shell=True)
     exe = os.path.basename(sys.executable)
     strip_args = ['-d', '-u']
     a = sys.argv[:]