本文介绍了java.util.Timer:它已被弃用了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在评论中读到了关于调度(抱歉,没有引用)的其他问题,不推荐使用 java.util.Timer 。我真的希望不要因为我使用它作为在Java中安排事物的轻松方式(并且它工作得很好)。但如果它被弃用了,我会去别处看看。 但是,快速查看不会不要说它被弃用了。在Sun的。

I read in a comment to this answer and in many other questions about scheduling (sorry, no references) that java.util.Timer is deprecated. I really hope not since I'm using it as the light way to schedule things in Java (and it works nicely). But if it's deprecated, I'll look elsewhere. However, a quick look at the API docs for 1.6 doesn't say anything about it being deprecated. It's not even mentioned in Sun's Deprecated List.

是否正式弃用如果是这样,我应该使用什么相反?

Is it officially deprecated and if so, what should I use instead?

另一方面,如果是没有弃用,人们可以停止对这个无辜且精彩实施的set-o-classes进行诋毁吗?

On the other hand, if it's not deprecated, could people stop badmouthing this innocent and brilliantly-implemented set-o-classes?

推荐答案

2016年年中,声明 java.util。计时器(以及 TimerTask )将在JDK 9中弃用。

There is [JDK-8154799] deprecate Timer and TimerTask in the JDK’s bug tracker and in mid-2016 JEP 277 stated that java.util.Timer (and TimerTask) would be deprecated in JDK 9.

[...]


  • add @Deprecated到 java.util.Timer TimerTask

  • add @Deprecated to java.util.Timer and TimerTask

但是,在JDK 9发行版中,不推荐使用这些类(不推荐使用的类可以在)。

However, in the JDK 9 release, those classes are not deprecated (deprecated classes can be found in the Deprecated List).

这篇关于java.util.Timer:它已被弃用了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 13:42