summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon MacMullen <simon@rabbitmq.com>2013-11-28 11:20:09 +0000
committerSimon MacMullen <simon@rabbitmq.com>2013-11-28 11:20:09 +0000
commit1aac7846e509bdc7ada3463eb00e908d51dd587f (patch)
tree8b3088ac3c22b614fbeaec51537edf97a27f2048
parent13fed1542b8122d420ef51cc83001567df4bdfcb (diff)
downloadrabbitmq-server-1aac7846e509bdc7ada3463eb00e908d51dd587f.tar.gz
Do nothing if the rabbit application is already running. Similarly, don't explode if the boot marker is there, just do nothing.
-rw-r--r--src/rabbit.erl32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/rabbit.erl b/src/rabbit.erl
index 1b7fe6da..045c5d58 100644
--- a/src/rabbit.erl
+++ b/src/rabbit.erl
@@ -347,19 +347,25 @@ handle_app_error(App, Reason) ->
start_it(StartFun) ->
Marker = spawn_link(fun() -> receive stop -> ok end end),
- register(rabbit_boot, Marker),
- try
- StartFun()
- catch
- throw:{could_not_start, _App, _Reason}=Err ->
- boot_error(Err, not_available);
- _:Reason ->
- boot_error(Reason, erlang:get_stacktrace())
- after
- unlink(Marker),
- Marker ! stop,
- %% give the error loggers some time to catch up
- timer:sleep(100)
+ case catch register(rabbit_boot, Marker) of
+ true -> try
+ case is_running() of
+ true -> ok;
+ false -> StartFun()
+ end
+ catch
+ throw:{could_not_start, _App, _Reason}=Err ->
+ boot_error(Err, not_available);
+ _:Reason ->
+ boot_error(Reason, erlang:get_stacktrace())
+ after
+ unlink(Marker),
+ Marker ! stop,
+ %% give the error loggers some time to catch up
+ timer:sleep(100)
+ end;
+ _ -> unlink(Marker),
+ Marker ! stop
end.
stop() ->