|
|
@@ -20,6 +20,9 @@ import java.time.ZonedDateTime;
|
|
20
|
20
|
import java.util.List;
|
|
21
|
21
|
import java.util.Map;
|
|
22
|
22
|
import java.util.Objects;
|
|
|
23
|
+import java.util.concurrent.Callable;
|
|
|
24
|
+import java.util.concurrent.Exchanger;
|
|
|
25
|
+import java.util.concurrent.FutureTask;
|
|
23
|
26
|
import java.util.function.Function;
|
|
24
|
27
|
import java.util.stream.Collectors;
|
|
25
|
28
|
|
|
|
@@ -127,8 +130,21 @@ public class UserController {
|
|
127
|
130
|
Map.of("value", 4, "label", "代理商")));
|
|
128
|
131
|
}
|
|
129
|
132
|
|
|
130
|
|
- public static void main(String[] args) {
|
|
131
|
|
- System.out.println(LocalDateTime.of(2022, 04, 18, 0, 0, 0).toEpochSecond(ZoneOffset.ofHours(8)));
|
|
132
|
|
- System.out.println(LocalDateTime.of(2022, 04, 18, 23, 59, 59).toEpochSecond(ZoneOffset.ofHours(8)));
|
|
|
133
|
+ public static void main(String[] args) throws InterruptedException {
|
|
|
134
|
+
|
|
|
135
|
+ Exchanger exchanger = new Exchanger();
|
|
|
136
|
+
|
|
|
137
|
+ for (int i = 1; i <= 10; i++) {
|
|
|
138
|
+ Integer data = i;
|
|
|
139
|
+ new Thread(() -> {
|
|
|
140
|
+ try {
|
|
|
141
|
+ Object exchange = exchanger.exchange(data);
|
|
|
142
|
+ System.out.println(Thread.currentThread().getName() + "-" + exchange);
|
|
|
143
|
+ } catch (InterruptedException e) {
|
|
|
144
|
+ e.printStackTrace();
|
|
|
145
|
+ }
|
|
|
146
|
+ }, "Java技术栈" + i).start();
|
|
|
147
|
+ }
|
|
|
148
|
+
|
|
133
|
149
|
}
|
|
134
|
150
|
}
|