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();
TopicPartitionOffset[] topicPartitions = containerProperties.getTopicPartitions();
if (topicPartitions != null && concurrency > topicPartitions.length) {
log.warn("[{}] Kafka consuming thread pool not support modify. " +
"When specific partitions are provided, the concurrency must be less than or "
log.warn("[{}] Kafka consuming thread pool not support modify. "
+ "When specific partitions are provided, the concurrency must be less than or "
+ "equal to the number of partitions;", threadPoolKey);
return false;
}

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

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

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

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

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

@ -33,7 +33,7 @@ import java.util.List;
*/
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,
ExtensionCallback<T, E> callback) {
@ -47,7 +47,7 @@ public class ExtensionInvoker {
Assert.isTrue(IExtension.class.isAssignableFrom(targetClz),
"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)) {
realizations = new ArrayList<>(ServiceLoaderRegistry.getSingletonServiceInstances(targetClz));
}

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

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

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

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

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

@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
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>
@ -40,7 +40,7 @@ public class ClassRegistry {
* @return t element
*/
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
*/
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
*/
public static Class<?> put(String s, Class<?> cls) {
return serverRegister.put(s, cls);
return SERVER_REGISTER.put(s, cls);
}
/**
* 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)
|| HandlerManager.class.isAssignableFrom(cls);
if (!b) {
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." +
"ChannelHandler.Sharable annotation");
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."
+ "ChannelHandler.Sharable annotation");
}
return new HandlerEntity<>(order, handler, name);
}

@ -60,7 +60,7 @@ public final class NettyClientSupport {
/**
* 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
@ -70,7 +70,7 @@ public final class NettyClientSupport {
* @return Client
*/
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) handlerManager
: new NettyClientPoolHandler();
@ -98,7 +98,7 @@ public final class NettyClientSupport {
* @param address the address
*/
public static void closeClient(InetSocketAddress address) {
Client client = clientMap.remove(address);
Client client = CLIENT_MAP.remove(address);
Optional.ofNullable(client)
.ifPresent(c -> {
try {

@ -38,8 +38,8 @@ import java.util.concurrent.locks.LockSupport;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ResultHolder {
private static final Map<String, Object> map = new ConcurrentHashMap<>();
private static final Map<String, Thread> threadMap = new HashMap<>();
private static final Map<String, Object> MAP = new ConcurrentHashMap<>();
private static final Map<String, Thread> THREAD_MAP = new HashMap<>();
/**
* Writes when the client receives a response
@ -51,7 +51,7 @@ public class ResultHolder {
if (log.isDebugEnabled()) {
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()) {
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()) {
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);
}
@ -93,7 +93,7 @@ public class ResultHolder {
if (log.isDebugEnabled()) {
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
* @return
*/
@Select("SELECT " +
"tenant_id, item_id, tp_id, max(completed_task_count) as max_completed_task_count " +
"FROM his_run_data " +
"where timestamp between #{startTime} and #{endTime} " +
"group by tenant_id, item_id, tp_id " +
"order by max_completed_task_count desc " +
"limit 8")
@Select("SELECT "
+ "tenant_id, item_id, tp_id, max(completed_task_count) as max_completed_task_count "
+ "FROM his_run_data "
+ "where timestamp between #{startTime} and #{endTime} "
+ "group by tenant_id, item_id, tp_id "
+ "order by max_completed_task_count desc "
+ "limit 8")
List<ThreadPoolTaskRanking> queryThreadPoolTaskSumRanking(@Param("startTime") Long startTime, @Param("endTime") Long endTime);
/**
@ -55,13 +55,13 @@ public interface HisRunDataMapper extends BaseMapper<HisRunDataInfo> {
* @param endTime
* @return
*/
@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 " +
"FROM his_run_data " +
"where timestamp between #{startTime} and #{endTime} " +
"group by tenant_id, item_id, tp_id " +
"order by max_completed_task_count desc " +
"limit 4")
@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 "
+ "FROM his_run_data "
+ "where timestamp between #{startTime} and #{endTime} "
+ "group by tenant_id, item_id, tp_id "
+ "order by max_completed_task_count desc "
+ "limit 4")
List<ThreadPoolTaskRanking> queryThreadPoolMaxRanking(@Param("startTime") Long startTime, @Param("endTime") Long endTime);
@Data

Loading…
Cancel
Save