@Bean
    @ConditionalOnMissingBean(TaskQueue.class)
    @Qualifier("taskQueue")
    @ConditionalOnProperty("shenyu.shared-pool.max-free-memory")
    public TaskQueue<Runnable> memorySafeTaskQueue(final ShenyuConfig shenyuConfig) {
        final ShenyuConfig.SharedPool sharedPool = shenyuConfig.getSharedPool();
        final Integer maxFreeMemory = sharedPool.getMaxFreeMemory();
        if (maxFreeMemory <= 0) {
            throw new ShenyuException("${shenyu.sharedPool.maxFreeMemory} must bigger than 0 !");
        }
        return new MemorySafeTaskQueue<>(maxFreeMemory);
    }
MemorySafeTaskQueue.

@param shenyuConfig the shenyu config
@return instance of {@link MemorySafeTaskQueue}
shenyu-web/src/main/java/org/apache/shenyu/web/configuration/ShenyuThreadPoolConfiguration.java