Skip to content
Snippets Groups Projects
Commit 7960f3cf authored by Alex Reimers's avatar Alex Reimers
Browse files

Merge pull request #83 from nilok/disallow-multiple-providers

Fixing bug which allowed multiple modules that provide a given service to be loaded.
parents 781c91a3 404abfe6
No related branches found
No related tags found
No related merge requests found
......@@ -287,8 +287,18 @@ public class FloodlightModuleLoader {
" as provider for " +
s.getKey().getCanonicalName());
}
floodlightModuleContext.addService(s.getKey(),
s.getValue());
if (floodlightModuleContext.getServiceImpl(s.getKey()) == null) {
floodlightModuleContext.addService(s.getKey(),
s.getValue());
} else {
throw new FloodlightModuleException("Cannot set "
+ s.getValue()
+ " as the provider for "
+ s.getKey().getCanonicalName()
+ " because "
+ floodlightModuleContext.getServiceImpl(s.getKey())
+ " already provides it");
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment