Remove no quota leased warning from quota handler inactive callback

When EPP SSL handshake is unsuccessful, #channelInactive is called but there are no quotas to return, because quotas are only leased upon the first #channelRead. There is no need to log a warning and throw an exception in this case because the handshake exception would have been thrown already. Throwing a second exception just crowds the log.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=197016756
This commit is contained in:
jianglai 2018-05-17 10:50:53 -07:00
parent 44890c2964
commit 0fb845e81a

View file

@ -150,15 +150,18 @@ public abstract class QuotaHandler extends ChannelInboundHandlerAdapter {
}
/**
* Returns the leased token back to the token store upon connection termination.
* Returns the leased token (if available) back to the token store upon connection termination.
*
* <p>A connection with concurrent quota needs to do this in order to maintain its quota number
* invariance.
*/
@Override
public void channelInactive(ChannelHandlerContext ctx) {
checkNotNull(quotaResponse, "No quota was leased, return not possible.");
Future<?> unusedFuture = quotaManager.releaseQuota(QuotaRebate.create(quotaResponse));
// If no reads occurred before the connection is inactive (for example when the handshake
// is not successful), no quota is leased and therefore no return is needed.
if (quotaResponse != null) {
Future<?> unusedFuture = quotaManager.releaseQuota(QuotaRebate.create(quotaResponse));
}
ctx.fireChannelInactive();
}
}