summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hood <0x6e6562@gmail.com>2009-01-09 15:40:28 +0000
committerBen Hood <0x6e6562@gmail.com>2009-01-09 15:40:28 +0000
commitff152ba3431788caad70a87e631822877487de5d (patch)
tree1f475fc3e4cd3be79bd80cd0472f250c97bbc09c
parent520a7bad8d08aef638f3b309f89471ca3211f1ae (diff)
parent6ebf31bd90a044cec95301d0bb9008267ca9c3ed (diff)
downloadrabbitmq-server-ff152ba3431788caad70a87e631822877487de5d.tar.gz
Merged v1_5_1 into default
-rw-r--r--ebin/rabbit.app4
-rw-r--r--src/rabbit.erl32
-rw-r--r--src/rabbit_alarm.erl8
-rw-r--r--src/rabbit_error_logger_file_h.erl2
-rw-r--r--src/rabbit_misc.erl32
-rw-r--r--src/rabbit_mnesia.erl4
-rw-r--r--src/rabbit_sasl_report_file_h.erl2
7 files changed, 44 insertions, 40 deletions
diff --git a/ebin/rabbit.app b/ebin/rabbit.app
index 0d714fdf..5ecd247b 100644
--- a/ebin/rabbit.app
+++ b/ebin/rabbit.app
@@ -50,8 +50,8 @@
{applications, [kernel, stdlib, sasl, mnesia, os_mon]},
{mod, {rabbit, []}},
{env, [{tcp_listeners, [{"0.0.0.0", 5672}]},
- {extra_startup_steps, []},
+ {extra_startup_steps, []},
{default_user, <<"guest">>},
{default_pass, <<"guest">>},
{default_vhost, <<"/">>},
- {memory_alarms, auto}]}]}.
+ {memory_alarms, auto}]}]}.
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 41064c77..30b8c394 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -75,14 +75,14 @@ start() ->
try
ok = ensure_working_log_handlers(),
ok = rabbit_mnesia:ensure_mnesia_dir(),
- ok = start_applications(?APPS)
+ ok = rabbit_misc:start_applications(?APPS)
after
%%give the error loggers some time to catch up
timer:sleep(100)
end.
stop() ->
- ok = stop_applications(?APPS).
+ ok = rabbit_misc:stop_applications(?APPS).
stop_and_halt() ->
spawn(fun () ->
@@ -109,34 +109,6 @@ rotate_logs(BinarySuffix) ->
%%--------------------------------------------------------------------
-manage_applications(Iterate, Do, Undo, SkipError, ErrorTag, Apps) ->
- Iterate(fun (App, Acc) ->
- case Do(App) of
- ok -> [App | Acc];
- {error, {SkipError, _}} -> Acc;
- {error, Reason} ->
- lists:foreach(Undo, Acc),
- throw({error, {ErrorTag, App, Reason}})
- end
- end, [], Apps),
- ok.
-
-start_applications(Apps) ->
- manage_applications(fun lists:foldl/3,
- fun application:start/1,
- fun application:stop/1,
- already_started,
- cannot_start_application,
- Apps).
-
-stop_applications(Apps) ->
- manage_applications(fun lists:foldr/3,
- fun application:stop/1,
- fun application:start/1,
- not_started,
- cannot_stop_application,
- Apps).
-
start(normal, []) ->
{ok, SupPid} = rabbit_sup:start_link(),
diff --git a/src/rabbit_alarm.erl b/src/rabbit_alarm.erl
index dee71d23..875624ba 100644
--- a/src/rabbit_alarm.erl
+++ b/src/rabbit_alarm.erl
@@ -53,7 +53,7 @@
-spec(start/1 :: (bool() | 'auto') -> 'ok').
-spec(stop/0 :: () -> 'ok').
-spec(register/2 :: (pid(), mfa_tuple()) -> 'ok').
-
+
-endif.
%%----------------------------------------------------------------------------
@@ -101,7 +101,7 @@ handle_call({register, Pid, HighMemMFA},
end,
NewAlertees = dict:store(Pid, HighMemMFA, Alertess),
{ok, ok, State#alarms{alertees = NewAlertees}};
-
+
handle_call(_Request, State) ->
{ok, not_understood, State}.
@@ -135,7 +135,7 @@ code_change(_OldVsn, State, _Extra) ->
%%----------------------------------------------------------------------------
start_memsup() ->
- Mod = 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
@@ -143,7 +143,7 @@ start_memsup() ->
%% our own simple memory monitor.
%%
{unix, linux} -> rabbit_memsup_linux;
-
+
%% Start memsup programmatically rather than via the
%% rabbitmq-server script. This is not quite the right
%% thing to do as os_mon checks to see if memsup is
diff --git a/src/rabbit_error_logger_file_h.erl b/src/rabbit_error_logger_file_h.erl
index 9a9220b5..183b6984 100644
--- a/src/rabbit_error_logger_file_h.erl
+++ b/src/rabbit_error_logger_file_h.erl
@@ -46,7 +46,7 @@ init({{File, Suffix}, []}) ->
case rabbit_misc:append_file(File, Suffix) of
ok -> ok;
{error, Error} ->
- rabbit_log:error("Failed to append contents of " ++
+ rabbit_log:error("Failed to append contents of "
"log file '~s' to '~s':~n~p~n",
[File, [File, Suffix], Error])
end,
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl
index 973e163b..85db50d7 100644
--- a/src/rabbit_misc.erl
+++ b/src/rabbit_misc.erl
@@ -50,6 +50,7 @@
-export([dirty_read_all/1, dirty_foreach_key/2, dirty_dump_log/1]).
-export([append_file/2, ensure_parent_dirs_exist/1]).
-export([format_stderr/2]).
+-export([start_applications/1, stop_applications/1]).
-import(mnesia).
-import(lists).
@@ -108,6 +109,8 @@
-spec(append_file/2 :: (string(), string()) -> 'ok' | {'error', any()}).
-spec(ensure_parent_dirs_exist/1 :: (string()) -> 'ok').
-spec(format_stderr/2 :: (string(), [any()]) -> 'true').
+-spec(start_applications/1 :: ([atom()]) -> 'ok').
+-spec(stop_applications/1 :: ([atom()]) -> 'ok').
-endif.
@@ -398,3 +401,32 @@ format_stderr(Fmt, Args) ->
Port = open_port({fd, 0, 2}, [out]),
port_command(Port, io_lib:format(Fmt, Args)),
port_close(Port).
+
+manage_applications(Iterate, Do, Undo, SkipError, ErrorTag, Apps) ->
+ Iterate(fun (App, Acc) ->
+ case Do(App) of
+ ok -> [App | Acc];
+ {error, {SkipError, _}} -> Acc;
+ {error, Reason} ->
+ lists:foreach(Undo, Acc),
+ throw({error, {ErrorTag, App, Reason}})
+ end
+ end, [], Apps),
+ ok.
+
+start_applications(Apps) ->
+ manage_applications(fun lists:foldl/3,
+ fun application:start/1,
+ fun application:stop/1,
+ already_started,
+ cannot_start_application,
+ Apps).
+
+stop_applications(Apps) ->
+ manage_applications(fun lists:foldr/3,
+ fun application:stop/1,
+ fun application:start/1,
+ not_started,
+ cannot_stop_application,
+ Apps).
+
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index d19c37cb..eebb38fa 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -243,8 +243,8 @@ init_db(ClusterNodes) ->
%% NB: we cannot use rabbit_log here since
%% it may not have been started yet
error_logger:warning_msg(
- "schema integrity check failed: ~p~n" ++
- "moving database to backup location " ++
+ "schema integrity check failed: ~p~n"
+ "moving database to backup location "
"and recreating schema from scratch~n",
[Reason]),
ok = move_db(),
diff --git a/src/rabbit_sasl_report_file_h.erl b/src/rabbit_sasl_report_file_h.erl
index 9e4c9c8a..2a365ce1 100644
--- a/src/rabbit_sasl_report_file_h.erl
+++ b/src/rabbit_sasl_report_file_h.erl
@@ -47,7 +47,7 @@ init({{File, Suffix}, []}) ->
case rabbit_misc:append_file(File, Suffix) of
ok -> ok;
{error, Error} ->
- rabbit_log:error("Failed to append contents of " ++
+ rabbit_log:error("Failed to append contents of "
"sasl log file '~s' to '~s':~n~p~n",
[File, [File, Suffix], Error])
end,