org.zodiac.sentinel.base.config.SentinelTransportInfo Maven / Gradle / Ivy
package org.zodiac.sentinel.base.config;
import java.util.Objects;
import org.zodiac.commons.util.Networks;
import org.zodiac.sentinel.base.constants.SentinelBaseConstants;
public class SentinelTransportInfo {
/**
* Sentinel api port, default value is 8719 {@code com.alibaba.csp.sentinel.transport.config.TransportConfig#SERVER_PORT}.
*/
private int port = SentinelBaseConstants.DEFAULT_API_PORT;
/**
* Sentinel dashboard address, won't try to connect dashboard when address is
*/
private String dashboard = "";
/**
* Send heartbeat interval millisecond
*/
private String heartbeatMills;
/**
* Get heartbeat client local ip. If the client ip not configured, it will be the
* address of local host.
*/
private String clientIp = Networks.LOCAL_ADDRESS_IP;
public SentinelTransportInfo() {
super();
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getDashboard() {
return dashboard;
}
public void setDashboard(String dashboard) {
this.dashboard = dashboard;
}
public String getHeartbeatMills() {
return heartbeatMills;
}
public void setHeartbeatMills(String heartbeatMills) {
this.heartbeatMills = heartbeatMills;
}
public String getClientIp() {
return clientIp;
}
public void setClientIp(String clientIp) {
this.clientIp = clientIp;
}
@Override
public int hashCode() {
return Objects.hash(clientIp, dashboard, heartbeatMills, port);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SentinelTransportInfo other = (SentinelTransportInfo)obj;
return Objects.equals(clientIp, other.clientIp) && Objects.equals(dashboard, other.dashboard)
&& Objects.equals(heartbeatMills, other.heartbeatMills) && port == other.port;
}
@Override
public String toString() {
return "SentinelTransportInfo [port=" + port + ", dashboard=" + dashboard + ", heartbeatMills=" + heartbeatMills
+ ", clientIp=" + clientIp + "]";
}
}