This is an automated email from the ASF dual-hosted git repository.
jonyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 268b7f646 col.isEmpty()_1 (#2818)
268b7f646 is described below
commit 268b7f646aa4556ed7584a57b544a965ededa7ee
Author: Tarun Samanta <[email protected]>
AuthorDate: Thu Jan 5 05:18:10 2023 +0530
col.isEmpty()_1 (#2818)
* col.isEmpty()
* MapUtils.isEmpty()
* removed null check
* Update EventmeshRebalanceImpl.java
fix build error
Co-authored-by: jonyangx <[email protected]>
---
.../protocol/tcp/client/rebalance/EventmeshRebalanceImpl.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/rebalance/EventmeshRebalanceImpl.java
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/rebalance/EventmeshRebalanceImpl.java
index d937cdcdf..cd1987991 100644
---
a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/rebalance/EventmeshRebalanceImpl.java
+++
b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/rebalance/EventmeshRebalanceImpl.java
@@ -26,6 +26,7 @@ import
org.apache.eventmesh.runtime.core.protocol.tcp.client.recommend.EventMesh
import org.apache.eventmesh.runtime.core.protocol.tcp.client.session.Session;
import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
@@ -62,7 +63,7 @@ public class EventmeshRebalanceImpl implements
EventMeshRebalanceStrategy {
final String cluster =
eventMeshTCPServer.getEventMeshTCPConfiguration().getEventMeshCluster();
//get eventmesh of local idc
Map<String, String> localEventMeshMap =
queryLocalEventMeshMap(cluster);
- if (localEventMeshMap == null || localEventMeshMap.size() == 0) {
+ if (MapUtils.isEmpty(localEventMeshMap)) {
return;
}
@@ -112,7 +113,7 @@ public class EventmeshRebalanceImpl implements
EventMeshRebalanceStrategy {
//query distribute data of loacl idc
Map<String, Integer> clientDistributionMap =
queryLocalEventMeshDistributeData(cluster, group, purpose,
eventMeshMap);
- if (clientDistributionMap == null || clientDistributionMap.size() ==
0) {
+ if (MapUtils.isEmpty(clientDistributionMap)) {
return;
}
@@ -124,7 +125,7 @@ public class EventmeshRebalanceImpl implements
EventMeshRebalanceStrategy {
private void doRebalanceRedirect(String currEventMeshName, String group,
String purpose, Map<String, String> eventMeshMap,
Map<String, Integer>
clientDistributionMap) throws Exception {
- if (clientDistributionMap == null || clientDistributionMap.size() ==
0) {
+ if (MapUtils.isEmpty(clientDistributionMap)) {
return;
}
@@ -229,7 +230,7 @@ public class EventmeshRebalanceImpl implements
EventMeshRebalanceStrategy {
eventMeshClientDistributionDataMap =
eventMeshTCPServer.getRegistry().findEventMeshClientDistributionData(
cluster, group, purpose);
- if (eventMeshClientDistributionDataMap == null ||
eventMeshClientDistributionDataMap.size() == 0) {
+ if (MapUtils.isEmpty(eventMeshClientDistributionDataMap)) {
logger.warn("doRebalance failed,found no distribute data in
regitry, cluster:{}, group:{}, purpose:{}",
cluster, group, purpose);
return null;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]