概述
guice的异常我觉得很烂,居然把我的异常吃掉了没有打印出来。
@Singleton
public class ProxyRoutineInit {
private final ScheduledExecutorService scheduler =
Executors.newScheduledThreadPool(2, new NamedThreadFactory("ProxyRoutineInit"));
@Inject
private SupplierManager supplierManager;
@Inject
@Named("config.log.base.path")
private String logBasePath;
@Inject
public void onInject() {
scheduler.scheduleWithFixedDelay(new LogCleanTask(logBasePath), 3, 0, TimeUnit.HOURS);
scheduler.scheduleWithFixedDelay(new FeedStatusResetTask(supplierManager), 10, 10, TimeUnit.SECONDS);
}
}
2014-04-21 17:25:31.275:WARN::Failed startup of context org.mortbay.jetty.webapp.WebAppContext@54e0d16b{/,/duitang/dist/app/branches/tlog2/tlog-proxy/src/main/webapp}
com.google.inject.CreationException: Guice creation errors:||1) Error injecting method, java.lang.IllegalArgumentException| at com.taobao.tlog.module.ProxyRoutineInit.onInject(ProxyRoutineInit.java:35)| at com.taobao.tlog.module.TLogProxyModule.configure(TLogProxyModule.java:18)||1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:175)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.taobao.tlog.runtime.TLogBootstrap.startRuntime(TLogBootstrap.java:113)
at com.taobao.tlog.module.TLogProxyConfig.getInjector(TLogProxyConfig.java:48)
at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:549)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at runjettyrun.Bootstrap.main(Bootstrap.java:97)
2014-04-21 17:25:31.287:INFO::Started SelectChannelConnector@0.0.0.0:10009
PS:
好吧,不是guice的问题,是ScheduledThreadPoolExecutor太坑爹了。
public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command,
long initialDelay,
long delay,
TimeUnit unit) {
if (command == null || unit == null)
throw new NullPointerException();
if (delay <= 0)
throw new IllegalArgumentException();
RunnableScheduledFuture<?> t = decorateTask(command,
new ScheduledFutureTask<Boolean>(command,
null,
triggerTime(initialDelay, unit),
unit.toNanos(-delay)));
delayedExecute(t);
return t;
}
最后
以上就是殷勤黑裤为你收集整理的说说guice的异常的全部内容,希望文章能够帮你解决说说guice的异常所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复