|
27 | 27 | import java.util.HashMap; |
28 | 28 | import java.util.List; |
29 | 29 | import java.util.Map; |
| 30 | +import java.util.Objects; |
30 | 31 | import java.util.Set; |
31 | 32 | import java.util.concurrent.ConcurrentHashMap; |
32 | 33 | import java.util.concurrent.ExecutorService; |
@@ -1045,11 +1046,11 @@ protected boolean handleDisconnectWithoutInvestigation(final AgentAttache attach |
1045 | 1046 | GlobalLock joinLock = getHostJoinLock(hostId); |
1046 | 1047 | try { |
1047 | 1048 | if (!joinLock.lock(60)) { |
1048 | | - logger.debug("Unable to acquire lock on host {} to process agent disconnection", host != null? host : hostId); |
| 1049 | + logger.debug("Unable to acquire lock on host {} to process agent disconnection", Objects.toString(host, String.valueOf(hostId))); |
1049 | 1050 | return result; |
1050 | 1051 | } |
1051 | 1052 |
|
1052 | | - logger.debug("Acquired lock on host {}, to process agent disconnection", host != null? host : hostId); |
| 1053 | + logger.debug("Acquired lock on host {}, to process agent disconnection", Objects.toString(host, String.valueOf(hostId))); |
1053 | 1054 | disconnectHostAgent(attache, event, host, transitState, joinLock); |
1054 | 1055 | result = true; |
1055 | 1056 | } finally { |
@@ -1080,9 +1081,7 @@ private void disconnectHostAgent(final AgentAttache attache, final Status.Event |
1080 | 1081 | disconnectAgent(host, event, _nodeId); |
1081 | 1082 | } |
1082 | 1083 | } finally { |
1083 | | - if (joinLock != null) { |
1084 | | - joinLock.unlock(); |
1085 | | - } |
| 1084 | + joinLock.unlock(); |
1086 | 1085 | } |
1087 | 1086 | } |
1088 | 1087 |
|
@@ -1403,9 +1402,7 @@ private AgentAttache connectHostAgent(HostVO host, ReadyCommand ready, Link link |
1403 | 1402 | attache = createAttacheForConnect(host, link); |
1404 | 1403 | attache = notifyMonitorsOfConnection(attache, startupCmds, false); |
1405 | 1404 | } finally { |
1406 | | - if (joinLock != null) { |
1407 | | - joinLock.unlock(); |
1408 | | - } |
| 1405 | + joinLock.unlock(); |
1409 | 1406 | } |
1410 | 1407 |
|
1411 | 1408 | return attache; |
|
0 commit comments