You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shenyu.apache.org by GitBox <gi...@apache.org> on 2022/06/21 07:31:49 UTC

[GitHub] [incubator-shenyu] yu199195 commented on a diff in pull request #3593: [type:refactor] change logging-elasticsearch-plugin thread pool

yu199195 commented on code in PR #3593:
URL: https://github.com/apache/incubator-shenyu/pull/3593#discussion_r902254970


##########
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-elasticsearch/src/main/java/org/apache/shenyu/plugin/logging/elasticsearch/AbstractLogCollector.java:
##########
@@ -49,11 +53,15 @@ public abstract class AbstractLogCollector implements LogCollector {
 
     private final AtomicBoolean started = new AtomicBoolean(true);
 
+    private final ThreadFactory factory = ShenyuThreadFactory.create("shenyu-logging-elasticsearch", true);
+
     @Override
     public void start() {
         bufferSize = LogCollectConfigUtils.getGlobalLogConfig().getBufferQueueSize();
         bufferQueue = new LinkedBlockingDeque<>(bufferSize);
-        ExecutorService threadExecutor = Executors.newSingleThreadExecutor();
+        ByteBuddyAgent.install();
+        ShenyuThreadPoolExecutor threadExecutor = new ShenyuThreadPoolExecutor(1, 1, 0L,
+                TimeUnit.MILLISECONDS, new MemoryLimitedTaskQueue<>(ByteBuddyAgent.getInstrumentation()), factory, new AbortPolicy());

Review Comment:
    new ShenyuThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime,
                   TimeUnit.MILLISECONDS, provider.getIfAvailable(() -> new MemorySafeTaskQueue<>(Constants.THE_256_MB)),
                   ShenyuThreadFactory.create(sharedPool.getPrefix(), true),
                   new ThreadPoolExecutor.AbortPolicy());



##########
shenyu-plugin/shenyu-plugin-logging/shenyu-plugin-logging-elasticsearch/pom.xml:
##########
@@ -61,6 +61,10 @@
             <artifactId>jakarta.json-api</artifactId>
             <version>${jakarta.json-api.version}</version>
         </dependency>
+        <dependency>

Review Comment:
   remove this



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org