|
|
@ -13,13 +13,14 @@ |
|
|
|
* See the License for the specific language governing permissions and |
|
|
|
* limitations under the License. |
|
|
|
*/ |
|
|
|
package com.epmet; |
|
|
|
package com.epmet.util; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Assert; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringPool; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.SystemClock; |
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.ibatis.logging.Log; |
|
|
|
import org.apache.ibatis.logging.LogFactory; |
|
|
@ -82,7 +83,9 @@ public class MySequence { |
|
|
|
public MySequence() { |
|
|
|
this.datacenterId = getDatacenterId(maxDatacenterId); |
|
|
|
this.workerId = getMaxWorkerId(datacenterId, maxWorkerId); |
|
|
|
log.info("MySequence datacenterId:"+this.datacenterId+";workerId:"+this.workerId); |
|
|
|
String msg = "MySequence datacenterId:" + this.datacenterId + ";workerId:" + this.workerId; |
|
|
|
log.info(msg); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(msg); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -107,7 +110,9 @@ public class MySequence { |
|
|
|
StringBuilder mpid = new StringBuilder(); |
|
|
|
mpid.append(datacenterId); |
|
|
|
String name = ManagementFactory.getRuntimeMXBean().getName(); |
|
|
|
log.info("MySequence getMaxWorkerId name:"+name); |
|
|
|
String msg = "MySequence getMaxWorkerId name:" + name; |
|
|
|
log.info(msg); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(msg); |
|
|
|
if (StringUtils.isNotBlank(name)) { |
|
|
|
/* |
|
|
|
* GET jvmPid |
|
|
@ -128,7 +133,9 @@ public class MySequence { |
|
|
|
try { |
|
|
|
InetAddress ip = InetAddress.getLocalHost(); |
|
|
|
NetworkInterface network = NetworkInterface.getByInetAddress(ip); |
|
|
|
log.info("MySequence ip:"+JSON.toJSONString(ip)+";network: "+JSON.toJSONString(network)); |
|
|
|
String msg = "MySequence ip:" + JSON.toJSONString(ip) + ";network: " + JSON.toJSONString(network); |
|
|
|
log.info(msg); |
|
|
|
HttpClientManager.getInstance().sendAlarmMsg(msg); |
|
|
|
if (network == null) { |
|
|
|
id = 1L; |
|
|
|
log.info("MySequen cenetwork ==null "); |