工商局网站官网微信引流推广怎么找平台
线程池隔离配置修改YML文件
resilience4j:thread-pool-bulkhead: instances:backendA:# 最大线程池大小maxThreadPoolSize: 4# 核心线程池大小coreThreadPoolSize: 2# 队列容量queueCapacity: 2
编写controller
/*** 测试线程池服务隔离* @return*/@Bulkhead(name = "backendA",type = Bulkhead.Type.THREADPOOL)@GetMapping("/futrue")public CompletableFuture future(){log.info("********** 进入方法 *******");try {TimeUnit.SECONDS.sleep(5);} catch (InterruptedException e) {e.printStackTrace();}log.info("********** 离开方法 *******");return CompletableFuture.supplyAsync(() -> "线程池隔离信息......");}
测试
配置文件设置核心线程2个最大4个服务会一次处理4个请求