`

java.lang.IllegalArgumentException: Non-positive period.

 
阅读更多

在项目中用到了TimerTask时间调度器,如果调度间隔时间min 为0的时候,则会发生错误,必须要设置大于0 的数。

 

timer = new Timer();
final long min = configListenerTime*60*1000;
timer.schedule(new MQConnectionTimerTask(), min, min);

 

解决方案:

min 的值 确保大于0;

 

错误信息:

严重: Exception sending context initialized event to listener instance of class com.queuemanagerlistener.listener.MQConnectionStatusListener
java.lang.IllegalArgumentException: Non-positive period.
 at java.util.Timer.schedule(Timer.java:221)
 at ngbss.iac.queuemanagerlistener.listener.MQConnectionStatusListener.contextInitialized(MQConnectionStatusListener.java:72)
 at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics