Skip to content
Snippets Groups Projects
Commit 404abfe6 authored by Colin Dixon's avatar Colin Dixon
Browse files

Fixing bug which allowed multiple modules that provide service X to be loaded

parent e7166821
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