Merge branch 'dev' into dev_v2.6.0

This commit is contained in:
kingdomrushing
2022-01-13 11:39:50 +08:00
committed by GitHub
93 changed files with 1441 additions and 408 deletions

View File

@@ -109,10 +109,5 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -9,7 +9,7 @@ public class Constant {
public static final Integer MAX_AVG_BYTES_DURATION = 10;
public static final Integer BATCH_INSERT_SIZE = 50;
public static final Integer BATCH_INSERT_SIZE = 30;
public static final Integer DEFAULT_SESSION_TIMEOUT_UNIT_MS = 30000;

View File

@@ -25,6 +25,8 @@ public class MineTopicSummary {
private Integer access;
private String description;
public Long getLogicalClusterId() {
return logicalClusterId;
}
@@ -105,6 +107,14 @@ public class MineTopicSummary {
this.access = access;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "MineTopicSummary{" +

View File

@@ -27,8 +27,11 @@ public class OrderVO {
@ApiModelProperty(value = "工单状态, 0:待审批, 1:通过, 2:拒绝, 3:取消")
private Integer status;
@ApiModelProperty(value = "申请/审核时间")
private Date gmtTime;
@ApiModelProperty(value = "申请时间")
private Date gmtCreate;
@ApiModelProperty(value = "审核时间")
private Date gmtHandle;
public Long getId() {
return id;
@@ -70,12 +73,20 @@ public class OrderVO {
this.status = status;
}
public Date getGmtTime() {
return gmtTime;
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtTime(Date gmtTime) {
this.gmtTime = gmtTime;
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
public Date getGmtHandle() {
return gmtHandle;
}
public void setGmtHandle(Date gmtHandle) {
this.gmtHandle = gmtHandle;
}
public String getApplicant() {
@@ -95,7 +106,7 @@ public class OrderVO {
", applicant='" + applicant + '\'' +
", description='" + description + '\'' +
", status=" + status +
", gmtTime=" + gmtTime +
", gmtTime=" + gmtCreate +
'}';
}
}

View File

@@ -36,6 +36,9 @@ public class TopicMineVO {
@ApiModelProperty(value = "状态, 0:无权限, 1:可消费 2:可发送 3:可消费发送 4:可管理")
private Integer access;
@ApiModelProperty(value = "备注")
private String description;
public Long getClusterId() {
return clusterId;
}
@@ -108,6 +111,14 @@ public class TopicMineVO {
this.access = access;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "TopicMineVO{" +

View File

@@ -0,0 +1,20 @@
package com.xiaojukeji.kafka.manager.common.events;
import com.xiaojukeji.kafka.manager.common.entity.pojo.RegionDO;
import lombok.Getter;
import org.springframework.context.ApplicationEvent;
/**
* Region创建事件
* @author zengqiao
* @date 22/01/1
*/
@Getter
public class RegionCreatedEvent extends ApplicationEvent {
private final RegionDO regionDO;
public RegionCreatedEvent(Object source, RegionDO regionDO) {
super(source);
this.regionDO = regionDO;
}
}

View File

@@ -0,0 +1,20 @@
package com.xiaojukeji.kafka.manager.common.utils;
public class BackoffUtils {
private BackoffUtils() {
}
public static void backoff(long timeUnitMs) {
if (timeUnitMs <= 0) {
return;
}
try {
Thread.sleep(timeUnitMs);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (Exception e) {
// ignore
}
}
}

View File

@@ -1,5 +1,6 @@
package com.xiaojukeji.kafka.manager.common.utils.jmx;
import com.xiaojukeji.kafka.manager.common.utils.BackoffUtils;
import com.xiaojukeji.kafka.manager.common.utils.ValidateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -13,7 +14,6 @@ import javax.naming.Context;
import javax.rmi.ssl.SslRMIClientSocketFactory;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -25,19 +25,25 @@ import java.util.concurrent.atomic.AtomicInteger;
* @date 2015/11/9.
*/
public class JmxConnectorWrap {
private final static Logger LOGGER = LoggerFactory.getLogger(JmxConnectorWrap.class);
private static final Logger LOGGER = LoggerFactory.getLogger(JmxConnectorWrap.class);
private String host;
private final Long physicalClusterId;
private int port;
private final Integer brokerId;
private final String host;
private final int port;
private JMXConnector jmxConnector;
private AtomicInteger atomicInteger;
private final AtomicInteger atomicInteger;
private JmxConfig jmxConfig;
public JmxConnectorWrap(String host, int port, JmxConfig jmxConfig) {
public JmxConnectorWrap(Long physicalClusterId, Integer brokerId, String host, int port, JmxConfig jmxConfig) {
this.physicalClusterId = physicalClusterId;
this.brokerId = brokerId;
this.host = host;
this.port = port;
this.jmxConfig = jmxConfig;
@@ -67,7 +73,7 @@ public class JmxConnectorWrap {
try {
jmxConnector.close();
} catch (IOException e) {
LOGGER.warn("close JmxConnector exception, host:{} port:{}.", host, port, e);
LOGGER.warn("close JmxConnector exception, physicalClusterId:{} brokerId:{} host:{} port:{}.", physicalClusterId, brokerId, host, port, e);
}
}
@@ -90,12 +96,12 @@ public class JmxConnectorWrap {
}
jmxConnector = JMXConnectorFactory.connect(new JMXServiceURL(jmxUrl), environment);
LOGGER.info("JMX connect success, host:{} port:{}.", host, port);
LOGGER.info("JMX connect success, physicalClusterId:{} brokerId:{} host:{} port:{}.", physicalClusterId, brokerId, host, port);
return true;
} catch (MalformedURLException e) {
LOGGER.error("JMX url exception, host:{} port:{} jmxUrl:{}", host, port, jmxUrl, e);
LOGGER.error("JMX url exception, physicalClusterId:{} brokerId:{} host:{} port:{} jmxUrl:{}", physicalClusterId, brokerId, host, port, jmxUrl, e);
} catch (Exception e) {
LOGGER.error("JMX connect exception, host:{} port:{}.", host, port, e);
LOGGER.error("JMX connect exception, physicalClusterId:{} brokerId:{} host:{} port:{}.", physicalClusterId, brokerId, host, port, e);
}
return false;
}
@@ -146,18 +152,16 @@ public class JmxConnectorWrap {
long now = System.currentTimeMillis();
while (true) {
try {
if (System.currentTimeMillis() - now > 60000) {
break;
}
int num = atomicInteger.get();
if (num <= 0) {
Thread.sleep(2);
continue;
BackoffUtils.backoff(2);
}
if (atomicInteger.compareAndSet(num, num - 1)) {
if (atomicInteger.compareAndSet(num, num - 1) || System.currentTimeMillis() - now > 6000) {
break;
}
} catch (Exception e) {
// ignore
}
}
}