Croway commented on code in PR #22874:
URL: https://github.com/apache/camel/pull/22874#discussion_r3169312619


##########
components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java:
##########
@@ -144,8 +145,10 @@ private MessageListener createHandshakeListener() {
                 LOG.debug("Handshake failed, so try again.");
                 client.handshake();
             } else if (!channelToConsumers.isEmpty()) {
-                channelsToSubscribe.clear();
-                channelsToSubscribe.addAll(channelToConsumers.keySet());
+                synchronized (channelsToSubscribe) {

Review Comment:
   We removed synchronised blocks in favour of ReentrantLock to better support 
VirtualThreads, can you update the synchronised blocks with Locks?
   
   It should be enough to create a `private final Lock channelsLock = new 
ReentrantLock();` and replace `synchronized (channelsToSubscribe) { ... }` 
blocks with `channelsLock.lock() / try / finally / channelsLock.unlock()`



-- 
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]

Reply via email to