You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/06/28 03:06:22 UTC

[GitHub] [inlong] healchow commented on a diff in pull request #4291: [INLONG-4232][Manager] Support collect data from a specified position for MySQL binlog

healchow commented on code in PR #4291:
URL: https://github.com/apache/inlong/pull/4291#discussion_r907986195


##########
inlong-manager/manager-client/src/main/java/org/apache/inlong/manager/client/api/impl/DefaultInlongStreamBuilder.java:
##########
@@ -204,24 +204,26 @@ private void initOrUpdateSource() {
         final String streamId = streamInfo.getInlongStreamId();
         List<SourceListResponse> sourceListResponses = managerClient.listSources(groupId, streamId);
         List<String> updateSourceNames = Lists.newArrayList();
-        for (SourceListResponse sourceListResponse : sourceListResponses) {
-            final String sourceName = sourceListResponse.getSourceName();
-            final int id = sourceListResponse.getId();
-            if (sourceRequests.get(sourceName) == null) {
-                boolean isDelete = managerClient.deleteSource(id);
-                if (!isDelete) {
-                    throw new RuntimeException(String.format("Delete source=%s failed", sourceListResponse));
-                }
-            } else {
-                SourceRequest sourceRequest = sourceRequests.get(sourceName);
-                sourceRequest.setId(id);
-                Pair<Boolean, String> updateState = managerClient.updateSource(sourceRequest);
-                if (!updateState.getKey()) {
-                    throw new RuntimeException(String.format("Update source=%s failed with err=%s", sourceRequest,
-                            updateState.getValue()));
+        if (sourceListResponses != null && sourceListResponses.size() > 0) {

Review Comment:
   Please use the `CollectionUtils.isNotEmpty` method to check whether the list is empty or not.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@inlong.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org