Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
outlaws-bai committed Jul 2, 2024
1 parent 3ca3c4b commit c7fa76e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/main/java/org/m2sec/common/WorkExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
import org.m2sec.common.utils.CompatUtil;

import javax.annotation.Nullable;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;

/**
Expand All @@ -22,7 +19,7 @@ public class WorkExecutor extends ThreadPoolExecutor {
public WorkExecutor() {
this(0, CompatUtil.getCPUCount() * 2 - 1,
60L, TimeUnit.SECONDS,
new SynchronousQueue<Runnable>());
new LinkedBlockingQueue<>());
}

public WorkExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit,
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/org/m2sec/common/utils/SwaggerUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,16 @@ private static HashMap<String, Object> getRequestByModel(ApiInfo apiInfo, JsonOb
JsonArray enums = property.has("enum") ? property.get("enum").getAsJsonArray() : null;
String description = property.has("description") ? property.get("description").getAsString() : null;
String subType = property.has("type") ? property.get("type").getAsString() : null;
String example = property.has("example") ? property.get("example").getAsString() : null;
Object example = null;
if (property.has("example")) {
if (property.get("example").isJsonPrimitive()) {
example = property.get("example").getAsString();
} else if (property.get("example").isJsonArray()) {
example = property.getAsJsonArray("example");
} else if (property.get("example").isJsonObject()) {
example = property.getAsJsonObject("example");
}
}
if (description != null)
apiInfo.getNotes().put("model-description-body-" + key + "-" + subType, description);
if (enums != null) {
Expand Down

0 comments on commit c7fa76e

Please sign in to comment.