注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

yu.chen的博客

坚持到底就是胜利

 
 
 

日志

 
 
关于我

喜欢数学, 喜欢编程,喜欢开发系统,喜欢逆向工程,喜欢欣赏开源前辈的代码

网易考拉推荐

stack overflow中提的问题,supervisor restart stratgy and childspec  

2012-11-19 07:58:54|  分类: erlang |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

I am reading rabbitmq's supervisor2.erl,rabbit_channel_sup_sup.erl, rabbit_channel_sup.erl source code.

When childspec's start parameter is "temporary", it means the child won't be restarted after any reason of exit. Is it right?

When start parameter is "temporary", there is no difference for every restart parameter, one-for-one, one-for-all,one-for-rest,simple-one-for-one. Because the code running result is same. Is it right?

The following code is from supervisor2.erl file

do_restart({permanent = RestartType, Delay}, Reason, Child, State) ->     do_restart_delay({RestartType, Delay}, Reason, Child, State); do_restart(permanent, Reason, Child, State) ->     report_error(child_terminated, Reason, Child, State#state.name),     restart(Child, State); do_restart(Type, normal, Child, State) ->     del_child_and_maybe_shutdown(Type, Child, State); do_restart({RestartType, Delay}, {shutdown, restart} = Reason, Child, State)   when RestartType =:= transient orelse RestartType =:= intrinsic ->     do_restart_delay({RestartType, Delay}, Reason, Child, State); do_restart(Type, {shutdown, _}, Child, State) ->     del_child_and_maybe_shutdown(Type, Child, State); do_restart(Type, shutdown, Child = #child{child_type = supervisor}, State) ->     del_child_and_maybe_shutdown(Type, Child, State); do_restart({RestartType, Delay}, Reason, Child, State)   when RestartType =:= transient orelse RestartType =:= intrinsic ->     do_restart_delay({RestartType, Delay}, Reason, Child, State); do_restart(Type, Reason, Child, State) when Type =:= transient orelse                                             Type =:= intrinsic ->     report_error(child_terminated, Reason, Child, State#state.name),     restart(Child, State); do_restart(temporary, Reason, Child, State) ->  %%<<----attention here, just report_error,not calling restart child function     report_error(child_terminated, Reason, Child, State#state.name),     NState = state_del_child(Child, State),     {ok, NState}. 
  评论这张
 
阅读(283)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017