@ Override public void channelActive ( final ChannelHandlerContext ctx ) throws Exception { this . ctx = ctx ; if ( selectBucketEnabled ) { byte [ ] key = bucket . getBytes ( ) ; short keyLength = ( short ) bucket . length ( ) ; BinaryMemcacheRequest request = new DefaultBinaryMemcacheRequest ( key ) ; request . setOpcode ( SELECT_BUCKET_OPCODE ) ; request . setKeyLength ( keyLength ) ; request . setTotalBodyLength ( keyLength ) ; this . ctx . writeAndFlush ( request ) ; } else { //remove the handler if the feature is not enabled originalPromise . setSuccess ( ) ; this . ctx . pipeline ( ) . remove ( this ) ; this . ctx . fireChannelActive ( ) ; } }
Once the channel is marked as active select bucket command is sent if the HELLO request has SELECT_BUCKET feature enabled .