summaryrefslogtreecommitdiff
path: root/directory/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'directory/src/main')
-rw-r--r--directory/src/main/java/com/orbekk/same/directory/DirectoryApp.java17
-rw-r--r--directory/src/main/java/com/orbekk/same/directory/DirectoryServiceImpl.java5
2 files changed, 19 insertions, 3 deletions
diff --git a/directory/src/main/java/com/orbekk/same/directory/DirectoryApp.java b/directory/src/main/java/com/orbekk/same/directory/DirectoryApp.java
index f142f18..7a05894 100644
--- a/directory/src/main/java/com/orbekk/same/directory/DirectoryApp.java
+++ b/directory/src/main/java/com/orbekk/same/directory/DirectoryApp.java
@@ -1,13 +1,24 @@
package com.orbekk.same.directory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.orbekk.same.discovery.DirectoryService;
+import com.orbekk.same.http.JettyServerBuilder;
import com.orbekk.same.http.ServerContainer;
public class DirectoryApp {
public static final int DISCOVERY_PORT = 15072;
public static void main(String[] args) {
- /**
- * TODO: Need to move DiscoveryService to same project.
- */
+ Logger logger = LoggerFactory.getLogger(DirectoryApp.class);
+ ServerContainer server = new JettyServerBuilder(DISCOVERY_PORT)
+ .withService(new DirectoryServiceImpl(), DirectoryService.class)
+ .build();
+ try {
+ server.start();
+ } catch (Exception e) {
+ logger.error("Unable to start server.", e);
+ }
}
}
diff --git a/directory/src/main/java/com/orbekk/same/directory/DirectoryServiceImpl.java b/directory/src/main/java/com/orbekk/same/directory/DirectoryServiceImpl.java
index 8c6c6b9..307c0ca 100644
--- a/directory/src/main/java/com/orbekk/same/directory/DirectoryServiceImpl.java
+++ b/directory/src/main/java/com/orbekk/same/directory/DirectoryServiceImpl.java
@@ -4,9 +4,13 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.orbekk.same.discovery.DirectoryService;
public class DirectoryServiceImpl implements DirectoryService {
+ private Logger logger = LoggerFactory.getLogger(getClass());
public final static long EXPIRE_TIME = 15 * 60l * 1000; // 15 minutes
List<NetworkEntry> networkList = new ArrayList<NetworkEntry>();
@@ -18,6 +22,7 @@ public class DirectoryServiceImpl implements DirectoryService {
it.remove();
}
}
+ logger.info("Cleaned network list. Networks: {}", networkList);
}
@Override