List of usage examples for io.netty.handler.codec EncoderException EncoderException
public EncoderException(String message, Throwable cause)
From source file:com.lambdaworks.redis.protocol.CommandEncoder.java
License:Apache License
private void encode(ChannelHandlerContext ctx, ByteBuf out, RedisCommand<?, ?, ?> command) { try {/* www . j av a 2 s. c om*/ out.markWriterIndex(); command.encode(out); } catch (RuntimeException e) { out.resetWriterIndex(); command.completeExceptionally(new EncoderException( "Cannot encode command. Please close the connection as the connection state may be out of sync.", e)); } if (debugEnabled) { logger.debug("{} writing command {}", logPrefix(ctx.channel()), command); if (traceEnabled) { logger.trace("{} Sent: {}", logPrefix(ctx.channel()), out.toString(Charset.defaultCharset()).trim()); } } }