赞
踩
2015-3-20 15:22:39 org.apache.catalina.core.StandardContext listenerStart严重: Exception sending context initialized event to listener instance of classcom.***.***.action.GateWayMonitorListenerjava.util.concurrent.RejectedExecutionException at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1774) at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:768) at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:215) at java.util.concurrent.ScheduledThreadPoolExecutor.scheduleWithFixedDelay(ScheduledThreadPoolExecutor.java:443) at com.***.***.action.GateWayMonitorListener.scheduleEmailAndSms(GateWayMonitorListener.java:77) at com.***.***.action.GateWayMonitorListener.contextInitialized(GateWayMonitorListener.java:67) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065) at org.apache.catalina.core.StandardHost.start(StandardHost.java:840) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463) at org.apache.catalina.core.StandardService.start(StandardService.java:525) at org.apache.catalina.core.StandardServer.start(StandardServer.java:754) at org.apache.catalina.startup.Catalina.start(Catalina.java:595) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)2015-3-20 15:22:39 org.apache.catalina.core.StandardContext start严重: Error listenerStart
public class GateWayMonitorListener implements ServletContextListener, ApplicationContextAware{ /** * 设定两个线程,一个用来定期发送巡检短信;另一个定期执行三大运营商网关监控。 */ public static ScheduledExecutorService service = Executors.newScheduledThreadPool(2); public void contextInitialized(ServletContextEvent event) { // 网关监测 GateWayMonitorListener.service.scheduleWithFixedDelay(new MonitorTask(), 60, MonitorConfigCache.lastPollingIntervalSecond, TimeUnit.SECONDS); // 定时每天固定时间发送短信 GateWayMonitorListener.service.scheduleAtFixedRate(new EveryDaySmsTask(), calculateIntialDelay(), GateWayMonitorListener.ONE_DAY_IN_MILLISECONDS, TimeUnit.MILLISECONDS); }}/** * 按新时间间隔重新设置定时任务。 * * @param interval */ public static synchronized void resetMonitorTaskInterval() { // 关闭老的线程池 GateWayMonitorListener.service.shutdownNow(); try { GateWayMonitorListener.service.awaitTermination(60, TimeUnit.SECONDS); } catch (InterruptedException e) { log.warn("InterruptedException when shutdown old threadPool", e); } catch (Exception e) { log.error("other exception when shutdown old threadPool", e); } GateWayMonitorListener.service = Executors.newScheduledThreadPool(2); // 重新设置定时任务。 … }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。