Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. -module(maybe_server).
  2. -behaviour(gen_server).
  3.  
  4. -export([start_link/0, stop/0]).
  5. -export([init/1, terminate/2, handle_call/3, handle_cast/2]).
  6.  
  7. %% EXTERNAL API ------------------------------------------------------------------------------------
  8.  
  9. start_link() -> gen_server:start_link({local, ?MODULE}, ?MODULE, #{}, [{debug, [log, trace]}]).
  10.  
  11. stop() -> gen_server:stop(?MODULE).
  12.  
  13. %% CALLBACKS ---------------------------------------------------------------------------------------
  14.  
  15. init(#{}) ->
  16. error_logger:info_msg("Server ~p starting.~n", [self()]),
  17. {ok, #{}}.
  18.  
  19. terminate(Reason, _State) ->
  20. error_logger:info_msg("Server ~p terminating with reason ~p~n", [self(), Reason]).
  21.  
  22. %% UNUSED CALLBACKS --------------------------------------------------------------------------------
  23.  
  24. handle_call(_Msg, _From, State) -> {noreply, State}.
  25. handle_cast(_Msg, State) -> {noreply, State}.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement