Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
JAliEn
JAliEn
Commits
d05039b0
Commit
d05039b0
authored
Apr 16, 2021
by
Costin Grigoras
Browse files
Address potential concurrency issue
parent
1b334f60
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/alien/api/DispatchSSLClient.java
View file @
d05039b0
...
...
@@ -108,6 +108,8 @@ public class DispatchSSLClient {
// connect timeout in config should be given in seconds
final
int
connectTimeout
=
ConfigUtils
.
getConfig
().
geti
(
"alien.api.DispatchSSLClient.ConnectTimeout"
,
10
)
*
1000
;
DispatchSSLClient
ret
=
null
;
for
(
final
InetAddress
endpointToTry
:
allAddresses
)
{
try
{
if
(
connectionState
.
get
()
!=
0
)
{
...
...
@@ -151,7 +153,7 @@ public class DispatchSSLClient {
final
DispatchSSLClient
sc
=
new
DispatchSSLClient
(
client
);
System
.
out
.
println
(
"Connection to JCentral ("
+
endpointToTry
.
getHostAddress
()
+
":"
+
targetPort
+
") established."
);
instance
=
sc
;
ret
=
sc
;
}
else
{
// somebody beat us and connected faster on another socket, close this slow one
...
...
@@ -171,7 +173,15 @@ public class DispatchSSLClient {
}
synchronized
(
callback
)
{
callback
.
notifyAll
();
if
(
ret
!=
null
)
{
if
(
instance
==
null
)
{
instance
=
ret
;
callback
.
notifyAll
();
}
else
{
ret
.
close
();
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment