@@ -319,6 +319,7 @@ public void notifyChannelActive(Channel channel) {
319
319
320
320
this .logPrefix = null ;
321
321
this .connectionError = null ;
322
+ this .inProtectMode = false ;
322
323
323
324
if (!CHANNEL .compareAndSet (this , DummyContextualChannelInstances .CHANNEL_CONNECTING , contextualChannel )) {
324
325
channel .close ();
@@ -398,7 +399,7 @@ public void notifyChannelInactive(Channel channel) {
398
399
399
400
@ Override
400
401
public void notifyChannelInactiveAfterWatchdogDecision (Channel channel ,
401
- Deque <RedisCommand <?, ?, ?>> retryableQueuedCommands ) {
402
+ Deque <RedisCommand <?, ?, ?>> retryablePendingCommands ) {
402
403
final ContextualChannel inactiveChan = this .channel ;
403
404
if (!inactiveChan .context .initialState .isConnected ()) {
404
405
logger .error ("[unexpected][{}] notifyChannelInactive: channel initial state not connected" , logPrefix ());
@@ -446,7 +447,7 @@ public void notifyChannelInactiveAfterWatchdogDecision(Channel channel,
446
447
CHANNEL .set (this , DummyContextualChannelInstances .CHANNEL_ENDPOINT_CLOSED );
447
448
}
448
449
inactiveChan .context
449
- .setCloseStatus (new ConnectionContext .CloseStatus (willReconnect , retryableQueuedCommands , exception ));
450
+ .setCloseStatus (new ConnectionContext .CloseStatus (willReconnect , retryablePendingCommands , exception ));
450
451
trySetEndpointQuiescence (inactiveChan );
451
452
}
452
453
@@ -945,11 +946,11 @@ private <K, V, T> RedisCommand<K, V, T> processActivationCommand(RedisCommand<K,
945
946
946
947
private Throwable validateWrite (ContextualChannel chan , int commands , boolean isActivationCommand ) {
947
948
if (isClosed ()) {
948
- return new RedisException ("Connection is closed" );
949
+ return new RedisException ("Endpoint is closed" );
949
950
}
950
951
951
952
final Throwable localConnectionErr = connectionError ;
952
- if (localConnectionErr != null /* different logic of DefaultEndpoint */ ) {
953
+ if (localConnectionErr != null /* attention: different logic of DefaultEndpoint */ ) {
953
954
return localConnectionErr ;
954
955
}
955
956
@@ -961,18 +962,19 @@ private Throwable validateWrite(ContextualChannel chan, int commands, boolean is
961
962
962
963
final ConnectionContext .State initialState = chan .context .initialState ;
963
964
final boolean rejectCommandsWhileDisconnectedLocal = this .rejectCommandsWhileDisconnected || isActivationCommand ;
965
+ final String rejectDesc = isActivationCommand ? "isActivationCommand" : "rejectCommandsWhileDisconnected" ;
964
966
switch (initialState ) {
965
967
case ENDPOINT_CLOSED :
966
968
return new RedisException ("Connection is closed" );
967
969
case RECONNECT_FAILED :
968
- return failedToReconnectReason ;
970
+ return getFailedToReconnectReason () ;
969
971
case WILL_RECONNECT :
970
972
case CONNECTING :
971
- return rejectCommandsWhileDisconnectedLocal
972
- ? new RedisException ("Currently not connected. Commands are rejected." )
973
+ return rejectCommandsWhileDisconnectedLocal ? new RedisException ("Currently not connected and " + rejectDesc )
973
974
: null ;
974
975
case CONNECTED :
975
- return !chan .isActive () && rejectCommandsWhileDisconnectedLocal ? new RedisException ("Channel is closed" )
976
+ return !chan .isActive () && rejectCommandsWhileDisconnectedLocal
977
+ ? new RedisException ("Channel is inactive and " + rejectDesc )
976
978
: null ;
977
979
default :
978
980
throw new IllegalStateException ("unexpected state: " + initialState );
0 commit comments