Skip to content
Permalink
Browse files
code optimization
  • Loading branch information
DLive committed Apr 24, 2019
1 parent 840199b commit 6416693dc420cac318ea0c742e889860fac15a3f
Showing 5 changed files with 6 additions and 193 deletions.
@@ -167,11 +167,11 @@ get_index(Type,Max)->
%%% Internal functions
%%%===================================================================
init_table()->
try ets:new(de_id_count_table, [public,named_table]) of
de_id_count_table ->
try ets:new(?INDEX_ETS_TABLE, [public,named_table]) of
?INDEX_ETS_TABLE ->
ets:insert(?INDEX_ETS_TABLE,{cur_index,1}),
ok
catch
_Type:Reason ->
io:format("error init auto inc table reason:~p~n",[Reason])
logger:error("[DUBBO] error init auto inc table reason:~p",[Reason])
end.
@@ -43,35 +43,10 @@ java_to_native(#object{values = ForeignData}=Data,State)->
java_to_native(#list{values = ForeignData}=Data,State)->
ForeignDataNew = [java_to_native(ValueItem,State) || ValueItem <-ForeignData ],
ForeignDataNew;
%% case hessianDecode2:get_deftype(Data#list.refNo,State) of
%% #type_def{fieldnames = ObjectFields,foreign_type = ForeignType } ->
%% case get_deftype(ForeignType) of
%% false->
%% error;
%% #type_def{fieldnames = NativeFields,native_type = NativeTupeName}->
%% logger:debug("test ForeignType ~p NativeTupeName ~p",[ForeignType,NativeTupeName]),
%%%% AsDict = dict:from_list(lists:zip(ObjectFields,ForeignDataNew)),
%%%% NativeData = [dict:fetch(atom_to_binary(Key,utf8),AsDict) || Key <- NativeFields],
%%%% list_to_tuple( [NativeTupeName] ++ NativeData)
%% ForeignDataNew
%% end;
%% Info ->
%% logger:warning("java_to_native list error:~p",[Info]),
%% error
%% end;
java_to_native(Data,_)->
logger:debug("java_to_native unkonw type ~p",[Data]),
Data.

%%get_deftype([Item |DefTypeList],ForeignType)->
%% if
%% Item#type_def.foreign_type == ForeignType -> Item;
%% true ->
%% get_deftype(DefTypeList,ForeignType)
%% end;
%%get_deftype([],_ForeignType)->
%% false.

get_deftype(ForeignType)->

case type_register:lookup_foreign_type(ForeignType) of
@@ -90,15 +65,5 @@ pre_process_typedef(NativeType,ForeignType,FieldsNames)->
Type = #type_def{native_type = NativeType,foreign_type = ForeignType,fieldnames = FieldsNames},
%% Type2=type_decoding:hash_store(Type),
type_register:regiest_foreign_native(Type),
logger:debug("pre_process_typedef ~p,~p",[NativeType,ForeignType]).
%% case type_decoding:resolve_native_type(ForeignType) of
%% undefined ->
%%%% Type = #type_def{native_type = NativeType, foreign_type = ForeignType, fieldnames = record_info(fields,NativeType)},
%% Type = #type_def{native_type = NativeType,foreign_type = ForeignType,fieldnames = FieldsNames},
%% Type2=type_decoding:hash_store(Type),
%%
%% logger:debug("pre_process_typedef ~p,~p",[NativeType,ForeignType]);
%% type_decoding:store_typepool(Type2);
%% _->
%% ok
%% end.
logger:debug("pre_process_typedef ~p,~p",[NativeType,ForeignType]),
ok.

This file was deleted.

@@ -68,12 +68,6 @@ start_link(Name,HostFlag,ProviderConfig,Index) ->
{stop, Reason :: term()} | ignore).
init([HostFlag,ProviderConfig,Index]) ->
erlang:process_flag(min_bin_vheap_size, 1024*1024),
%% erlang:process_flag(min_heap_size, 1024*1024),
%% BindScheduler = (Index rem erlang:system_info(schedulers_online))+1,
%% logger:info("will bind to scheduler ~p",[BindScheduler]),
%% erlang:process_flag(scheduler, BindScheduler),
%% erlang:process_flag(priority, high),

#provider_config{host = Host,port = Port}=ProviderConfig,
State = case open(Host,Port) of
{ok,Socket} ->
@@ -17,7 +17,7 @@ parse_provider_info(ProviderStr) when is_binary(ProviderStr)->
parse_provider_info(binary_to_list(ProviderStr));
parse_provider_info(ProviderStr)->
case http_uri:parse(http_uri:decode(ProviderStr),[{scheme_defaults,[{dubbo,20880}]}]) of
{ok, {Scheme, UserInfo, Host, Port, Path, Query}} ->
{ok, {Scheme, _UserInfo, Host, Port, _Path, Query}} ->
QueryStr = case lists:prefix("?",Query) of
true ->
[_|Query2] = Query,

0 comments on commit 6416693

Please sign in to comment.