summaryrefslogtreecommitdiff
path: root/src/rabbit.erl
diff options
context:
space:
mode:
authorMichael Klishin <michael@clojurewerkz.org>2017-05-08 18:01:10 +0300
committerMichael Klishin <michael@clojurewerkz.org>2017-05-08 18:01:10 +0300
commit7132664520b09cf6e15dc95e91ce73eedd4407e4 (patch)
tree34d0b51dabde73dbde00e2b928e4b52450eaaee8 /src/rabbit.erl
parentd6fa2093375ac295b765261e34213de4a61960b9 (diff)
parent0bd4b78b3540c65648563714239d2a270c9816a4 (diff)
downloadrabbitmq-server-git-7132664520b09cf6e15dc95e91ce73eedd4407e4.tar.gz
Merge branch 'master' into rabbitmq-server-1146-full
Conflicts: Makefile
Diffstat (limited to 'src/rabbit.erl')
-rw-r--r--src/rabbit.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index b63d624293..8e6c9ead26 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -22,7 +22,7 @@
stop_and_halt/0, await_startup/0, status/0, is_running/0, alarms/0,
is_running/1, environment/0, rotate_logs/0, force_event_refresh/1,
start_fhc/0]).
--export([start/2, stop/1]).
+-export([start/2, stop/1, prep_stop/1]).
-export([start_apps/1, stop_apps/1]).
-export([log_locations/0, config_files/0, decrypt_config/2]). %% for testing and mgmt-agent
@@ -327,7 +327,11 @@ broker_start() ->
ToBeLoaded = Plugins ++ ?APPS,
start_apps(ToBeLoaded),
maybe_sd_notify(),
- ok = log_broker_started(rabbit_plugins:strictly_plugins(rabbit_plugins:active())).
+ ok = log_broker_started(rabbit_plugins:strictly_plugins(rabbit_plugins:active())),
+ %% See rabbitmq/rabbitmq-server#1202 for details.
+ rabbit_peer_discovery:maybe_inject_randomized_delay(),
+ rabbit_peer_discovery:maybe_register(),
+ ok.
%% Try to send systemd ready notification if it makes sense in the
%% current environment. standard_error is used intentionally in all
@@ -471,6 +475,8 @@ stop() ->
end,
rabbit_log:info("RabbitMQ is asked to stop...~n", []),
Apps = ?APPS ++ rabbit_plugins:active(),
+ %% this will also perform unregistration with the peer discovery backend
+ %% as needed
stop_apps(app_utils:app_dependency_order(Apps, true)),
rabbit_log:info("Successfully stopped RabbitMQ and its dependencies~n", []).
@@ -759,6 +765,10 @@ start(normal, []) ->
Error
end.
+prep_stop(State) ->
+ rabbit_peer_discovery:maybe_unregister(),
+ State.
+
stop(_State) ->
ok = rabbit_alarm:stop(),
ok = case rabbit_mnesia:is_clustered() of