(no commit message)
[utils] / mythtv / src / main / java / org / wamblee / mythtv / Application.java
index d2135639c7df9df72152cdca0c39fb085ab26782..01d030262d5bb1791e8d2865b4ebde4c42e7b084 100644 (file)
@@ -12,7 +12,7 @@
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
- */ 
+ */
 
 package org.wamblee.mythtv;
 
@@ -21,27 +21,42 @@ import javax.servlet.ServletContextListener;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.quartz.SchedulerException;
 import org.wamblee.general.BeanKernel;
 
 /**
- *
+ * f
  */
 public class Application implements ServletContextListener {
     private static final Log LOG = LogFactory.getLog(Application.class);
-    
-    /* (non-Javadoc)
+
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
      */
     public void contextInitialized(ServletContextEvent arg0) {
-        LOG.info("initializing");   
-        BeanKernel.getBeanFactory();
+        LOG.info("initializing");
+        try {
+            BeanKernel.getBeanFactory().find(MonitorScheduler.class)
+                    .initialize();
+        } catch (SchedulerException e) {
+            LOG.error("Error starting scheduler", e);
+        }
     }
 
-
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
+     * 
      * @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
      */
     public void contextDestroyed(ServletContextEvent arg0) {
         LOG.info("terminating");
+        try {
+            BeanKernel.getBeanFactory().find(MonitorScheduler.class)
+                    .shutdown();
+        } catch (SchedulerException e) {
+            LOG.error("Error stopping scheduler", e);
+        }
     }
 }