Add finalize to clean up file handles to Titan
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
index d0f0b9e..3aa1fc0 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkStorageImpl.java
@@ -248,7 +248,7 @@
@Override
public Link compute(PathPipe<Vertex> pipe ) {
-
+ // TODO Auto-generated method stub
long s_dpid = 0;
long d_dpid = 0;
short s_port = 0;
@@ -269,6 +269,16 @@
return l;
}
}
+
+ public void finalize() {
+ close();
+ }
+
+ @Override
+ public void close() {
+ // TODO Auto-generated method stub
+ graph.shutdown();
+ }
}
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java
index b73224e..2dbb338 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/TopoLinkServiceImpl.java
@@ -21,7 +21,8 @@
@Override
public List<Link> GetActiveLinks() {
// TODO Auto-generated method stub
- return linkStore.getActiveLinks();
+ List<Link> retval = linkStore.getActiveLinks();
+ return retval;
}
@Override
@@ -29,5 +30,4 @@
// TODO Auto-generated method stub
return linkStore.getLinks(dpid);
}
-
}
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/web/TopoLinksResource.java b/src/main/java/net/floodlightcontroller/linkdiscovery/web/TopoLinksResource.java
index 323708e..a0770cb 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/web/TopoLinksResource.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/web/TopoLinksResource.java
@@ -13,8 +13,8 @@
public List<Link> retrieve() {
TopoLinkServiceImpl impl = new TopoLinkServiceImpl();
- return impl.GetActiveLinks();
-
+ List<Link> retval = impl.GetActiveLinks();
+ return retval;
}
}