Code formatting optimization

pull/664/merge
chen.ma 2 years ago
parent 60a1352596
commit 8ee0e4edee

@ -21,17 +21,22 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j;
/**
* web ip and port info
* Web ip and port info
*/
@Data
@Slf4j
public class WebIpAndPortInfo {
protected static final String ALL = "*";
protected static final String SPOT = "\\.";
protected static final String COLON = ":";
private String ip;
private String port;
private String[] ipSegment;
public WebIpAndPortInfo(String ip, String port) {
@ -53,7 +58,7 @@ public class WebIpAndPortInfo {
}
/**
* check
* Check.
*
* @param appIpSegment application ip segment
* @param port application port
@ -63,7 +68,7 @@ public class WebIpAndPortInfo {
}
/**
* check ip
* Check ip.
*
* @param appIpSegment application ip segment
*/
@ -81,7 +86,7 @@ public class WebIpAndPortInfo {
}
/**
* check port
* Check port.
*
* @param port application port
*/
@ -90,7 +95,7 @@ public class WebIpAndPortInfo {
}
/**
* Check whether the strings are the same
* Check whether the strings are the same.
*
* @param appIp appIp
* @param propIp propIp

@ -36,10 +36,11 @@ import java.util.Objects;
public abstract class AbstractRefreshListener<M> implements RefreshListener<Hippo4jConfigDynamicRefreshEvent, M> {
protected static final String ALL = "*";
protected static final String SEPARATOR = ",";
/**
* application ip and application post
* Application ip and application post
*/
protected static volatile WebIpAndPortInfo webIpAndPort;
@ -60,7 +61,7 @@ public abstract class AbstractRefreshListener<M> implements RefreshListener<Hipp
String ip = loopBackHostInfo.getIpAddress();
WebThreadPoolHandlerChoose webThreadPoolHandlerChoose = ApplicationContextHolder.getBean(WebThreadPoolHandlerChoose.class);
WebThreadPoolService webThreadPoolService = webThreadPoolHandlerChoose.choose();
// when get the port at startup, can get the message: "port xxx was already in use" or use two ports
// When get the port at startup, can get the message: "port xxx was already in use" or use two ports
String port = String.valueOf(webThreadPoolService.getWebServer().getPort());
return new WebIpAndPortInfo(ip, port);
}
@ -93,11 +94,11 @@ public abstract class AbstractRefreshListener<M> implements RefreshListener<Hipp
.distinct()
.map(WebIpAndPortInfo::build)
.filter(Objects::nonNull)
.anyMatch(i -> i.check(webIpAndPort.getIpSegment(), webIpAndPort.getPort()));
.anyMatch(each -> each.check(webIpAndPort.getIpSegment(), webIpAndPort.getPort()));
}
/**
* get nodes in new properties
* Get nodes in new properties.
*
* @param properties new properties
* @return nodes in properties
@ -105,5 +106,4 @@ public abstract class AbstractRefreshListener<M> implements RefreshListener<Hipp
protected String getNodes(M properties) {
return ALL;
}
}
Loading…
Cancel
Save