Commit 20742f46 authored by Karsten Loesing's avatar Karsten Loesing
Browse files

Replace anonymous types with lambdas.

parent 3c89aaeb
Loading
Loading
Loading
Loading
+14 −16
Original line number Diff line number Diff line
@@ -60,8 +60,7 @@ public class Configuration extends Observable implements Cloneable {
    if (this.getBool(Key.RunOnce)) { // no need to watch
      return;
    }
    this.scheduler.scheduleAtFixedRate(new Runnable() {
        public void run() {
    this.scheduler.scheduleAtFixedRate(() -> {
      logger.trace("Check configuration file.");
      try {
        FileTime ftNow = Files.getLastModifiedTime(confPath);
@@ -75,7 +74,6 @@ public class Configuration extends Observable implements Cloneable {
      } catch (Throwable th) { // Catch all and keep running.
        logger.error("Cannot reload configuration file.", th);
      }
        }
    }, 5, 5, TimeUnit.SECONDS);
  }

+2 −12
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@ import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Observable;
import java.util.Observer;
import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -186,11 +184,7 @@ public class ConfigurationTest {
  public void testConfigChange() throws Exception {
    Configuration conf = new Configuration();
    final AtomicBoolean called = new AtomicBoolean(false);
    conf.addObserver(new Observer() {
        public void update(Observable obs, Object obj) {
          called.set(true);
        }
      });
    conf.addObserver((obs, obj) -> called.set(true));
    File confFile = tmpf.newFile("empty");
    Files.write(confFile.toPath(), (Key.RelaydescsActivated.name() + "=true")
        .getBytes());
@@ -208,11 +202,7 @@ public class ConfigurationTest {
  public void testConfigUnreadable() throws Exception {
    Configuration conf = new Configuration();
    final AtomicBoolean called = new AtomicBoolean(false);
    conf.addObserver(new Observer() {
        public void update(Observable obs, Object obj) {
          called.set(true);
        }
      });
    conf.addObserver((obs, obj) -> called.set(true));
    File confFile = tmpf.newFile("empty");
    Files.write(confFile.toPath(), (Key.RelaydescsActivated.name() + "=true")
        .getBytes());