2021-08-05

This commit is contained in:
2021-08-05 17:59:24 +09:00
parent 5f17645bda
commit a69e814fdb
43 changed files with 1017 additions and 28 deletions

20
thread/logback.xml Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Examples for Java
~
~ Copyright (c) 2021. Elex. All Rights Reserved.
~ https://www.elex-project.com/
-->
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<root level="TRACE">
<appender-ref ref="CONSOLE" />
</root>
</configuration>

View File

@@ -13,6 +13,7 @@ import java.time.Duration;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalUnit;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
@@ -27,11 +28,11 @@ public class Sample {
executor.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
System.out.println("Hi~");
}
},
Duration.between(LocalDateTime.now(), startTime).abs().get(ChronoUnit.MILLIS),
Period.ofDays(1).get(ChronoUnit.MILLIS),
Duration.between(LocalDateTime.now(), startTime).abs().toMillis(),
Duration.ofDays(1).toMillis(),
TimeUnit.MILLISECONDS);
}