正确处理InterruptException

Sonar-2142: "InterruptedException" should not be ignored
This commit is contained in:
Binary Wang
2018-11-24 21:20:59 +08:00
parent 9ed9c2a58c
commit 856b021d2c
7 changed files with 60 additions and 43 deletions

View File

@@ -76,7 +76,7 @@ public class WxMessageInMemoryDuplicateChecker implements WxMessageDuplicateChec
}
}
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
}
}
});

View File

@@ -196,6 +196,7 @@ public class StandardSessionManager implements WxSessionManager, InternalSession
Thread.sleep(StandardSessionManager.this.backgroundProcessorDelay * 1000L);
backgroundProcess();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
StandardSessionManager.this.log.error("SessionManagerImpl.backgroundProcess error", e);
}
}

View File

@@ -1,5 +1,9 @@
package me.chanjar.weixin.common.util.http.apache;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.annotation.NotThreadSafe;
@@ -25,10 +29,6 @@ import org.apache.http.protocol.HttpContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* httpclient 连接管理器 自带DNS解析.
* <p>大部分代码拷贝自DefaultApacheHttpClientBuilder</p>
@@ -292,6 +292,7 @@ public class ApacheHttpDnsClientBuilder implements ApacheHttpClientBuilder {
}
}
} catch (InterruptedException ignore) {
Thread.currentThread().interrupt();
}
}