Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持配置文件指定连接中断后重试时间间隔(原来的程序写死10分钟且不可修改) #283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public class TrackerConnectionManager extends FdfsConnectionManager {
@NotNull
private List<String> trackerList = new ArrayList<String>();

/**
* 连接中断以后经过N秒重试,不配置时默认为10分钟
*/
private int retryAfterSecond;

/**
* 构造函数
*/
Expand All @@ -54,6 +59,11 @@ public TrackerConnectionManager(FdfsConnectionPool pool) {
public void initTracker() {
LOGGER.debug("init trackerLocator {}", trackerList);
trackerLocator = new TrackerLocator(trackerList);
if (0 != retryAfterSecond) {
// 如果 retryAfterSecond != 0则,表示开发者自己配置了;set相关对象的属性值
trackerLocator.setRetryAfterSecond(retryAfterSecond);
LOGGER.debug("update trackerLocator retryAfterSecond to [{}]s", retryAfterSecond);
}
}

/**
Expand Down Expand Up @@ -89,4 +99,12 @@ public List<String> getTrackerList() {
public void setTrackerList(List<String> trackerList) {
this.trackerList = trackerList;
}

public int getRetryAfterSecond() {
return retryAfterSecond;
}

public void setRetryAfterSecond(int retryAfterSecond) {
this.retryAfterSecond = retryAfterSecond;
}
}