summaryrefslogtreecommitdiff
path: root/directory/src/main
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-02 14:43:25 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-02 14:43:25 +0100
commit62504779cb31db14693bc763d95ef63987c367d1 (patch)
treef8f30876d7bc153d88b74571893fe74b58435957 /directory/src/main
parent0ac19e55b447e9bc966282e1ba9cae9f23ae4f91 (diff)
Add DirectoryApp.discovery
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