Correct ThreadContext.getStringBuilder usage in WebUtils.toQueryString
This commit is contained in:
@@ -35,10 +35,14 @@ public abstract class ThreadContext {
|
|||||||
|
|
||||||
private static final String sb = "$sb";
|
private static final String sb = "$sb";
|
||||||
|
|
||||||
|
public static final String sb0 = "$sb0";
|
||||||
|
|
||||||
private static final int sbCap = 256;
|
private static final int sbCap = 256;
|
||||||
|
|
||||||
private static final String arrayListT = "arlstT";
|
private static final String arrayListT = "arlstT";
|
||||||
|
|
||||||
|
public static final String arrayList0 = "arlst0T";
|
||||||
|
|
||||||
private static final String hashMapT = "hsMapT";
|
private static final String hashMapT = "hsMapT";
|
||||||
|
|
||||||
private static final String hashSetT = "hsSetT";
|
private static final String hashSetT = "hsSetT";
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ServiceConfig {
|
|||||||
|
|
||||||
// private static final String gmpT = "gmpT";
|
// private static final String gmpT = "gmpT";
|
||||||
|
|
||||||
private static final String gsmpT = "gsmpT";
|
// private static final String gsmpT = "gsmpT";
|
||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ public class ServiceConfig {
|
|||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public List<ApiConfig> getApiConfigs(Set<String> gatewayGroups, HttpMethod method, String path) {
|
public List<ApiConfig> getApiConfigs(Set<String> gatewayGroups, HttpMethod method, String path) {
|
||||||
ArrayList<ApiConfig> result = ThreadContext.getArrayList(gsmpT);
|
ArrayList<ApiConfig> result = ThreadContext.getArrayList(ThreadContext.arrayList0);
|
||||||
for (String gatewayGroup : gatewayGroups) {
|
for (String gatewayGroup : gatewayGroups) {
|
||||||
List<ApiConfig> apiConfigs = getApiConfigs(gatewayGroup, method, path);
|
List<ApiConfig> apiConfigs = getApiConfigs(gatewayGroup, method, path);
|
||||||
result.addAll(apiConfigs);
|
result.addAll(apiConfigs);
|
||||||
|
|||||||
@@ -623,7 +623,7 @@ public abstract class WebUtils {
|
|||||||
|
|
||||||
public static String jsonRespBody(int code, @Nullable String msg, @Nullable String traceId, @Nullable Object context) {
|
public static String jsonRespBody(int code, @Nullable String msg, @Nullable String traceId, @Nullable Object context) {
|
||||||
// StringBuilder b = ThreadContext.getStringBuilder(respbT);
|
// StringBuilder b = ThreadContext.getStringBuilder(respbT);
|
||||||
StringBuilder b = ThreadContext.getStringBuilder();
|
StringBuilder b = ThreadContext.getStringBuilder(ThreadContext.sb0);
|
||||||
b.append(s0).append(SystemConfig.FIZZ_ERR_RESP_CODE_FIELD).append(s1).append(code);
|
b.append(s0).append(SystemConfig.FIZZ_ERR_RESP_CODE_FIELD).append(s1).append(code);
|
||||||
if (StringUtils.isNotBlank(msg)) {
|
if (StringUtils.isNotBlank(msg)) {
|
||||||
b.append(s2).append(SystemConfig.FIZZ_ERR_RESP_MSG_FIELD).append(s3).append(msg).append(s4);
|
b.append(s2).append(SystemConfig.FIZZ_ERR_RESP_MSG_FIELD).append(s3).append(msg).append(s4);
|
||||||
@@ -639,7 +639,7 @@ public abstract class WebUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String toQueryString(MultiValueMap<String, String> queryParams) {
|
public static String toQueryString(MultiValueMap<String, String> queryParams) {
|
||||||
StringBuilder b = ThreadContext.getStringBuilder();
|
StringBuilder b = ThreadContext.getStringBuilder(ThreadContext.sb0);
|
||||||
Set<Map.Entry<String, List<String>>> params = queryParams.entrySet();
|
Set<Map.Entry<String, List<String>>> params = queryParams.entrySet();
|
||||||
int ps = params.size(), cnt = 0;
|
int ps = params.size(), cnt = 0;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user