Permalink
Browse files

Merge branch 'master' of github.com:twitter/finagle

  • Loading branch information...
2 parents 388ddab + a966728 commit c6f4a02018d5388ffb74f0a80fcd1c78584af259 Nick Kallen committed Feb 18, 2011
@@ -1,8 +0,0 @@
-package com.twitter.finagle.thrift
-
-/**
- * Defines a (framed) thrift request, simply composed of the raw
- * message & a boolean indicating whether it is a one-shot message or
- * not.
- */
-case class ThriftClientRequest(message: Array[Byte], oneway: Boolean)
@@ -0,0 +1,17 @@
+package com.twitter.finagle.thrift;
+
+/**
+ * Defines a (framed) thrift request, simply composed of the raw
+ * message & a boolean indicating whether it is a one-shot message or
+ * not.
+ */
+
+public class ThriftClientRequest {
+ public byte[] message;
+ public boolean oneway;
+
+ public ThriftClientRequest(byte[] message, boolean oneway) {
+ this.message = message;
+ this.oneway = oneway;
+ }
+}
@@ -56,7 +56,7 @@ class ThriftClientFramedCodec extends Codec[ThriftClientRequest, Array[Byte]]
options.write(buffer())
buffer().writeMessageEnd()
- underlying(ThriftClientRequest(buffer.toArray, false)) map { bytes =>
+ underlying(new ThriftClientRequest(buffer.toArray, false)) map { bytes =>
val protocolFactory = new TBinaryProtocol.Factory()
val memoryTransport = new TMemoryInputTransport(bytes)
val iprot = protocolFactory.getProtocol(memoryTransport)
@@ -85,11 +85,11 @@ class ThriftClientFramedCodec extends Codec[ThriftClientRequest, Array[Byte]]
class ThriftClientChannelBufferEncoder
extends SimpleChannelDownstreamHandler
{
- override def writeRequested(ctx: ChannelHandlerContext, e: MessageEvent) {
+ override def writeRequested(ctx: ChannelHandlerContext, e: MessageEvent) =
e.getMessage match {
- case ThriftClientRequest(message, oneway) =>
- Channels.write(ctx, e.getFuture, ChannelBuffers.wrappedBuffer(message))
- if (oneway) {
+ case request: ThriftClientRequest =>
+ Channels.write(ctx, e.getFuture, ChannelBuffers.wrappedBuffer(request.message))
+ if (request.oneway) {
// oneway RPCs are satisfied when the write is complete.
e.getFuture() {
case Ok(_) =>
@@ -104,7 +104,6 @@ class ThriftClientChannelBufferEncoder
case _ =>
throw new IllegalArgumentException("No ThriftClientRequest on the wire")
}
- }
}
/**
@@ -123,8 +122,9 @@ class ThriftClientTracingFilter extends SimpleFilter[ThriftClientRequest, Array[
header.setParent_span_id(Trace().traceID.span)
header.setDebug(Trace().transcript.isRecording)
- val tracedRequest = request.copy(
- message = OutputBuffer.messageToArray(header) ++ request.message)
+ val tracedRequest = new ThriftClientRequest(
+ OutputBuffer.messageToArray(header) ++ request.message,
+ request.oneway)
val reply = service(tracedRequest)
if (tracedRequest.oneway) {
@@ -33,16 +33,11 @@ class Project(info: ProjectInfo) extends StandardParentProject(info)
/**
* finagle-thrift contains thrift codecs for use with the finagle
* thrift service codegen. in order to be able to use thrift code
- * generation in finagle-thrift, we break out commonly needed types
- * (ie. for generation) into finagle-thrift-types.
+ * generation in finagle-thrift.
*/
- val thriftTypesProject = project(
- "finagle-thrift-types", "finagle-thrift-types",
- new SimpleProject(_))
-
val thriftProject = project(
"finagle-thrift", "finagle-thrift",
- new ThriftProject(_), thriftTypesProject, coreProject)
+ new ThriftProject(_), coreProject)
/**
* finagle-memcached contains the memcached codec, ketama, and Java and Scala

0 comments on commit c6f4a02

Please sign in to comment.