-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsupervisor_1_1_1_1_2.erl
109 lines (90 loc) · 4.7 KB
/
supervisor_1_1_1_1_2.erl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
%%% ------------------------------------------------------------------------------------------------
%%% File : supervisor_1_1_1_1_2.erl
%%% Purpose : Testing the template.
%%% Created : Sunday, May 23 2021.
%%% Author : Pierre Rouleau <[email protected]>
%%% Time-stamp: <2021-05-23 02:39:05, updated by Pierre Rouleau>
%%% Copyright (C) 2021 Pierre Rouleau
%%%
%%% Permission is hereby granted, free of charge, to any person obtaining a copy
%%% of this software and associated documentation files (the "Software"), to deal
%%% in the Software without restriction, including without limitation the rights
%%% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
%%% copies of the Software, and to permit persons to whom the Software is
%%% furnished to do so, subject to the following conditions:
%%% The above copyright notice and this permission notice shall be included in
%%% all copies or substantial portions of the Software.
%%%
%%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
%%% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
%%% THE SOFTWARE.
%%% ------------------------------------------------------------------------------------------------
%%% Module Description: Testing the template.
%%%
%%% [
% This text inside the square brackets is normally NOT generated by the template!
% It is here only to show the value of the user-options used to generate the content.
% This file was generated by the test function: pel--erlang-all-sk-file-header
% This file was generated with the following user-options values:
% - pel-erlang-skel-use-separators : t
% - pel-erlang-skel-use-secondary-separators : t
% - pel-erlang-skel-insert-file-timestamp : t
% - pel-erlang-skel-with-license : t
% - pel-erlang-skel-with-edoc : in-function-only
% ]
%%% ================================================================================================
-module(supervisor_1_1_1_1_2).
-behaviour(supervisor).
%% supervisor_1_1_1_1_2 API
-export([start_link/0]).
%% supervisor callbacks
-export([init/1]).
-define(SERVER, ?MODULE).
%%% ================================================================================================
%%% supervisor_1_1_1_1_2 API Functions
%%% ================================================================================================
%% -------------------------------------------------------------------------------------------------
%% @doc Start the supervisor.
%% -------------------------------------------------------------------------------------------------
-spec start_link() -> {ok, Pid :: pid()} |
{error, {already_started, Pid :: pid()}} |
{error, {shutdown, term()}} |
{error, term()} |
ignore.
start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
%%% ================================================================================================
%%% Supervisor callbacks
%%% ================================================================================================
%% -------------------------------------------------------------------------------------------------
%% @private
%% @doc Initialize the server.
%% Called by the new process when a supervisor is started
%% using supervisor:start_link/[2,3] to find out about
%% restart strategy, maximum restart intensity, and child
%% specifications.
%% @end
%% -------------------------------------------------------------------------------------------------
-spec init(Args :: term()) ->
{ok, {SupFlags :: supervisor:sup_flags(),
[ChildSpec :: supervisor:child_spec()]}} |
ignore.
init([]) ->
SupFlags = #{strategy => one_for_one,
intensity => 1,
period => 5},
AChild = #{id => 'AName',
start => {'AModule', start_link, []},
restart => permanent,
shutdown => 5000,
type => worker,
modules => ['AModule']},
{ok, {SupFlags, [AChild]}}.
%%% ================================================================================================
%%% supervisor_1_1_1_1_2 Internal functions
%%% ================================================================================================
%%% ------------------------------------------------------------------------------------------------