Skip to content

Commit

Permalink
🎨 实例属性需通过 this 进行调用
Browse files Browse the repository at this point in the history
  • Loading branch information
Hccake committed Jan 22, 2024
1 parent 6d65c6d commit 68a80ad
Show file tree
Hide file tree
Showing 231 changed files with 1,148 additions and 1,121 deletions.
44 changes: 22 additions & 22 deletions .etc/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,28 @@
<module name="com.puppycrawl.tools.checkstyle.checks.design.OneTopLevelClassCheck" />

<!-- Coding -->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.CovariantEqualsCheck" />-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck" />-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheck" />-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck" />-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanExpressionCheck" />-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanReturnCheck" />-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.StringLiteralEqualityCheck" />-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck">-->
<!-- <property name="max" value="3" />-->
<!-- </module>-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.NestedIfDepthCheck">-->
<!-- <property name="max" value="3" />-->
<!-- </module>-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.NestedTryDepthCheck">-->
<!-- <property name="max" value="3" />-->
<!-- </module>-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.MultipleVariableDeclarationsCheck" />-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck">-->
<!-- <property name="checkMethods" value="false" />-->
<!-- <property name="validateOnlyOverlapping" value="false" />-->
<!-- </module>-->
<!-- <module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck" />-->
<module name="com.puppycrawl.tools.checkstyle.checks.coding.CovariantEqualsCheck" />
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EmptyStatementCheck" />
<module name="com.puppycrawl.tools.checkstyle.checks.coding.EqualsHashCodeCheck" />
<module name="com.puppycrawl.tools.checkstyle.checks.coding.InnerAssignmentCheck" />
<module name="com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanExpressionCheck" />
<module name="com.puppycrawl.tools.checkstyle.checks.coding.SimplifyBooleanReturnCheck" />
<module name="com.puppycrawl.tools.checkstyle.checks.coding.StringLiteralEqualityCheck" />
<module name="com.puppycrawl.tools.checkstyle.checks.coding.NestedForDepthCheck">
<property name="max" value="3" />
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.NestedIfDepthCheck">
<property name="max" value="3" />
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.NestedTryDepthCheck">
<property name="max" value="3" />
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.MultipleVariableDeclarationsCheck" />
<module name="com.puppycrawl.tools.checkstyle.checks.coding.RequireThisCheck">
<property name="checkMethods" value="false" />
<property name="validateOnlyOverlapping" value="false" />
</module>
<module name="com.puppycrawl.tools.checkstyle.checks.coding.OneStatementPerLineCheck" />

