Browse Source

打印下worerId up2

master
jianjun 4 years ago
parent
commit
e318a525b3
  1. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/MySequence.java

10
epmet-user/epmet-user-server/src/main/java/com/epmet/MySequence.java

@ -20,6 +20,7 @@ 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 lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
@ -36,6 +37,7 @@ import java.util.concurrent.ThreadLocalRandom;
* @author hubin
* @since 2016-08-18
*/
@Slf4j
public class MySequence {
private static final Log logger = LogFactory.getLog(MySequence.class);
@ -80,7 +82,7 @@ public class MySequence {
public MySequence() {
this.datacenterId = getDatacenterId(maxDatacenterId);
this.workerId = getMaxWorkerId(datacenterId, maxWorkerId);
logger.warn("MySequence datacenterId:"+this.datacenterId+";workerId:"+this.workerId);
log.info("MySequence datacenterId:"+this.datacenterId+";workerId:"+this.workerId);
}
/**
@ -105,7 +107,7 @@ public class MySequence {
StringBuilder mpid = new StringBuilder();
mpid.append(datacenterId);
String name = ManagementFactory.getRuntimeMXBean().getName();
logger.warn("MySequence getMaxWorkerId name:"+name);
log.info("MySequence getMaxWorkerId name:"+name);
if (StringUtils.isNotBlank(name)) {
/*
* GET jvmPid
@ -126,10 +128,10 @@ public class MySequence {
try {
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
logger.warn("MySequence ip:"+JSON.toJSONString(ip)+";network: "+JSON.toJSONString(network));
log.info("MySequence ip:"+JSON.toJSONString(ip)+";network: "+JSON.toJSONString(network));
if (network == null) {
id = 1L;
logger.warn("MySequen cenetwork ==null ");
log.info("MySequen cenetwork ==null ");
} else {
byte[] mac = network.getHardwareAddress();
if (null != mac) {

Loading…
Cancel
Save