|
@ -13,7 +13,6 @@ import org.apache.http.client.methods.HttpDelete;
|
|
|
import org.apache.http.client.utils.URIBuilder;
|
|
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.http.impl.client.HttpClients;
|
|
|
import org.springframework.beans.factory.DisposableBean;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
@ -28,7 +27,7 @@ import java.util.Map;
|
|
|
* @created Airhead 2016/8/1.
|
|
|
*/
|
|
|
@Component("brokerServerService")
|
|
|
public class BrokerServerService implements DisposableBean {
|
|
|
public class BrokerServerService {
|
|
|
private static boolean registered = false;
|
|
|
@Autowired
|
|
|
private ApplicationConfiguration applicationConfiguration;
|
|
@ -41,7 +40,7 @@ public class BrokerServerService implements DisposableBean {
|
|
|
private String hostAddress;
|
|
|
private int port;
|
|
|
|
|
|
public void brokerServerOnline() {
|
|
|
public void online() {
|
|
|
try {
|
|
|
hostName = InetAddressUtil.getLocalHostName();
|
|
|
hostAddress = IPChoiceUtils.getSourceIP();
|
|
@ -71,7 +70,7 @@ public class BrokerServerService implements DisposableBean {
|
|
|
/**
|
|
|
* brokerServer下线时通知
|
|
|
*/
|
|
|
public void brokerServerOffline() {
|
|
|
public void offline() {
|
|
|
try {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
ObjectNode objectNode = objectMapper.createObjectNode();
|
|
@ -95,9 +94,4 @@ public class BrokerServerService implements DisposableBean {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void destroy() throws Exception {
|
|
|
// this.brokerServerOffline();
|
|
|
}
|
|
|
}
|