summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Watson <tim@rabbitmq.com>2014-03-04 11:37:56 +0000
committerTim Watson <tim@rabbitmq.com>2014-03-04 11:37:56 +0000
commitf0ecdaaf4876ff78fa1d99725d9de5193331c8ee (patch)
tree2216597999d7d5cdbb66b6fe190a75bc3d06d6fd
parentb41aa6b23290d2febfa4b13e4509f66e3de134be (diff)
downloadrabbitmq-server-git-f0ecdaaf4876ff78fa1d99725d9de5193331c8ee.tar.gz
Reduce the distance to default a bit more
-rw-r--r--src/app_utils.erl4
-rw-r--r--src/rabbit.erl67
-rw-r--r--src/rabbit_boot.erl14
3 files changed, 38 insertions, 47 deletions
diff --git a/src/app_utils.erl b/src/app_utils.erl
index eccf3d21e6..4edee86f2b 100644
--- a/src/app_utils.erl
+++ b/src/app_utils.erl
@@ -101,8 +101,8 @@ app_dependency_order(RootApps, StripUnreachable) ->
{App, _Desc, _Vsn} <- application:loaded_applications()]),
try
case StripUnreachable of
- true -> digraph:del_vertices(G, digraph:vertices(G) --
- digraph_utils:reachable(RootApps, G));
+ true -> digraph:del_vertices(G, digraph:vertices(G) --
+ digraph_utils:reachable(RootApps, G));
false -> ok
end,
digraph_utils:topsort(G)
diff --git a/src/rabbit.erl b/src/rabbit.erl
index f2aa18a322..2070713e0e 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -305,36 +305,36 @@ ensure_application_loaded() ->
end.
start() ->
- boot_with(fun() ->
- %% We do not want to HiPE compile or upgrade
- %% mnesia after just restarting the app
- ok = ensure_application_loaded(),
- ok = ensure_working_log_handlers(),
- rabbit_node_monitor:prepare_cluster_status_files(),
- rabbit_mnesia:check_cluster_consistency(),
- ok = rabbit_boot:start(app_startup_order()),
- ok = log_broker_started(rabbit_plugins:active())
- end).
+ start_it(fun() ->
+ %% We do not want to HiPE compile or upgrade
+ %% mnesia after just restarting the app
+ ok = ensure_application_loaded(),
+ ok = ensure_working_log_handlers(),
+ rabbit_node_monitor:prepare_cluster_status_files(),
+ rabbit_mnesia:check_cluster_consistency(),
+ ok = rabbit_boot:start(app_startup_order()),
+ ok = log_broker_started(rabbit_plugins:active())
+ end).
boot() ->
- boot_with(fun() ->
- ok = ensure_application_loaded(),
- Success = maybe_hipe_compile(),
- ok = ensure_working_log_handlers(),
- warn_if_hipe_compilation_failed(Success),
- rabbit_node_monitor:prepare_cluster_status_files(),
- ok = rabbit_upgrade:maybe_upgrade_mnesia(),
- %% It's important that the consistency check happens after
- %% the upgrade, since if we are a secondary node the
- %% primary node will have forgotten us
- rabbit_mnesia:check_cluster_consistency(),
- Plugins = rabbit_plugins:setup(),
- ToBeLoaded = Plugins ++ ?APPS,
- ok = rabbit_boot:start(ToBeLoaded),
- ok = log_broker_started(Plugins)
- end).
-
-boot_with(StartFun) ->
+ start_it(fun() ->
+ ok = ensure_application_loaded(),
+ Success = maybe_hipe_compile(),
+ ok = ensure_working_log_handlers(),
+ warn_if_hipe_compilation_failed(Success),
+ rabbit_node_monitor:prepare_cluster_status_files(),
+ ok = rabbit_upgrade:maybe_upgrade_mnesia(),
+ %% It's important that the consistency check happens after
+ %% the upgrade, since if we are a secondary node the
+ %% primary node will have forgotten us
+ rabbit_mnesia:check_cluster_consistency(),
+ Plugins = rabbit_plugins:setup(),
+ ToBeLoaded = Plugins ++ ?APPS,
+ ok = rabbit_boot:start(ToBeLoaded),
+ ok = log_broker_started(Plugins)
+ end).
+
+start_it(StartFun) ->
Marker = spawn_link(fun() -> receive stop -> ok end end),
case catch register(rabbit_boot, Marker) of
true -> try
@@ -358,8 +358,13 @@ boot_with(StartFun) ->
end.
stop() ->
+ Apps = app_shutdown_order(),
+ case whereis(?MODULE) of
+ undefined -> ok;
+ _ -> app_utils:wait_for_applications(Apps)
+ end,
rabbit_log:info("Stopping RabbitMQ~n"),
- rabbit_boot:shutdown(app_shutdown_order()).
+ ok = app_utils:stop_applications(Apps).
stop_and_halt() ->
try
@@ -604,8 +609,8 @@ boot_error(Reason, Stacktrace) ->
boot_error(Reason, Fmt, Args, Stacktrace).
-ifdef(use_specs).
--spec(boot_error/4 :: (term(), string(), [any()], not_available | [tuple()])
- -> no_return()).
+-spec(boot_error/4 :: (term(), string(), [any()], not_available | [tuple()])
+ -> no_return()).
-endif.
boot_error(Reason, Fmt, Args, not_available) ->
basic_boot_error(Reason, Fmt, Args);
diff --git a/src/rabbit_boot.erl b/src/rabbit_boot.erl
index 7fa5b0e6ec..0b7b71a324 100644
--- a/src/rabbit_boot.erl
+++ b/src/rabbit_boot.erl
@@ -17,7 +17,6 @@
-module(rabbit_boot).
-export([prepare_boot_table/0]).
--export([shutdown/1]).
-export([start/1, stop/1]).
-export([already_run/1, mark_complete/1]).
@@ -26,7 +25,6 @@
-spec(prepare_boot_table/0 :: () -> 'ok').
-spec(already_run/1 :: (atom()) -> boolean()).
-spec(mark_complete/1 :: (atom()) -> 'ok').
--spec(shutdown/1 :: ([atom()]) -> 'ok').
-spec(start/1 :: ([atom()]) -> 'ok').
-spec(stop/1 :: ([atom()]) -> 'ok').
@@ -51,15 +49,6 @@
prepare_boot_table() ->
ets:new(?MODULE, [named_table, public, ordered_set]).
-shutdown(Apps) ->
- case whereis(?MODULE) of
- undefined -> ok;
- _ -> await_startup(Apps)
- end,
- %% TODO: put this back in somewhere sensible...
- %% rabbit_log:info("Stopping RabbitMQ~n"),
- ok = app_utils:stop_applications(Apps).
-
start(Apps) ->
force_reload(Apps),
StartupApps = app_utils:app_dependency_order(Apps, false),
@@ -136,9 +125,6 @@ load_mod(Mod) ->
_ -> code:load_file(Mod)
end.
-await_startup(Apps) ->
- app_utils:wait_for_applications(Apps).
-
handle_app_error(Term) ->
fun(App, {bad_return, {_MFA, {'EXIT', {ExitReason, _}}}}) ->
throw({Term, App, ExitReason});