Format code (#907)

pull/908/head
马称 Ma Chen 2 years ago committed by GitHub
parent 1a2ee8975d
commit 5798a07b7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,6 +17,9 @@
package cn.hippo4j.common.constant; package cn.hippo4j.common.constant;
/**
* Config modify type constants.
*/
public class ConfigModifyTypeConstants { public class ConfigModifyTypeConstants {
/** /**

@ -23,12 +23,11 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;
/** /**
* Thread-pool manager. * Thread-pool manager.
*/ */
public class ThreadPoolManager { public final class ThreadPoolManager {
private Map<String, Map<String, Set<ExecutorService>>> resourcesManager; private Map<String, Map<String, Set<ExecutorService>>> resourcesManager;
@ -36,8 +35,6 @@ public class ThreadPoolManager {
private static final ThreadPoolManager INSTANCE = new ThreadPoolManager(); private static final ThreadPoolManager INSTANCE = new ThreadPoolManager();
private static final AtomicBoolean CLOSED = new AtomicBoolean(false);
public static ThreadPoolManager getInstance() { public static ThreadPoolManager getInstance() {
return INSTANCE; return INSTANCE;
} }

@ -21,13 +21,17 @@ import cn.hippo4j.common.constant.Constants;
import cn.hippo4j.common.model.ThreadPoolParameter; import cn.hippo4j.common.model.ThreadPoolParameter;
import cn.hippo4j.common.model.ThreadPoolParameterInfo; import cn.hippo4j.common.model.ThreadPoolParameterInfo;
import java.util.Objects;
/** /**
* Content util. * Content util.
*/ */
public class ContentUtil { public class ContentUtil {
/**
* Get pool content.
*
* @param parameter thread-pool parameter
* @return dynamic thread-pool content str
*/
public static String getPoolContent(ThreadPoolParameter parameter) { public static String getPoolContent(ThreadPoolParameter parameter) {
ThreadPoolParameterInfo threadPoolParameterInfo = new ThreadPoolParameterInfo(); ThreadPoolParameterInfo threadPoolParameterInfo = new ThreadPoolParameterInfo();
threadPoolParameterInfo.setTenantId(parameter.getTenantId()) threadPoolParameterInfo.setTenantId(parameter.getTenantId())
@ -47,6 +51,12 @@ public class ContentUtil {
return JSONUtil.toJSONString(threadPoolParameterInfo); return JSONUtil.toJSONString(threadPoolParameterInfo);
} }
/**
* Get group key.
*
* @param parameter thread-pool parameter
* @return group key
*/
public static String getGroupKey(ThreadPoolParameter parameter) { public static String getGroupKey(ThreadPoolParameter parameter) {
return StringUtil.createBuilder() return StringUtil.createBuilder()
.append(parameter.getTpId()) .append(parameter.getTpId())
@ -57,6 +67,12 @@ public class ContentUtil {
.toString(); .toString();
} }
/**
* Get group key.
*
* @param parameters thread-pool parameters
* @return group key
*/
public static String getGroupKey(String... parameters) { public static String getGroupKey(String... parameters) {
StringBuilder stringBuilder = new StringBuilder(); StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < parameters.length; i++) { for (int i = 0; i < parameters.length; i++) {

@ -26,7 +26,7 @@ import java.util.Objects;
* reference google guava<br> * reference google guava<br>
* com.google.common.base.Joiner * com.google.common.base.Joiner
*/ */
public class Joiner { public final class Joiner {
private final String separator; private final String separator;
@ -45,11 +45,11 @@ public class Joiner {
* Returns a string containing the string representation of each of {@code parts}, using the * Returns a string containing the string representation of each of {@code parts}, using the
* previously configured separator between each. * previously configured separator between each.
*/ */
public final String join(Object[] parts) { public String join(Object[] parts) {
return join(Arrays.asList(parts)); return join(Arrays.asList(parts));
} }
public final String join(Iterable<?> parts) { public String join(Iterable<?> parts) {
return join(parts.iterator()); return join(parts.iterator());
} }
@ -57,11 +57,11 @@ public class Joiner {
* Returns a string containing the string representation of each of {@code parts}, using the * Returns a string containing the string representation of each of {@code parts}, using the
* previously configured separator between each. * previously configured separator between each.
*/ */
public final String join(Iterator<?> parts) { public String join(Iterator<?> parts) {
return appendTo(new StringBuilder(), parts).toString(); return appendTo(new StringBuilder(), parts).toString();
} }
public final StringBuilder appendTo(StringBuilder builder, Iterator<?> parts) { public StringBuilder appendTo(StringBuilder builder, Iterator<?> parts) {
try { try {
appendTo((Appendable) builder, parts); appendTo((Appendable) builder, parts);
} catch (IOException impossible) { } catch (IOException impossible) {

Loading…
Cancel
Save