1 %% The contents of this file are subject to the Mozilla Public License
2 %% Version 1.1 (the "License"); you may not use this file except in
3 %% compliance with the License. You may obtain a copy of the License
4 %% at http://www.mozilla.org/MPL/
6 %% Software distributed under the License is distributed on an "AS IS"
7 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
8 %% the License for the specific language governing rights and
9 %% limitations under the License.
11 %% The Original Code is RabbitMQ.
13 %% The Initial Developer of the Original Code is VMware, Inc.
14 %% Copyright (c) 2007-2013 VMware, Inc. All rights reserved.
17 -module(worker_pool_sup).
19 -behaviour(supervisor).
21 -export([start_link/0, start_link/1]).
25 %%----------------------------------------------------------------------------
29 -spec(start_link/0 :: () -> rabbit_types:ok_pid_or_error()).
30 -spec(start_link/1 :: (non_neg_integer()) -> rabbit_types:ok_pid_or_error()).
34 %%----------------------------------------------------------------------------
36 -define(SERVER, ?MODULE).
38 %%----------------------------------------------------------------------------
41 start_link(erlang:system_info(schedulers)).
44 supervisor:start_link({local, ?SERVER}, ?MODULE, [WCount]).
46 %%----------------------------------------------------------------------------
49 {ok, {{one_for_one, 10, 10},
50 [{worker_pool, {worker_pool, start_link, []}, transient,
51 16#ffffffff, worker, [worker_pool]} |
52 [{N, {worker_pool_worker, start_link, [N]}, transient, 16#ffffffff,
53 worker, [worker_pool_worker]} || N <- lists:seq(1, WCount)]]}}.