erlang自动编译与加载
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

27 行
1014 B

  1. -module(eSync_sup).
  2. -behaviour(supervisor).
  3. -export([
  4. start_link/0
  5. , init/1
  6. ]).
  7. -define(SERVER, ?MODULE).
  8. -define(ChildSpec(I, Type), #{id => I, start => {I, start_link, []}, restart => permanent, shutdown => 5000, type => Type, modules => [I]}).
  9. start_link() ->
  10. supervisor:start_link({local, ?SERVER}, ?MODULE, []).
  11. %% sup_flags() = #{strategy => strategy(), % optional
  12. %% intensity => non_neg_integer(), % optional
  13. %% period => pos_integer()} % optional
  14. %% child_spec() = #{id => child_id(), % mandatory
  15. %% start => mfargs(), % mandatory
  16. %% restart => restart(), % optional
  17. %% shutdown => shutdown(), % optional
  18. %% type => worker(), % optional
  19. %% modules => modules()} % optional
  20. init([]) ->
  21. SupFlags = #{strategy => one_for_one, intensity => 5, period => 10},
  22. ChildSpecs = [?ChildSpec(esSyncSrv, worker)],
  23. {ok, {SupFlags, ChildSpecs}}.