This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new e2f738c Polished
e2f738c is described below
commit e2f738c321a16ddf138591e84d8e9bd3dd3852c4
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Jun 27 12:52:27 2021 +0200
Polished
---
.../org/apache/camel/component/as2/api/AS2ServerConnection.java | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git
a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java
b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java
index 1098dd9..93fa56d 100644
---
a/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java
+++
b/components/camel-as2/camel-as2-api/src/main/java/org/apache/camel/component/as2/api/AS2ServerConnection.java
@@ -178,6 +178,7 @@ public class AS2ServerConnection {
}
private RequestListenerThread listenerThread;
+ private final Object lock = new Object();
private String as2Version;
private String originServer;
private String serverFqdn;
@@ -226,14 +227,12 @@ public class AS2ServerConnection {
public void close() {
if (listenerThread != null) {
- synchronized (listenerThread) {
+ synchronized (lock) {
try {
listenerThread.serversocket.close();
} catch (IOException e) {
LOG.debug(e.getMessage(), e);
} finally {
- // TODO This line causes FindBugs (static code analysis
tool) alert with description
- //
http://findbugs.sourceforge.net/bugDescriptions.html#ML_SYNC_ON_FIELD_TO_GUARD_CHANGING_THAT_FIELD
listenerThread = null;
}
}
@@ -242,14 +241,13 @@ public class AS2ServerConnection {
public void listen(String requestUri, HttpRequestHandler handler) {
if (listenerThread != null) {
- synchronized (listenerThread) {
+ synchronized (lock) {
listenerThread.registerHandler(requestUri, handler);
}
}
}
public void stopListening(String requestUri) {
-
if (listenerThread != null) {
listenerThread.unregisterHandler(requestUri);
}