Commit e339a7e8 authored by fangxinjiang's avatar fangxinjiang

附件上传限流-fxj

parent 61c672a0
......@@ -258,9 +258,8 @@ public class FileUploadServiceImpl implements FileUploadService {
}
public R getR(MultipartFile file, String filePath, Integer type, String domain, String uploadType) {
if (atomicInteger.intValue() < maxLimit){
if (atomicInteger.incrementAndGet() <= maxLimit){
try {
atomicInteger.incrementAndGet();
Thread.sleep(1000);
log.error("atomicInteger+1:"+atomicInteger.intValue());
if (CommonConstants.ZERO_STRING.equals(uploadType)){
......@@ -275,7 +274,9 @@ public class FileUploadServiceImpl implements FileUploadService {
log.error("atomicInteger-1:"+atomicInteger.intValue());
}
}else {
log.error(ResultConstants.FILE_UPLOADING_DATA);
atomicInteger.decrementAndGet();
log.error("atomicInteger超出阈值-1:"+atomicInteger.intValue());
log.error("超出阈值:"+ResultConstants.FILE_UPLOADING_DATA);
return R.failed(ResultConstants.FILE_UPLOADING_DATA);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment