def init(self, cfg=None): """ This method will be called twice, once with a cfg parameter and once without """ if cfg is None: HttpServlet.init(self) else: HttpServlet.init(self, cfg) # These are the things we only do once if WMS.timer is None: WMS.timer = Timer(1) # timer is a daemon # Load the Log4j configuration file file = self.getInitParameter("log4j-init-file") if file is not None: prefix = self.getServletContext().getRealPath("/") PropertyConfigurator.configure(prefix + file) WMS.logger.debug("Initialized logging system") # Initialize the cache of datasets DatasetCache.init() WMS.logger.debug("Initialized DatasetCache") # Start a timer that will clear the cache at regular intervals # so that NcML aggregations are reloaded # TODO: get the interval value from a config file intervalInMs = int(60 * 1000) # Runs once a minute WMS.cacheWiper = CacheWiper() WMS.timer.scheduleAtFixedRate(WMS.cacheWiper, intervalInMs, intervalInMs) WMS.logger.debug("Initialized NetcdfDatasetCache refresher") WMS.logger.debug("ncWMS Servlet initialized")
def __init__(self): HttpServlet.__init__(self)