Move logger's anonymous runnable to lambda
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
59c5e09f14
commit
76c2c9e171
@ -47,16 +47,8 @@ public class Logger
|
|||||||
public void log(String message, int delay)
|
public void log(String message, int delay)
|
||||||
{
|
{
|
||||||
// create a new scheduled executor with an anonymous runnable...
|
// create a new scheduled executor with an anonymous runnable...
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule(new Runnable()
|
//... after waiting <delay> seconds.
|
||||||
{
|
Executors.newSingleThreadScheduledExecutor().schedule(() -> log(message), delay, TimeUnit.SECONDS);
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
// log the message
|
|
||||||
log(message);
|
|
||||||
}
|
|
||||||
//... after waiting X seconds.
|
|
||||||
}, delay, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user