Skip to content

Commit

Permalink
Remove annotations in ScroogeThriftCodec
Browse files Browse the repository at this point in the history
Author: @franklinhu
Fixes #113
URL: #113
  • Loading branch information
Franklin Hu committed Aug 14, 2012
1 parent 94460a5 commit 32dd9c6
Showing 1 changed file with 0 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@ import java.nio.ByteBuffer
import com.twitter.cassie.codecs.Codec
import com.twitter.scrooge.{ThriftStructCodec, BinaryThriftStructSerializer, ThriftStruct}
import com.twitter.ostrich.stats.Stats
import com.twitter.finagle.tracing.Trace

class ScroogeThriftCodec[T <: ThriftStruct](structCodec: ThriftStructCodec[T]) extends Codec[T] {
val serializer = new BinaryThriftStructSerializer[T] { def codec = structCodec }

def encode(t: T): ByteBuffer = {
Stats.time("scroogecodec.serialize") {
Trace.record("scroogecodec.serialize")
val serialized = serializer.toBytes(t)
Stats.addMetric("scroogecodec.serialized", serialized.size)
b2b(serialized)
Expand All @@ -35,7 +33,6 @@ class ScroogeThriftCodec[T <: ThriftStruct](structCodec: ThriftStructCodec[T]) e

def decode(ary: ByteBuffer): T = {
Stats.time("scroogecodec.deserialize") {
Trace.record("scroogecodec.deserialize")
serializer.fromBytes(b2b(ary))
}
}
Expand Down

0 comments on commit 32dd9c6

Please sign in to comment.