~ubuntu-branches/ubuntu/trusty/rabbitmq-server/trusty

« back to all changes in this revision

Viewing changes to src/rabbit.erl

  • Committer: Package Import Robot
  • Author(s): Emile Joubert
  • Date: 2013-12-11 17:31:14 UTC
  • mfrom: (0.5.9) (0.1.45 sid)
  • Revision ID: package-import@ubuntu.com-20131211173114-rvd3b6vk56w595na
Tags: 3.2.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
347
347
 
348
348
start_it(StartFun) ->
349
349
    Marker = spawn_link(fun() -> receive stop -> ok end end),
350
 
    register(rabbit_boot, Marker),
351
 
    try
352
 
        StartFun()
353
 
    catch
354
 
        throw:{could_not_start, _App, _Reason}=Err ->
355
 
            boot_error(Err, not_available);
356
 
         _:Reason ->
357
 
            boot_error(Reason, erlang:get_stacktrace())
358
 
    after
359
 
        unlink(Marker),
360
 
        Marker ! stop,
361
 
        %% give the error loggers some time to catch up
362
 
        timer:sleep(100)
 
350
    case catch register(rabbit_boot, Marker) of
 
351
        true -> try
 
352
                    case is_running() of
 
353
                        true  -> ok;
 
354
                        false -> StartFun()
 
355
                    end
 
356
                catch
 
357
                    throw:{could_not_start, _App, _Reason}=Err ->
 
358
                        boot_error(Err, not_available);
 
359
                    _:Reason ->
 
360
                        boot_error(Reason, erlang:get_stacktrace())
 
361
                after
 
362
                    unlink(Marker),
 
363
                    Marker ! stop,
 
364
                    %% give the error loggers some time to catch up
 
365
                    timer:sleep(100)
 
366
                end;
 
367
        _    -> unlink(Marker),
 
368
                Marker ! stop
363
369
    end.
364
370
 
365
371
stop() ->