type: Some CheckStyle fix. (#1224)

* fix all OperatorWrap style error. The OperatorWrap style mandates that operator symbols should begin each new line, hence the need for adjusting the formatting.

* fix all ConstantName style error. Constant names are required to be written in uppercase letters and separated by underscores

* fix an SimplifyBooleanReturn error. Because key.indexOf(filters) > -1' can be replaced with 'key.contains(filters)'
pull/1227/head
Xin Chen 2 years ago committed by GitHub
parent d61260419d
commit 706d3b468b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -151,8 +151,8 @@ public class KafkaThreadPoolAdapter implements ThreadPoolAdapter, ApplicationLis
ContainerProperties containerProperties = concurrentContainer.getContainerProperties(); ContainerProperties containerProperties = concurrentContainer.getContainerProperties();
TopicPartitionOffset[] topicPartitions = containerProperties.getTopicPartitions(); TopicPartitionOffset[] topicPartitions = containerProperties.getTopicPartitions();
if (topicPartitions != null && concurrency > topicPartitions.length) { if (topicPartitions != null && concurrency > topicPartitions.length) {
log.warn("[{}] Kafka consuming thread pool not support modify. " + log.warn("[{}] Kafka consuming thread pool not support modify. "
"When specific partitions are provided, the concurrency must be less than or " + "When specific partitions are provided, the concurrency must be less than or "
+ "equal to the number of partitions;", threadPoolKey); + "equal to the number of partitions;", threadPoolKey);
return false; return false;
} }

@ -370,6 +370,7 @@ public class Config {
} }
public static class Apollo { public static class Apollo {
public static class App { public static class App {
public static String ID; public static String ID;

@ -44,9 +44,9 @@ public abstract class AgentConfigChangeWatcher {
@Override @Override
public String toString() { public String toString() {
return "AgentConfigChangeWatcher{" + return "AgentConfigChangeWatcher{"
"propertyKey='" + propertyKey + '\'' + + "propertyKey='" + propertyKey + '\''
'}'; + '}';
} }
@Getter @Getter

@ -33,8 +33,8 @@ public class ReflectUtil {
Field[] fields = clazz.getFields(); Field[] fields = clazz.getFields();
List<Field> result = new ArrayList<>(); List<Field> result = new ArrayList<>();
for (Field field : fields) { for (Field field : fields) {
if (field.getType().isAssignableFrom(declaredType) && if (field.getType().isAssignableFrom(declaredType)
Modifier.isStatic(field.getModifiers())) { && Modifier.isStatic(field.getModifiers())) {
result.add(field); result.add(field);
} }
} }

@ -24,7 +24,6 @@ import java.util.List;
public class ApolloSpringBootProperties { public class ApolloSpringBootProperties {
public static class Spring { public static class Spring {
public static class Dynamic { public static class Dynamic {

@ -50,8 +50,8 @@ public class ExtensionRegisterBootstrap implements ApplicationContextAware, Appl
} }
private boolean filterClass(String beanName, Object bean) { private boolean filterClass(String beanName, Object bean) {
return bean.getClass().isAssignableFrom(IExtension.class) || return bean.getClass().isAssignableFrom(IExtension.class)
ScopedProxyUtils.isScopedTarget(beanName) || || ScopedProxyUtils.isScopedTarget(beanName)
!(bean instanceof IExtension); || !(bean instanceof IExtension);
} }
} }

@ -33,7 +33,7 @@ import java.util.List;
*/ */
public class ExtensionInvoker { public class ExtensionInvoker {
private static final ExtensionRegistry registry = ExtensionRegistry.getInstance(); private static final ExtensionRegistry REGISTRY = ExtensionRegistry.getInstance();
public static <T extends IExtension, E> List<E> reduceExecute(Class<T> targetClz, public static <T extends IExtension, E> List<E> reduceExecute(Class<T> targetClz,
ExtensionCallback<T, E> callback) { ExtensionCallback<T, E> callback) {
@ -47,7 +47,7 @@ public class ExtensionInvoker {
Assert.isTrue(IExtension.class.isAssignableFrom(targetClz), Assert.isTrue(IExtension.class.isAssignableFrom(targetClz),
"can not execute extension point. please implement base extension interface(" + IExtension.class.getName() + ") first."); "can not execute extension point. please implement base extension interface(" + IExtension.class.getName() + ") first.");
List<IExtension> realizations = registry.find(targetClz); List<IExtension> realizations = REGISTRY.find(targetClz);
if (CollectionUtil.isEmpty(realizations)) { if (CollectionUtil.isEmpty(realizations)) {
realizations = new ArrayList<>(ServiceLoaderRegistry.getSingletonServiceInstances(targetClz)); realizations = new ArrayList<>(ServiceLoaderRegistry.getSingletonServiceInstances(targetClz));
} }

@ -74,17 +74,17 @@ public class IdUtil {
long mostSigBits = uuid.getMostSignificantBits(); long mostSigBits = uuid.getMostSignificantBits();
long leastSigBits = uuid.getLeastSignificantBits(); long leastSigBits = uuid.getLeastSignificantBits();
if (isSimple) { if (isSimple) {
return (digits(mostSigBits >> 32, 8) + return (digits(mostSigBits >> 32, 8)
digits(mostSigBits >> 16, 4) + + digits(mostSigBits >> 16, 4)
digits(mostSigBits, 4) + + digits(mostSigBits, 4)
digits(leastSigBits >> 48, 4) + + digits(leastSigBits >> 48, 4)
digits(leastSigBits, 12)); + digits(leastSigBits, 12));
} else { } else {
return (digits(mostSigBits >> 32, 8) + "-" + return (digits(mostSigBits >> 32, 8) + "-"
digits(mostSigBits >> 16, 4) + "-" + + digits(mostSigBits >> 16, 4) + "-"
digits(mostSigBits, 4) + "-" + + digits(mostSigBits, 4) + "-"
digits(leastSigBits >> 48, 4) + "-" + + digits(leastSigBits >> 48, 4) + "-"
digits(leastSigBits, 12)); + digits(leastSigBits, 12));
} }
} }

@ -181,7 +181,7 @@ public class MapUtil {
* @return * @return
*/ */
private static boolean checkKey(String key, String filters) { private static boolean checkKey(String key, String filters) {
if (key.indexOf(filters) > -1) { if (key.contains(filters)) {
return true; return true;
} else { } else {
return false; return false;

@ -299,8 +299,8 @@ public class ReflectUtil {
public static Field findField(Object obj, String filedName, String fieldType) { public static Field findField(Object obj, String filedName, String fieldType) {
Field[] fields = ReflectUtil.getFields(obj.getClass()); Field[] fields = ReflectUtil.getFields(obj.getClass());
for (Field field : fields) { for (Field field : fields) {
if (field.getName().contains(filedName) && if (field.getName().contains(filedName)
(field.getType().getName().contains(fieldType))) { && (field.getType().getName().contains(fieldType))) {
return field; return field;
} }
} }

@ -161,14 +161,14 @@ public abstract class AbstractDynamicExecutorSupport extends ThreadPoolExecutor
try { try {
if (!executor.awaitTermination(this.awaitTerminationMillis, TimeUnit.MILLISECONDS)) { if (!executor.awaitTermination(this.awaitTerminationMillis, TimeUnit.MILLISECONDS)) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("Timed out while waiting for executor" + log.warn("Timed out while waiting for executor"
(this.threadPoolId != null ? " '" + this.threadPoolId + "'" : "") + " to terminate."); + (this.threadPoolId != null ? " '" + this.threadPoolId + "'" : "") + " to terminate.");
} }
} }
} catch (InterruptedException ex) { } catch (InterruptedException ex) {
if (log.isWarnEnabled()) { if (log.isWarnEnabled()) {
log.warn("Interrupted while waiting for executor" + log.warn("Interrupted while waiting for executor"
(this.threadPoolId != null ? " '" + this.threadPoolId + "'" : "") + " to terminate."); + (this.threadPoolId != null ? " '" + this.threadPoolId + "'" : "") + " to terminate.");
} }
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }

@ -58,12 +58,12 @@ public class DynamicThreadPoolBannerHandler implements InitializingBean {
* Print banner. * Print banner.
*/ */
private void printBanner() { private void printBanner() {
String banner = " __ __ ___ ___ __ \n" + String banner = " __ __ ___ ___ __ \n"
" | |--.|__|.-----..-----..-----.| | | |__|\n" + + " | |--.|__|.-----..-----..-----.| | | |__|\n"
" | || || _ || _ || _ || | | | |\n" + + " | || || _ || _ || _ || | | | |\n"
" |__|__||__|| __|| __||_____||____ | | |\n" + + " |__|__||__|| __|| __||_____||____ | | |\n"
" |__| |__| |: ||___|\n" + + " |__| |__| |: ||___|\n"
" `---' \n"; + " `---' \n";
if (Boolean.TRUE.equals(properties.getBanner())) { if (Boolean.TRUE.equals(properties.getBanner())) {
String bannerVersion = StringUtil.isNotEmpty(version) ? " (v" + version + ")" : "no version."; String bannerVersion = StringUtil.isNotEmpty(version) ? " (v" + version + ")" : "no version.";
StringBuilder padding = new StringBuilder(); StringBuilder padding = new StringBuilder();

@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ClassRegistry { public class ClassRegistry {
private static final Map<String, Class<?>> serverRegister = new ConcurrentHashMap<>(); private static final Map<String, Class<?>> SERVER_REGISTER = new ConcurrentHashMap<>();
/** /**
* get a Obj in Registry center <br> * get a Obj in Registry center <br>
@ -40,7 +40,7 @@ public class ClassRegistry {
* @return t element * @return t element
*/ */
public static Class<?> get(String s) { public static Class<?> get(String s) {
return serverRegister.get(s); return SERVER_REGISTER.get(s);
} }
/** /**
@ -53,7 +53,7 @@ public class ClassRegistry {
* @return final mapped value * @return final mapped value
*/ */
public static Class<?> set(String s, Class<?> cls) { public static Class<?> set(String s, Class<?> cls) {
return serverRegister.putIfAbsent(s, cls); return SERVER_REGISTER.putIfAbsent(s, cls);
} }
/** /**
@ -64,13 +64,13 @@ public class ClassRegistry {
* @param cls element * @param cls element
*/ */
public static Class<?> put(String s, Class<?> cls) { public static Class<?> put(String s, Class<?> cls) {
return serverRegister.put(s, cls); return SERVER_REGISTER.put(s, cls);
} }
/** /**
* clear * clear
*/ */
public static void clear() { public static void clear() {
serverRegister.clear(); SERVER_REGISTER.clear();
} }
} }

@ -66,9 +66,9 @@ public interface HandlerManager<T> {
boolean b = cls.isAnnotationPresent(ChannelHandler.Sharable.class) boolean b = cls.isAnnotationPresent(ChannelHandler.Sharable.class)
|| HandlerManager.class.isAssignableFrom(cls); || HandlerManager.class.isAssignableFrom(cls);
if (!b) { if (!b) {
throw new IllegalException("Join the execution of the handler must add io.netty.channel.ChannelHandler." + throw new IllegalException("Join the execution of the handler must add io.netty.channel.ChannelHandler."
"Sharable annotations, Please for the handler class " + cls.getName() + " add io.netty.channel." + + "Sharable annotations, Please for the handler class " + cls.getName() + " add io.netty.channel."
"ChannelHandler.Sharable annotation"); + "ChannelHandler.Sharable annotation");
} }
return new HandlerEntity<>(order, handler, name); return new HandlerEntity<>(order, handler, name);
} }

@ -60,7 +60,7 @@ public final class NettyClientSupport {
/** /**
* the cache for client * the cache for client
*/ */
private static final Map<InetSocketAddress, Client> clientMap = new ConcurrentHashMap<>(); private static final Map<InetSocketAddress, Client> CLIENT_MAP = new ConcurrentHashMap<>();
/** /**
* Obtain the client connected to the server through the server address. If the client does not exist, create one * Obtain the client connected to the server through the server address. If the client does not exist, create one
@ -70,7 +70,7 @@ public final class NettyClientSupport {
* @return Client * @return Client
*/ */
public static Client getClient(InetSocketAddress address, HandlerManager<ChannelHandler> handlerManager) { public static Client getClient(InetSocketAddress address, HandlerManager<ChannelHandler> handlerManager) {
return clientMap.computeIfAbsent(address, a -> { return CLIENT_MAP.computeIfAbsent(address, a -> {
NettyClientPoolHandler handler = (handlerManager instanceof NettyClientPoolHandler) NettyClientPoolHandler handler = (handlerManager instanceof NettyClientPoolHandler)
? (NettyClientPoolHandler) handlerManager ? (NettyClientPoolHandler) handlerManager
: new NettyClientPoolHandler(); : new NettyClientPoolHandler();
@ -98,7 +98,7 @@ public final class NettyClientSupport {
* @param address the address * @param address the address
*/ */
public static void closeClient(InetSocketAddress address) { public static void closeClient(InetSocketAddress address) {
Client client = clientMap.remove(address); Client client = CLIENT_MAP.remove(address);
Optional.ofNullable(client) Optional.ofNullable(client)
.ifPresent(c -> { .ifPresent(c -> {
try { try {

@ -38,8 +38,8 @@ import java.util.concurrent.locks.LockSupport;
@NoArgsConstructor(access = AccessLevel.PRIVATE) @NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ResultHolder { public class ResultHolder {
private static final Map<String, Object> map = new ConcurrentHashMap<>(); private static final Map<String, Object> MAP = new ConcurrentHashMap<>();
private static final Map<String, Thread> threadMap = new HashMap<>(); private static final Map<String, Thread> THREAD_MAP = new HashMap<>();
/** /**
* Writes when the client receives a response * Writes when the client receives a response
@ -51,7 +51,7 @@ public class ResultHolder {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Write the result, wake up the thread"); log.debug("Write the result, wake up the thread");
} }
map.put(key, o); MAP.put(key, o);
} }
/** /**
@ -64,7 +64,7 @@ public class ResultHolder {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Write thread, waiting to wake up"); log.debug("Write thread, waiting to wake up");
} }
threadMap.put(key, t); THREAD_MAP.put(key, t);
} }
/** /**
@ -76,7 +76,7 @@ public class ResultHolder {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("The future has been fetched, wake up the thread"); log.debug("The future has been fetched, wake up the thread");
} }
Thread thread = threadMap.remove(key); Thread thread = THREAD_MAP.remove(key);
LockSupport.unpark(thread); LockSupport.unpark(thread);
} }
@ -93,7 +93,7 @@ public class ResultHolder {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Get the future"); log.debug("Get the future");
} }
return (T) map.remove(key); return (T) MAP.remove(key);
} }
} }

@ -39,13 +39,13 @@ public interface HisRunDataMapper extends BaseMapper<HisRunDataInfo> {
* @param endTime * @param endTime
* @return * @return
*/ */
@Select("SELECT " + @Select("SELECT "
"tenant_id, item_id, tp_id, max(completed_task_count) as max_completed_task_count " + + "tenant_id, item_id, tp_id, max(completed_task_count) as max_completed_task_count "
"FROM his_run_data " + + "FROM his_run_data "
"where timestamp between #{startTime} and #{endTime} " + + "where timestamp between #{startTime} and #{endTime} "
"group by tenant_id, item_id, tp_id " + + "group by tenant_id, item_id, tp_id "
"order by max_completed_task_count desc " + + "order by max_completed_task_count desc "
"limit 8") + "limit 8")
List<ThreadPoolTaskRanking> queryThreadPoolTaskSumRanking(@Param("startTime") Long startTime, @Param("endTime") Long endTime); List<ThreadPoolTaskRanking> queryThreadPoolTaskSumRanking(@Param("startTime") Long startTime, @Param("endTime") Long endTime);
/** /**
@ -55,13 +55,13 @@ public interface HisRunDataMapper extends BaseMapper<HisRunDataInfo> {
* @param endTime * @param endTime
* @return * @return
*/ */
@Select("SELECT " + @Select("SELECT "
"tenant_id, item_id, tp_id, max(queue_size) as max_queue_size, max(reject_count) as max_reject_count, max(completed_task_count) as max_completed_task_count " + + "tenant_id, item_id, tp_id, max(queue_size) as max_queue_size, max(reject_count) as max_reject_count, max(completed_task_count) as max_completed_task_count "
"FROM his_run_data " + + "FROM his_run_data "
"where timestamp between #{startTime} and #{endTime} " + + "where timestamp between #{startTime} and #{endTime} "
"group by tenant_id, item_id, tp_id " + + "group by tenant_id, item_id, tp_id "
"order by max_completed_task_count desc " + + "order by max_completed_task_count desc "
"limit 4") + "limit 4")
List<ThreadPoolTaskRanking> queryThreadPoolMaxRanking(@Param("startTime") Long startTime, @Param("endTime") Long endTime); List<ThreadPoolTaskRanking> queryThreadPoolMaxRanking(@Param("startTime") Long startTime, @Param("endTime") Long endTime);
@Data @Data

Loading…
Cancel
Save