Skip to content
Permalink
Browse files
optimize: change env init order
  • Loading branch information
DLive committed May 8, 2019
1 parent 509e7b7 commit ae9bb5ff497b1f9635051cdede40d37889997e9b
Showing 4 changed files with 40 additions and 10 deletions.
@@ -46,9 +46,8 @@ start_provider()->
ok.

start_provider_listen(Port)->
ets:new(?PROVIDER_IMPL_TABLE,[public,named_table]),
{ok, _} = ranch:start_listener(tcp_reverse,
ranch_tcp, [{port, Port}], dubbo_provider_protocol, []),
ranch_tcp, [{port, Port},{reuseaddr, true}], dubbo_provider_protocol, []),
ok.


@@ -7,6 +7,7 @@

-behaviour(application).

-include("dubboerl.hrl").
%% Application callbacks
-export([start/2, stop/1,env_init/0]).

@@ -16,7 +17,7 @@

start(_StartType, _StartArgs) ->
io:format("[START] dubbo framework server start~n"),
env_init(),
%% env_init(),
dubboerl_sup:start_link().

%%--------------------------------------------------------------------
@@ -27,6 +28,7 @@ stop(_State) ->
%% Internal functions
%%====================================================================
env_init()->
ets:new(?PROVIDER_IMPL_TABLE,[public,named_table]),
dubbo_traffic_control:init(),
type_register:init(),
register_type_list().
@@ -29,19 +29,13 @@ start_link() ->

%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
init([]) ->
dubboerl_app:env_init(),
ZK = {dubbo_zookeeper,{dubbo_zookeeper, start_link, []},transient,5000,worker,[dubbo_zookeeper]},
%% NettySer = {dubbo_netty_client,{dubbo_netty_client, start_link, []},transient,5000,worker,[dubbo_netty_client]},
Id_count = {dubbo_id_generator,{dubbo_id_generator, start_link, []},transient,5000,worker,[dubbo_id_generator]},
ProviderPoolSup = {dubbo_provider_worker_sup,{dubbo_provider_worker_sup, start_link, []},transient,5000,supervisor,[dubbo_provider_worker_sup]},
ConsumerPoolSup = {dubbo_consumer_pool_sup,{dubbo_consumer_pool_sup, start_link, []},transient,5000,supervisor,[dubbo_consumer_pool_sup]},
ConsumerPool = {dubbo_consumer_pool,{dubbo_consumer_pool, start_link, []},transient,5000,worker,[dubbo_consumer_pool]},
%% Reloader = {push_reloader,{push_reloader, start_link, []},transient,5000,worker,[push_reloader]},
%% List = case ?RELOADER of
%% true ->
%% io:format("[START] will start push_reloader service2222~n"),
%% [Reloader];
%% _->[]
%% end,
ListNew1=
case application:get_env(dubboerl,registry,false) of
true ->
@@ -0,0 +1,35 @@
%%%-------------------------------------------------------------------
%% @doc dubbo_service top level supervisor.
%% @end
%%%-------------------------------------------------------------------

-module(dubbo_service_sup).

-behaviour(supervisor).

%% API
-export([start_link/0]).

%% Supervisor callbacks
-export([init/1]).

-define(SERVER, ?MODULE).

%%====================================================================
%% API functions
%%====================================================================

start_link() ->
supervisor:start_link({local, ?SERVER}, ?MODULE, []).

%%====================================================================
%% Supervisor callbacks
%%====================================================================

%% Child :: {Id,StartFunc,Restart,Shutdown,Type,Modules}
init([]) ->
{ok, { {one_for_all, 0, 1}, []} }.

%%====================================================================
%% Internal functions
%%====================================================================

0 comments on commit ae9bb5f

Please sign in to comment.