1
13693261870
2024-08-25 fc0f31f410662cb02c559e2997029304c6aed2e0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.se.auth.service;
 
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
 
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
 
/**
 * 异步服务
 *
 * @author WWW
 * @date 2024-08-25
 */
@Slf4j
@Service
@SuppressWarnings("ALL")
public class AsyncService {
    public void asyncCall() {
        try {
            ExecutorService executor = Executors.newSingleThreadExecutor();
            executor.execute(new Runnable() {
                @Override
                @SneakyThrows
                public void run() {
                    //
                }
            });
            executor.shutdown();
        } catch (Exception ex) {
            log.error(ex.getMessage(), ex);
        }
    }
}