Esempio n. 1
0
    def shutdown(self):
        logger = get_logger()
        logger.info('TEAL({0}) shutting down'.format(id(self)))
        
        if (not self.data_only):
            if registry.get_service(SERVICE_SHUTDOWN_MODE) == SHUTDOWN_MODE_IMMEDIATE:
                get_logger().info('Immediate shutdown initiated.  Exceptions from threads that could not be quickly shutdown may occur')
            
            # Cleanup the monitor which will start the rest of the pipeline to shutdown
            monitor = registry.get_service(SERVICE_EVENT_MONITOR)
            if monitor is not None:
                monitor.shutdown()
                
            # Cleanup the processing pipeline from front to back
            event_q = registry.get_service(SERVICE_EVENT_Q)
            if event_q is not None:
                event_q.shutdown()
        
            aa_q = registry.get_service(SERVICE_ALERT_ANALYZER_Q)
            if aa_q is not None:
                aa_q.shutdown()
        
            ad_q = registry.get_service(SERVICE_ALERT_DELIVERY_Q)
            if ad_q is not None:
                ad_q.shutdown()
        
        # Cleanup the Metadata Services
        pass # Nothing to do at this time
    
        # Cleanup the Location Service
        pass # Nothing to do at this time

        # Cleanup the Configuration Service
        pass # Nothing to do at this time
        
        # Cleanup the environment
        pass # Nothing to do at this time
    
        # Cleanup persistance services
        c_mgr = registry.get_service(SERVICE_CHECKPOINT_MGR)
        if c_mgr is not None:
            c_mgr.shutdown()
        alert_mgr = registry.get_service(SERVICE_ALERT_MGR)
        if alert_mgr is not None:
            alert_mgr.shutdown()
    
        # Cleanup the registry       
        registry.clear()

        # Clean up the log service 
        # NOTE: out-of-order from construction so final goodbye can be logged
        logger.info('TEAL({0}) shutdown complete'.format(id(self)))        
Esempio n. 2
0
 def init_reg_service(self):
     """ Initialize the registry service
     """
     registry.clear()