This is an automated email from the ASF dual-hosted git repository.
mxsm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 39c829347 [ISSUE #4095] Code Optimization and Interrupeted Exception
handling.[EtcdCustomService] (#4752)
39c829347 is described below
commit 39c8293477bc4ac35a7d1cbc500dd573b9b19c18
Author: scwlkq <[email protected]>
AuthorDate: Sat Jan 20 21:45:27 2024 +0800
[ISSUE #4095] Code Optimization and Interrupeted Exception
handling.[EtcdCustomService] (#4752)
* Enhance thread handling of InterruptedException
* inline variable
* check code style
* catch InterruptedException in a separate catch code block
---
.../eventmesh/meta/etcd/service/EtcdCustomService.java | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git
a/eventmesh-meta/eventmesh-meta-etcd/src/main/java/org/apache/eventmesh/meta/etcd/service/EtcdCustomService.java
b/eventmesh-meta/eventmesh-meta-etcd/src/main/java/org/apache/eventmesh/meta/etcd/service/EtcdCustomService.java
index 23ca9985b..11460cc68 100644
---
a/eventmesh-meta/eventmesh-meta-etcd/src/main/java/org/apache/eventmesh/meta/etcd/service/EtcdCustomService.java
+++
b/eventmesh-meta/eventmesh-meta-etcd/src/main/java/org/apache/eventmesh/meta/etcd/service/EtcdCustomService.java
@@ -66,6 +66,9 @@ public class EtcdCustomService extends EtcdMetaService {
}
return eventMeshServicePubTopicInfoList;
}
+ } catch (InterruptedException e) {
+
log.error("[EtcdRegistryService][findEventMeshServicePubTopicInfos]
InterruptedException", e);
+ Thread.currentThread().interrupt();
} catch (Exception e) {
log.error("[EtcdRegistryService][findEventMeshServicePubTopicInfos] error", e);
throw new MetaException(e.getMessage());
@@ -84,12 +87,13 @@ public class EtcdCustomService extends EtcdMetaService {
GetOption getOption =
GetOption.newBuilder().withPrefix(keyByteSequence).build();
keyValues = client.getKVClient().get(keyByteSequence,
getOption).get().getKvs();
if (CollectionUtils.isNotEmpty(keyValues)) {
- EventMeshAppSubTopicInfo eventMeshAppSubTopicInfo =
- JsonUtils.parseObject(
- new String(keyValues.get(0).getValue().getBytes(),
Constants.DEFAULT_CHARSET),
- EventMeshAppSubTopicInfo.class);
- return eventMeshAppSubTopicInfo;
+ return JsonUtils.parseObject(
+ new String(keyValues.get(0).getValue().getBytes(),
Constants.DEFAULT_CHARSET),
+ EventMeshAppSubTopicInfo.class);
}
+ } catch (InterruptedException e) {
+
log.error("[EtcdRegistryService][findEventMeshAppSubTopicInfoByGroup]
InterruptedException", e);
+ Thread.currentThread().interrupt();
} catch (Exception e) {
log.error("[EtcdRegistryService][findEventMeshAppSubTopicInfoByGroup] error,
group: {}", group, e);
throw new MetaException(e.getMessage());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]