Skip to content

Commit 365c87a

Browse files
author
dushixiang
committed
- 去除isReachable验证
- 查询topic数据时增加分页
1 parent 6090969 commit 365c87a

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>cn.typesafe</groupId>
1212
<artifactId>kafka-map</artifactId>
13-
<version>1.1.1</version>
13+
<version>1.1.2</version>
1414
<name>kafka-map</name>
1515
<description>a simple kafka manager</description>
1616
<properties>

src/main/java/cn/typesafe/km/service/ClusterService.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,8 @@ public void create(Cluster cluster) throws ExecutionException, InterruptedExcept
107107
for (String server : cluster.getServers().split(",")) {
108108
String[] split = server.split(":");
109109
String host = split[0];
110-
boolean hostReachable = Networks.isHostReachable(host);
111-
if (!hostReachable) {
112-
throw new IllegalArgumentException("Host " + host + " is not reachable.");
113-
}
114110
int port = Integer.parseInt(split[1]);
115-
boolean hostConnected = Networks.isHostConnected(host, port);
111+
boolean hostConnected = Networks.isHostConnected(host, port, 30000);
116112
if (!hostConnected) {
117113
throw new IllegalArgumentException("server " + server + " can't connected.");
118114
}

src/main/java/cn/typesafe/km/util/Networks.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77

88
public class Networks {
99

10-
public static boolean isHostReachable(String host) {
10+
public static boolean isHostReachable(String host, int timeout) {
1111
try {
12-
return InetAddress.getByName(host).isReachable(1000);
12+
return InetAddress.getByName(host).isReachable(timeout);
1313
} catch (IOException ignored) {
1414

1515
}
1616
return false;
1717
}
1818

19-
public static boolean isHostConnected(String host, int port) {
19+
public static boolean isHostConnected(String host, int port, int timeout) {
2020
try (Socket socket = new Socket()) {
21-
socket.connect(new InetSocketAddress(host, port), 3000);
21+
socket.connect(new InetSocketAddress(host, port), timeout);
2222
// InetAddress localAddress = socket.getLocalAddress();
2323
// String hostName = localAddress.getHostName();
2424
return true;

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "kafka-map",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"private": true,
55
"dependencies": {
66
"@testing-library/jest-dom": "^5.11.4",

web/src/components/TopicData.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ class TopicData extends Component {
255255
itemLayout="horizontal"
256256
dataSource={this.state.items}
257257
loading={this.state.loading}
258+
pagination={{
259+
showSizeChanger: true,
260+
total: this.state.items.length,
261+
showTotal: total => <FormattedMessage id="total-items" values={{total}}/>
262+
}}
258263
renderItem={(item, index) => {
259264
const title = <>
260265
<Space>
@@ -304,7 +309,6 @@ class TopicData extends Component {
304309
</Col>
305310
</Row>;
306311

307-
308312
return <List.Item>
309313
<List.Item.Meta
310314
title={title}

0 commit comments

Comments
 (0)