From 4d9b629a46f5d35a1aeeb30b9b950c6a7c847496 Mon Sep 17 00:00:00 2001 From: Dan Wang Date: Wed, 16 Oct 2024 16:15:53 +0800 Subject: [PATCH] fix spotless --- .../pegasus/rpc/async/ReplicaSession.java | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/java-client/src/main/java/org/apache/pegasus/rpc/async/ReplicaSession.java b/java-client/src/main/java/org/apache/pegasus/rpc/async/ReplicaSession.java index 0a85a75bc3..0651458f64 100644 --- a/java-client/src/main/java/org/apache/pegasus/rpc/async/ReplicaSession.java +++ b/java-client/src/main/java/org/apache/pegasus/rpc/async/ReplicaSession.java @@ -270,23 +270,23 @@ void markSessionDisconnect() { // this. In this case, we are relying on the timeout task. try { while (!pendingSend.isEmpty()) { - RequestEntry e = pendingSend.poll(); + RequestEntry entry = pendingSend.poll(); tryNotifyFailureWithSeqID( - e.sequenceId, error_code.error_types.ERR_SESSION_RESET, false); + entry.sequenceId, error_code.error_types.ERR_SESSION_RESET, false); } - List l = new LinkedList(); + List pendingEntries = new LinkedList<>(); for (Map.Entry entry : pendingResponse.entrySet()) { - l.add(entry.getValue()); + pendingEntries.add(entry.getValue()); } - for (RequestEntry e : l) { + for (RequestEntry entry : pendingEntries) { tryNotifyFailureWithSeqID( - e.sequenceId, error_code.error_types.ERR_SESSION_RESET, false); + entry.sequenceId, error_code.error_types.ERR_SESSION_RESET, false); } - } catch (Exception e) { + } catch (Exception ex) { logger.error( - "failed to notify callers due to unexpected exception [state={}]: ", - cache.state.toString(), - e); + "failed to notify callers due to unexpected exception [state={}]: ", + cache.state.toString(), + ex); } finally { logger.info("{}: mark the session to be disconnected from state={}", name(), cache.state); fields = new VolatileFields(ConnState.DISCONNECTED); @@ -388,8 +388,8 @@ private ScheduledFuture addTimer(final int seqID, long timeoutInMillseconds) public void run() { try { tryNotifyFailureWithSeqID(seqID, error_code.error_types.ERR_TIMEOUT, true); - } catch (Exception e) { - logger.warn("try notify with sequenceID {} exception!", seqID, e); + } catch (Exception ex) { + logger.warn("try notify with sequenceID {} exception!", seqID, ex); } } }, @@ -425,7 +425,7 @@ private void sendPendingRequests(Queue pendingEntries, VolatileFie public boolean tryPendRequest(RequestEntry entry) { // Double check. if (this.authSucceed) { - return false; + return false; } synchronized (authPendingSend) { @@ -488,11 +488,10 @@ interface MessageResponseFilter { MessageResponseFilter filter = null; - final ConcurrentHashMap pendingResponse = - new ConcurrentHashMap(); + final ConcurrentHashMap pendingResponse = new ConcurrentHashMap<>(); private final AtomicInteger seqId = new AtomicInteger(0); - final Queue pendingSend = new LinkedList(); + final Queue pendingSend = new LinkedList<>(); static final class VolatileFields { public VolatileFields(ConnState state, Channel nettyChannel) {