将线程池改为定时线程池
This commit is contained in:
parent
de19244ab8
commit
df6c39ba56
@ -14,8 +14,7 @@ import java.nio.file.Files;
|
|||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.*;
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -27,12 +26,8 @@ public class BackupSubServer {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
updateSub();
|
updateSub();
|
||||||
ExecutorService threadPool = Executors.newFixedThreadPool(3600);
|
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(1);
|
||||||
threadPool.submit(() -> {
|
threadPool.scheduleAtFixedRate(BackupSubServer::updateSub, 0, 12, TimeUnit.HOURS);
|
||||||
if(LocalDateTime.now().getHour() == 0){
|
|
||||||
updateSub();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
String ip = "";
|
String ip = "";
|
||||||
try(ServerSocket serverSocket = new ServerSocket(8889)) {
|
try(ServerSocket serverSocket = new ServerSocket(8889)) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user