summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@lshift.net>2008-11-28 21:44:38 +0000
committerMatthias Radestock <matthias@lshift.net>2008-11-28 21:44:38 +0000
commit1d48d102808e18875633192e2c78e36d006d1121 (patch)
tree969eb3a6e9cfcf5fa137d0159e1dec7f4591f728
parentce759b892d139dad7a2323deadb3651a2b7b33d1 (diff)
downloadrabbitmq-server-1d48d102808e18875633192e2c78e36d006d1121.tar.gz
some more tidying upbug19852
-rw-r--r--src/rabbit_alarm.erl27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl
index 948182fd..6d65b3a4 100644
--- a/src/rabbit_alarm.erl
+++ b/src/rabbit_alarm.erl
@@ -53,15 +53,13 @@ start() ->
ok = alarm_handler:add_alarm_handler(?MODULE),
case whereis(memsup) of
undefined ->
- {ok, _} =
- start_memsup(
- case os:type() of
+ Mod = case os:type() of
%% memsup doesn't take account of buffers or
- %% cache %% when considering "free" memory -
- %% therefore on %% Linux we can get memory
- %% alarms very easily %% without any pressure
- %% existing on memory at all. %% Therefore we
- %% need to use our own simple memory %% monitor
+ %% cache when considering "free" memory -
+ %% therefore on Linux we can get memory alarms
+ %% very easily without any pressure existing on
+ %% memory at all. Therefore we need to use our
+ %% own simple memory monitor.
%%
{unix, linux} -> rabbit_memsup_linux;
@@ -78,7 +76,12 @@ start() ->
%% notice memory alarms that go off on startup.
%%
_ -> memsup
- end),
+ end,
+ %% This is based on os_mon:childspec(memsup, true)
+ {ok, _} = supervisor:start_child(
+ os_mon_sup,
+ {memsup, {Mod, start_link, []},
+ permanent, 2000, worker, [Mod]}),
ok;
_ ->
ok
@@ -151,12 +154,6 @@ code_change(_OldVsn, State, _Extra) ->
%%----------------------------------------------------------------------------
-start_memsup(Module) ->
- %% This is based on os_mon:childspec(memsup, true)
- supervisor:start_child(os_mon_sup,
- {memsup, {Module, start_link, []},
- permanent, 2000, worker, [Module]}).
-
alert(Alert, Alertees) ->
dict:fold(fun (Pid, {M, F, A}, Acc) ->
ok = erlang:apply(M, F, A ++ [Pid, Alert]),