Threadlocal Titan handle
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index 6e816c7..a5ee71a 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -139,8 +139,18 @@
*/
public class Controller implements IFloodlightProviderService,
IStorageSourceListener {
-
- protected SwitchStorageImpl swStore;
+
+ ThreadLocal<SwitchStorageImpl> store = new ThreadLocal<SwitchStorageImpl>() {
+ @Override
+ protected SwitchStorageImpl initialValue() {
+ SwitchStorageImpl swStore = new SwitchStorageImpl();
+ //TODO: Get the file path from global properties
+ swStore.init("/tmp/cassandra.titan");
+ return swStore;
+ }
+ };
+
+ protected SwitchStorageImpl swStore = store.get();
protected static Logger log = LoggerFactory.getLogger(Controller.class);
@@ -2072,8 +2082,6 @@
this.roleChanger = new RoleChanger();
initVendorMessages();
this.systemStartTime = System.currentTimeMillis();
- this.swStore = new SwitchStorageImpl();
- this.swStore.init("/tmp/cassandra.titan");
}
/**