Permalink
Browse files

Thrift end-to-end passes

  • Loading branch information...
1 parent b964921 commit aa3b9fd249b6a1bbb30e4ac472ea7a234e79d021 Nick Kallen committed Jan 11, 2011
@@ -39,7 +39,6 @@ case class ServerBuilder[Req <: AnyRef, Res <: AnyRef](
_name: Option[String],
_sendBufferSize: Option[Int],
_recvBufferSize: Option[Int],
- _pipelineFactory: Option[ChannelPipelineFactory],
@gseitz

gseitz Jan 27, 2011

Just wondering, what was the reasoning behind removing the pipelineFactory field?

@bierbaum

bierbaum Jan 28, 2011

Contributor

it's a codec concern. write/enhance a codec if you need to muck with the pipeline. you can do it this way: http://goo.gl/QVAAG

@gseitz

gseitz Jan 28, 2011

Right, Thanks for the clarification.

_service: Option[Service[Req, Res]],
_bindTo: Option[SocketAddress],
_logger: Option[Logger],
@@ -57,7 +56,6 @@ case class ServerBuilder[Req <: AnyRef, Res <: AnyRef](
None, // name
None, // sendBufferSize
None, // recvBufferSize
- None, // pipelineFactory
None, // service
None, // bindTo
None, // logger
@@ -79,9 +77,6 @@ case class ServerBuilder[Req <: AnyRef, Res <: AnyRef](
def sendBufferSize(value: Int) = copy(_sendBufferSize = Some(value))
def recvBufferSize(value: Int) = copy(_recvBufferSize = Some(value))
- def pipelineFactory(value: ChannelPipelineFactory) =
- copy(_pipelineFactory = Some(value))
-
def service[Req <: AnyRef, Rep <: AnyRef](service: Service[Req, Rep]) =
copy(_service = Some(service))
@@ -106,13 +101,8 @@ case class ServerBuilder[Req <: AnyRef, Res <: AnyRef](
copy(_maxQueueDepth = Some(max))
def build(): Channel = {
- val (codec, pipelineFactory) = (_codec, _pipelineFactory) match {
- case (None, _) =>
- throw new IncompleteSpecification("No codec was specified")
- case (_, None) =>
- throw new IncompleteSpecification("No pipeline was specified")
- case (Some(codec), Some(pipeline)) =>
- (codec, pipeline)
+ val codec = _codec.getOrElse {
+ throw new IncompleteSpecification("No codec was specified")
}
val bs = new ServerBootstrap(_channelFactory getOrElse defaultChannelFactory)
@@ -150,9 +140,6 @@ case class ServerBuilder[Req <: AnyRef, Res <: AnyRef](
// pipeline.addLast("stats", new SampleHandler(statsReceiver))
// }
- for ((name, handler) <- pipelineFactory.getPipeline.toMap)
- pipeline.addLast(name, handler)
-
_service.foreach { service =>
pipeline.addLast("service", new ServiceToChannelHandler(service))
}
@@ -8,6 +8,9 @@ trait ReadableCounter extends Counter {
* An atomic snapshot of summary statistics.
*/
case class Summary(total: Float, count: Int) {
+ /**
+ * Arithmetic mean
+ */
val mean = total / count
}
@@ -42,6 +42,7 @@ object ServiceEndToEndSpec extends Specification {
val addr = RandomSocket.nextAddress()
val sillyService = new SillyService()
+
val server = ServerBuilder()
.codec(new Thrift)
.service(sillyService)

0 comments on commit aa3b9fd

Please sign in to comment.