1
%% ``The contents of this file are subject to the Erlang Public License,
2
%% Version 1.1, (the "License"); you may not use this file except in
3
%% compliance with the License. You should have received a copy of the
4
%% Erlang Public License along with this software. If not, it can be
5
%% retrieved via the world wide web at http://www.erlang.org/.
7
%% Software distributed under the License is distributed on an "AS IS"
8
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
9
%% the License for the specific language governing rights and limitations
12
%% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
13
%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
14
%% AB. All Rights Reserved.''
21
-behaviour(gen_server).
24
-export([start_link/0, a/0, b/0]).
26
-export([init/1, handle_call/3, handle_info/2, terminate/2, code_change/3]).
28
start_link() -> gen_server:start_link({local, aa}, a, [], []).
30
a() -> gen_server:call(aa, a).
31
b() -> gen_server:call(aa, b).
33
%%-----------------------------------------------------------------
34
%% Callback functions from gen_server
35
%%-----------------------------------------------------------------
37
process_flag(trap_exit, true),
40
handle_call(a, _From, State) ->
41
X = application:get_all_env(a),
44
handle_call(b, _From, State) ->
45
{reply, {ok, element(2, State)}, State}.
47
handle_info(_, State) ->
50
terminate(_Reason, _State) ->
53
code_change(1, Extra, State) ->