YoongRii

YoongRii

V2EX member #322421, joined on 2018-06-13 12:32:05 +08:00
Per YoongRii's settings, the topics list is hidden
Deals info, including closed deals, is not hidden
YoongRii's recent replies
Oct 22, 2022
Replied to a topic by oygh V2EX 888888
合影留恋
Aug 17, 2021
Replied to a topic by fiypig 随想 职业这条路也是越走越迷了
@fiypig 替我一个朋友问下,私人兼职都是怎么联系上的
Jan 25, 2021
Replied to a topic by Cbdy Java 求一个 Java 面试题的最佳实践
用原子变量%3 这种解法比较常见,但是需要线程忙等,提供一种用线程池方式实现的思路:

public static void main(String[] args) throws InterruptedException {
ExecutorService executorService1 = Executors.newSingleThreadExecutor();
ExecutorService executorService2 = Executors.newSingleThreadExecutor();
ExecutorService executorService3 = Executors.newSingleThreadExecutor();

Runnable[] rs = new Runnable[3];

rs[0] = () -> {
System.out.println("A");
executorService2.submit(rs[1]);
};

rs[1] = () -> {
System.out.println("B");
executorService2.submit(rs[2]);
};

rs[2] = new Runnable() {
private int a = 1;

public void run() {
System.out.println("C");
if (a++ < 100)
executorService3.submit(rs[0]);
}
};

executorService1.submit(rs[0]);
}
Oct 28, 2020
Replied to a topic by binggg 推广 我又来安利开源的应用部署工具了
支持
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   754 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 12ms · UTC 21:01 · PVG 05:01 · LAX 14:01 · JFK 17:01
♥ Do have faith in what you're doing.