| | |
| | | package com.whyc.task; |
| | | |
| | | import com.whyc.util.ActionUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.servlet.ServletContext; |
| | | import java.util.Enumeration; |
| | | import java.util.TimerTask; |
| | |
| | | /** |
| | | * 防重放功能随机码清除 |
| | | */ |
| | | @Component |
| | | public class PreventTryTask extends TimerTask { |
| | | |
| | | @Autowired |
| | | private ServletContext servletContext; |
| | | |
| | | public PreventTryTask(ServletContext servletContext) { |
| | | this.servletContext = servletContext; |
| | | } |
| | | |
| | | @Override |
| | | public void run() { |
| | | |
| | | //servletContext = ActionUtil.getApplication(); |
| | | //60秒前的记录,内存中application移除 |
| | | Enumeration<String> attributeNames = servletContext.getAttributeNames(); |
| | | long oneMinuteBefore = System.currentTimeMillis()-70*1000; |