<!-- Imports -->
<module name="com.puppycrawl.tools.checkstyle.checks.imports.AvoidStarImportCheck" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public enum BooleanEnum {
private final Integer intValue;

public Boolean booleanValue() {
return booleanValue;
return this.booleanValue;
}

public Integer intValue() {
return intValue;
return this.intValue;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -59,52 +59,52 @@ public CompatibleSSLFactory(String protocol, KeyManager[] keyManagers, TrustMana

@Override
public String[] getDefaultCipherSuites() {
return factory.getDefaultCipherSuites();
return this.factory.getDefaultCipherSuites();
}

@Override
public String[] getSupportedCipherSuites() {
return factory.getSupportedCipherSuites();
return this.factory.getSupportedCipherSuites();
}

@Override
public Socket createSocket() throws IOException {
return enabledProtocols(factory.createSocket());
return enabledProtocols(this.factory.createSocket());
}

@Override
public Socket createSocket(Socket socket, InputStream inputStream, boolean b) throws IOException {
return enabledProtocols(factory.createSocket(socket, inputStream, b));
return enabledProtocols(this.factory.createSocket(socket, inputStream, b));
}

@Override
public Socket createSocket(Socket socket, String s, int i, boolean b) throws IOException {
return enabledProtocols(factory.createSocket(socket, s, i, b));
return enabledProtocols(this.factory.createSocket(socket, s, i, b));
}

@Override
public Socket createSocket(String s, int i) throws IOException {
return enabledProtocols(factory.createSocket(s, i));
return enabledProtocols(this.factory.createSocket(s, i));
}

@Override
public Socket createSocket(String s, int i, InetAddress inetAddress, int i1) throws IOException {
return enabledProtocols(factory.createSocket(s, i, inetAddress, i1));
return enabledProtocols(this.factory.createSocket(s, i, inetAddress, i1));
}

@Override
public Socket createSocket(InetAddress inetAddress, int i) throws IOException {
return enabledProtocols(factory.createSocket(inetAddress, i));
return enabledProtocols(this.factory.createSocket(inetAddress, i));
}

@Override
public Socket createSocket(InetAddress inetAddress, int i, InetAddress inetAddress1, int i1) throws IOException {
return enabledProtocols(factory.createSocket(inetAddress, i, inetAddress1, i1));
return enabledProtocols(this.factory.createSocket(inetAddress, i, inetAddress1, i1));
}

private Socket enabledProtocols(Socket socket) {
if (!ArrayUtils.isEmpty(protocols) && socket instanceof SSLSocket) {
((SSLSocket) socket).setEnabledProtocols(protocols);
if (!ArrayUtils.isEmpty(this.protocols) && socket instanceof SSLSocket) {
((SSLSocket) socket).setEnabledProtocols(this.protocols);
}
return socket;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public String getParameter(String name) {

@Override
public Enumeration<String> getParameterNames() {
return Collections.enumeration(parameterMap.keySet());
return Collections.enumeration(this.parameterMap.keySet());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,13 @@ public RepeatBodyRequestWrapper(HttpServletRequest request) {

@Override
public BufferedReader getReader() {
return ObjectUtils.isEmpty(bodyByteArray) ? null : new BufferedReader(new InputStreamReader(getInputStream()));
return ObjectUtils.isEmpty(this.bodyByteArray) ? null
: new BufferedReader(new InputStreamReader(getInputStream()));
}

@Override
public ServletInputStream getInputStream() {
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bodyByteArray);
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(this.bodyByteArray);
return new ServletInputStream() {
@Override
public boolean isFinished() {
Expand All @@ -81,7 +82,7 @@ public int read() {
}

public byte[] getBodyByteArray() {
return bodyByteArray;
return this.bodyByteArray;
}

private static byte[] getByteBody(HttpServletRequest request) {
Expand All @@ -102,7 +103,7 @@ private static byte[] getByteBody(HttpServletRequest request) {
*/
@Override
public Map<String, String[]> getParameterMap() {
return parameterMap;
return this.parameterMap;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ public abstract class AbstractBlockingQueueThread<T> extends AbstractQueueThread
public void put(T t) {
if (t != null) {
try {
queue.put(t);
this.queue.put(t);
}
catch (InterruptedException e) {
currentThread().interrupt();
}
catch (Exception e) {
log.error("{} put Object error, param: {}", this.getClass().toString(), t, e);
this.log.error("{} put Object error, param: {}", this.getClass().toString(), t, e);
}
}
}

@Override
protected T poll(long time) throws InterruptedException {
return queue.poll(time, TimeUnit.MILLISECONDS);
return this.queue.poll(time, TimeUnit.MILLISECONDS);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ public void put(T t) {
}

try {
lock.runByInterruptibly(() -> {
queue.add(t);
lock.signalAll();
this.lock.runByInterruptibly(() -> {
this.queue.add(t);
this.lock.signalAll();
});
}
catch (InterruptedException e) {
interrupt();
}
catch (Exception e) {
log.error("{} put error, param: {}", this.getClass().toString(), t, e);
this.log.error("{} put error, param: {}", this.getClass().toString(), t, e);
}
}

Expand All @@ -80,17 +80,17 @@ public void run() {
while (isRun()) {
try {
T t = pool();
lock.runByInterruptibly(() -> {
this.lock.runByInterruptibly(() -> {
if (t == null) {
lock.await(24, TimeUnit.HOURS);
this.lock.await(24, TimeUnit.HOURS);
return;
}

long sleepTime = sleepTime(t);
// 需要休眠
if (sleepTime > 0) {
// 如果是被唤醒
if (lock.await(sleepTime, TimeUnit.MILLISECONDS)) {
if (this.lock.await(sleepTime, TimeUnit.MILLISECONDS)) {
replay(t);
return;
}
Expand All @@ -111,17 +111,17 @@ public void run() {
}

protected T pool() {
return queue.poll();
return this.queue.poll();
}

protected abstract void process(T t);

protected void error(Exception e) {
log.error("类: {}; 线程: {}; 运行异常! ", getSimpleName(), getId(), e);
this.log.error("类: {}; 线程: {}; 运行异常! ", getSimpleName(), getId(), e);
}

protected void shutdown() {
log.warn("类: {}; 线程: {}; 被中断! 剩余数据: {}", getSimpleName(), getId(), queue.size());
this.log.warn("类: {}; 线程: {}; 被中断! 剩余数据: {}", getSimpleName(), getId(), this.queue.size());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void run() {
}
// Throwable 异常直接结束. 这里捕获用来保留信息. 方便排查问题
catch (Throwable t) {
log.error("线程队列运行异常!", t);
this.log.error("线程队列运行异常!", t);
throw t;
}
}
Expand Down Expand Up @@ -170,7 +170,7 @@ public E poll() {
e = poll(getPollTimeout());
}
catch (InterruptedException ex) {
log.error("{} 类的poll线程被中断!id: {}", getClass().getSimpleName(), getId());
this.log.error("{} 类的poll线程被中断!id: {}", getClass().getSimpleName(), getId());
interrupt();
}
return e;
Expand All @@ -188,7 +188,7 @@ public E poll() {
* @param list 当前数据
*/
protected void shutdown(List<E> list) {
log.warn("{} 线程: {} 被关闭. 数据:{}", this.getClass().getSimpleName(), getId(), list);
this.log.warn("{} 线程: {} 被关闭. 数据:{}", this.getClass().getSimpleName(), getId(), list);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void onApplicationStart() {

@Override
public void onApplicationStop() {
log.warn("{} 线程: {}; 开始关闭!", getClass().getSimpleName(), getId());
this.log.warn("{} 线程: {}; 开始关闭!", getClass().getSimpleName(), getId());
interrupt();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public long getTimeout() {
* 线程被中断触发.
*/
protected void shutdown() {
log.warn("{} 类 线程: {} 被中断!", getClass().getSimpleName(), getId());
this.log.warn("{} 类 线程: {} 被中断!", getClass().getSimpleName(), getId());
}

protected void error(Exception e) {
log.error("{} 类 线程: {} 出现异常!", getClass().getSimpleName(), getId(), e);
this.log.error("{} 类 线程: {} 出现异常!", getClass().getSimpleName(), getId(), e);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public class EnumValueValidatorOfClass implements ConstraintValidator<OneOfClass

@Override
public void initialize(OneOfClasses constraintAnnotation) {
classList = constraintAnnotation.value();
allowNull = constraintAnnotation.allowNull();
this.classList = constraintAnnotation.value();
this.allowNull = constraintAnnotation.allowNull();
}

@Override
public boolean isValid(Class value, ConstraintValidatorContext context) {
if (value == null) {
return allowNull;
return this.allowNull;
}
for (Class<?> clazz : classList) {
for (Class<?> clazz : this.classList) {
if (clazz.isAssignableFrom(value)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public class EnumValueValidatorOfInt implements ConstraintValidator<OneOfInts, I

@Override
public void initialize(OneOfInts constraintAnnotation) {
ints = constraintAnnotation.value();
allowNull = constraintAnnotation.allowNull();
this.ints = constraintAnnotation.value();
this.allowNull = constraintAnnotation.allowNull();
}

@Override
public boolean isValid(Integer value, ConstraintValidatorContext context) {
if (value == null) {
return allowNull;
return this.allowNull;
}
for (int anInt : ints) {
for (int anInt : this.ints) {
if (anInt == value) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ public class EnumValueValidatorOfString implements ConstraintValidator<OneOfStri

@Override
public void initialize(OneOfStrings constraintAnnotation) {
stringList = constraintAnnotation.value();
allowNull = constraintAnnotation.allowNull();
this.stringList = constraintAnnotation.value();
this.allowNull = constraintAnnotation.allowNull();
}

@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
if (value == null) {
return allowNull;
return this.allowNull;
}
for (String strValue : stringList) {
for (String strValue : this.stringList) {
if (strValue.equals(value)) {
return true;
}
Expand Down
Loading

0 comments on commit 68a80ad

Please sign in to comment.