Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
share StatsFilter across all server connections
  • Loading branch information
mariusae committed Feb 23, 2011
1 parent bb30b1d commit 71d1af1
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -188,6 +188,9 @@ case class ServerBuilder[Req, Rep](

val channels = new HashSet[ChannelHandle]

// Share this stats receiver to avoid per-connection overhead.
val statsFilter = scopedStatsReceiver map { new StatsFilter[Req, Rep](_) }

bs.setPipelineFactory(new ChannelPipelineFactory {
def getPipeline = {
val pipeline = codec.serverPipelineFactory.getPipeline
Expand Down Expand Up @@ -219,8 +222,8 @@ case class ServerBuilder[Req, Rep](
// Compose the service stack.
var service = codec.wrapServerChannel(serviceFactory())

scopedStatsReceiver foreach { sr =>
service = (new StatsFilter(sr)) andThen service
statsFilter foreach { sf =>
service = sf andThen service
}

// We add the idle time after the codec. This ensures that a
Expand Down

0 comments on commit 71d1af1

Please sign in to comment.