Skip to content

Commit

Permalink
pool: use mover's UUID to track xroot client reconnects
Browse files Browse the repository at this point in the history
Motivation:
there are no reasons to prefer the string form of UUID over the plain
object.

Modification:
Update reconnectTimers map to use UUID as a key.

Result:
simplification.

Acked-by: Lea Morschel
Target: master
Require-book: no
Require-notes: no
  • Loading branch information
kofemann committed Jan 4, 2024
1 parent fd11f93 commit 9074fa4
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public String call() throws Exception {
private ServerProtocolFlags serverProtocolFlags;
private long tpcServerResponseTimeout;
private TimeUnit tpcServerResponseTimeoutUnit;
private Map<String, Timer> reconnectTimers;
private Map<UUID, Timer> reconnectTimers;
private long readReconnectTimeout;
private TimeUnit readReconnectTimeoutUnit;
private int tpcClientChunkSize;
Expand Down Expand Up @@ -207,7 +207,7 @@ public void setAccessLogPlugins(List<ChannelHandlerFactory> plugins) {
* @param uuid of the mover (channel)
*/
public synchronized void cancelReconnectTimeoutForMover(UUID uuid) {
Timer timer = reconnectTimers.remove(uuid.toString());
Timer timer = reconnectTimers.remove(uuid);
if (timer != null) {
timer.cancel();
LOGGER.debug("cancelReconnectTimeoutForMover, timer cancelled for {}.", uuid);
Expand Down Expand Up @@ -240,7 +240,7 @@ public void run() {
key);
}
};
reconnectTimers.put(key.toString(), timer);
reconnectTimers.put(key, timer);
timer.schedule(task, readReconnectTimeoutUnit.toMillis(readReconnectTimeout));
} else {
LOGGER.debug("setReconnectTimeoutForMover for {}; " +
Expand Down Expand Up @@ -506,6 +506,6 @@ private void handleUploadDone(NettyMover<XrootdProtocolInfo> mover) throws Cache
}

private synchronized void removeReadReconnectTimer(UUID key) {
reconnectTimers.remove(key.toString());
reconnectTimers.remove(key);
}
}

0 comments on commit 9074fa4

Please sign in to comment.