9be94352be4855eeaaa916cb1dca0503aaf8a91b.svn-base 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.yihu.platform.listener;
  2. import javax.servlet.ServletContextEvent;
  3. import javax.servlet.ServletContextListener;
  4. import com.coreframework.remoting.Server;
  5. import com.coreframework.util.PropUtils;
  6. import com.yihu.monitor.sdk.MonitorClient;
  7. import com.yihu.platform.cache.DBCache;
  8. import com.yihu.platform.utils.ConfigUtil;
  9. import com.yihu.platform.utils.Constant;
  10. import com.yihu.wsgw.api.AsyncBus;
  11. /**
  12. * 监听器 用于全局数据加载
  13. *
  14. */
  15. public class ContextLoaderListener implements ServletContextListener {
  16. /**
  17. * Default constructor.
  18. */
  19. public ContextLoaderListener() {
  20. // TODO Auto-generated constructor stub
  21. }
  22. /**
  23. * @see ServletContextListener#contextInitialized(ServletContextEvent)
  24. */
  25. public void contextInitialized(ServletContextEvent servletcontextevent) {
  26. // 初使化配置
  27. try {
  28. int port = ConfigUtil.getInstance().getPort();
  29. if (port != 0) {
  30. Server server = Server.getInstance(port);
  31. server.start();
  32. }
  33. DBCache.initCacheByDB() ;
  34. } catch (Exception e) {
  35. // TODO Auto-generated catch block
  36. e.printStackTrace();
  37. }
  38. }
  39. /**
  40. * @see ServletContextListener#contextDestroyed(ServletContextEvent)
  41. */
  42. public void contextDestroyed(ServletContextEvent servletcontextevent) {
  43. // TODO Auto-generated method stub
  44. }
  45. }