我使用@Scheduled编写了一个作业来记录一些东西,所以我在applicationContext.xml中添加了task:注解驱动。
ActivityCacheJob.java:
@Component
public class ActivityCacheJob {
@Scheduled(cron = "0 * * * * ?")
public void getActivityCacheStatus() {
//dosomething
}
}applicationContext.xml:
<task:annotation-driven />部署后,我发现年轻的gc时间从每分钟3次增加到15次。
然后,我删除了作业,但仍然添加了任务: applicationContext.xml.This中注释驱动的问题仍然存在。
ActivityCacheJob.java:
//@Component
public class ActivityCacheJob {
//@Scheduled(cron = "0 * * * * ?")
public void getActivityCacheStatus() {
//dosomething
}
}applicationContext.xml:
<task:annotation-driven />所以,我去掉了task:注解驱动,使用xml,这个问题就不存在了。
applicationContext.xml:
<task:scheduled-tasks>
<task:scheduled ref="activityCacheJob" method="getActivityCacheStatus" cron="0 * * * * ?"/>
</task:scheduled-tasks>spring版本:3.1.1.RELEASE
我的问题是,为什么任务:注释驱动让年轻的gc崛起?
发布于 2016-04-08 16:59:23
我将spring版本从3.1.1.RELEASE更新到3.2.2.RELEASE。这个问题被修复了。
https://stackoverflow.com/questions/36473150
复制相似问题