mxsm commented on code in PR #3243:
URL:
https://github.com/apache/incubator-eventmesh/pull/3243#discussion_r1117241179
##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/http/producer/EventMeshProducer.java:
##########
@@ -83,32 +86,24 @@ public synchronized void init(EventMeshHTTPConfiguration
eventMeshHttpConfigurat
keyValue.put("eventMeshIDC",
eventMeshHttpConfiguration.getEventMeshIDC());
mqProducerWrapper = new
MQProducerWrapper(eventMeshHttpConfiguration.getEventMeshConnectorPluginType());
mqProducerWrapper.init(keyValue);
- inited.compareAndSet(false, true);
log.info("EventMeshProducer [{}] inited.............",
producerGroupConfig.getGroupName());
}
- public synchronized void start() throws Exception {
- if (started.get()) {
+ public void start() throws Exception {
+
+ if (!started.compareAndSet(false, true)) {
return;
}
-
mqProducerWrapper.start();
- started.compareAndSet(false, true);
log.info("EventMeshProducer [{}] started.............",
producerGroupConfig.getGroupName());
}
- public synchronized void shutdown() throws Exception {
- if (!inited.get()) {
- return;
- }
-
- if (!started.get()) {
+ public void shutdown() throws Exception {
+ if (!inited.compareAndSet(true, false && !started.compareAndSet(true,
false))) {
Review Comment:
@xwm1992 I will fix it and resubmit this pr later
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]