摘要: package com.example.test.async; import java.util.concurrent.CountDownLatch; public class CountDownLatchTest { private static final int COUNT = 5; priv 阅读全文
posted @ 2022-08-01 16:36 我自逍遥 阅读(107) 评论(0) 推荐(0) 编辑
摘要: package com.example.test.async; import lombok.Getter; import java.util.concurrent.Exchanger; /** * 小红和小明是好朋友 * 小红想知道小明的小秘密 * 小明也想知道小红的小秘密 * 于是他们打算互相交换 阅读全文
posted @ 2022-08-01 10:37 我自逍遥 阅读(19) 评论(0) 推荐(0) 编辑
摘要: package com.example.test.async; import java.util.Random; import java.util.concurrent.Semaphore; /* *一个小桑拿房一次最多只能容纳5个人 */ public class SemaphoreTest { 阅读全文
posted @ 2022-08-01 10:01 我自逍遥 阅读(54) 评论(0) 推荐(0) 编辑