MCPcopy Create free account
hub / github.com/apache/mesos / synchronized

Function synchronized

src/hook/manager.cpp:57–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55Try<Nothing> HookManager::initialize(const string& hookList)
56{
57 synchronized (mutex) {
58 const vector<string> hooks = strings::split(hookList, ",");
59 foreach (const string& hook, hooks) {
60 if (availableHooks->contains(hook)) {
61 return Error("Hook module '" + hook + "' already loaded");
62 }
63
64 if (!ModuleManager::contains<Hook>(hook)) {
65 return Error("No hook module named '" + hook + "' available");
66 }
67
68 // Let's create an instance of the hook module.
69 Try<Hook*> module = ModuleManager::create<Hook>(hook);
70 if (module.isError()) {
71 return Error(
72 "Failed to instantiate hook module '" + hook + "': " +
73 module.error());
74 }
75
76 // Add the hook module to the list of available hooks.
77 (*availableHooks)[hook] = module.get();
78 }
79 }
80
81 return Nothing();
82}

Callers

nothing calls this directly

Calls 11

splitFunction · 0.85
commandMethod · 0.80
ErrorFunction · 0.50
foreachvalueFunction · 0.50
containsMethod · 0.45
eraseMethod · 0.45
emptyMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
resourcesMethod · 0.45

Tested by

no test coverage detected