All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.finagle.memcached.protocol.text.MessageEncoderHandler.scala Maven / Gradle / Ivy

There is a newer version: 24.2.0
Show newest version
package com.twitter.finagle.memcached.protocol.text

import io.netty.channel.{ChannelHandlerContext, ChannelOutboundHandlerAdapter, ChannelPromise}

/**
 * This encoder handler encodes messages of type `T` to `Buf`s using `encoder`.
 */
private[memcached] class MessageEncoderHandler[T](encoder: MessageEncoder[T])
    extends ChannelOutboundHandlerAdapter {

  override def write(ctx: ChannelHandlerContext, msg: Any, promise: ChannelPromise): Unit =
    ctx.write(encoder.encode(msg.asInstanceOf[T]), promise)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy