Packages

  • package root
    Definition Classes
    root
  • package com
    Definition Classes
    root
  • package twitter

    Start with com.twitter.finagle.

    Definition Classes
    com
  • package finagle

    Finagle is an extensible RPC system.

    Finagle is an extensible RPC system.

    Services are represented by class com.twitter.finagle.Service. Clients make use of com.twitter.finagle.Service objects while servers implement them.

    Finagle contains a number of protocol implementations; each of these implement Client and/or com.twitter.finagle.Server. For example, Finagle's HTTP implementation, com.twitter.finagle.Http (in package finagle-http), exposes both.

    Thus a simple HTTP server is built like this:

    import com.twitter.finagle.{Http, Service}
    import com.twitter.finagle.http.{Request, Response}
    import com.twitter.util.{Await, Future}
    
    val service = new Service[Request, Response] {
      def apply(req: Request): Future[Response] =
        Future.value(Response())
    }
    val server = Http.server.serve(":8080", service)
    Await.ready(server)

    We first define a service to which requests are dispatched. In this case, the service returns immediately with a HTTP 200 OK response, and with no content.

    This service is then served via the Http protocol on TCP port 8080. Finally we wait for the server to stop serving.

    We can now query our web server:

    % curl -D - localhost:8080
    HTTP/1.1 200 OK

    Building an HTTP client is also simple. (Note that type annotations are added for illustration.)

    import com.twitter.finagle.{Http, Service}
    import com.twitter.finagle.http.{Request, Response}
    import com.twitter.util.{Future, Return, Throw}
    
    val client: Service[Request, Response] = Http.client.newService("localhost:8080")
    val f: Future[Response] = client(Request()).respond {
      case Return(rep) =>
        printf("Got HTTP response %s\n", rep)
      case Throw(exc) =>
        printf("Got error %s\n", exc)
    }

    Http.client.newService("localhost:8080") constructs a new com.twitter.finagle.Service instance connected to localhost TCP port 8080. We then issue a HTTP/1.1 GET request to URI "/". The service returns a com.twitter.util.Future representing the result of the operation. We listen to this future, printing an appropriate message when the response arrives.

    The Finagle homepage contains useful documentation and resources for using Finagle.

    Definition Classes
    twitter
  • package netty3

    Package netty3 implements the bottom finagle primitives: {{com.twitter.finagle.Server}} and a client transport in terms of the netty3 event loop.

    Package netty3 implements the bottom finagle primitives: {{com.twitter.finagle.Server}} and a client transport in terms of the netty3 event loop.

    Note: when {{com.twitter.finagle.builder.ClientBuilder}} and {{com.twitter.finagle.builder.ServerBuilder}} are deprecated, package netty3 can move into its own package, so that only the (new-style) clients and servers that depend on netty3 bring it in.

    Definition Classes
    finagle
  • package channel
    Definition Classes
    netty3
  • BrokerChannelHandler
  • ChannelStatsHandler
  • IdleChannelHandler
  • LeftFoldUpstreamHandler
c

com.twitter.finagle.netty3.channel

ChannelStatsHandler

class ChannelStatsHandler extends SimpleChannelHandler

A org.jboss.netty.channel.ChannelHandler that tracks channel/connection statistics. The handler is meant to be shared by all Channels within a Finagle client or server in order to consolidate statistics across a number of channels.

Linear Supertypes
SimpleChannelHandler, ChannelDownstreamHandler, ChannelUpstreamHandler, ChannelHandler, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ChannelStatsHandler
  2. SimpleChannelHandler
  3. ChannelDownstreamHandler
  4. ChannelUpstreamHandler
  5. ChannelHandler
  6. AnyRef
  7. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ChannelStatsHandler(statsReceiver: StatsReceiver)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def bindRequested(arg0: ChannelHandlerContext, arg1: ChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  6. def channelBound(arg0: ChannelHandlerContext, arg1: ChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  7. def channelClosed(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    ChannelStatsHandler → SimpleChannelHandler
  8. def channelConnected(arg0: ChannelHandlerContext, arg1: ChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  9. def channelDisconnected(arg0: ChannelHandlerContext, arg1: ChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  10. def channelInterestChanged(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    ChannelStatsHandler → SimpleChannelHandler
  11. def channelOpen(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    ChannelStatsHandler → SimpleChannelHandler
  12. def channelUnbound(arg0: ChannelHandlerContext, arg1: ChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  13. def childChannelClosed(arg0: ChannelHandlerContext, arg1: ChildChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  14. def childChannelOpen(arg0: ChannelHandlerContext, arg1: ChildChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  15. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  16. def closeRequested(ctx: ChannelHandlerContext, e: ChannelStateEvent): Unit
    Definition Classes
    ChannelStatsHandler → SimpleChannelHandler
  17. def connectRequested(arg0: ChannelHandlerContext, arg1: ChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  18. def disconnectRequested(arg0: ChannelHandlerContext, arg1: ChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  19. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  21. def exceptionCaught(ctx: ChannelHandlerContext, evt: ExceptionEvent): Unit
    Definition Classes
    ChannelStatsHandler → SimpleChannelHandler
  22. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  23. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  24. def handleDownstream(arg0: ChannelHandlerContext, arg1: ChannelEvent): Unit
    Definition Classes
    SimpleChannelHandler → ChannelDownstreamHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  25. def handleUpstream(arg0: ChannelHandlerContext, arg1: ChannelEvent): Unit
    Definition Classes
    SimpleChannelHandler → ChannelUpstreamHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  26. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  27. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  28. def messageReceived(ctx: ChannelHandlerContext, e: MessageEvent): Unit
    Definition Classes
    ChannelStatsHandler → SimpleChannelHandler
  29. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  31. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  32. def setInterestOpsRequested(arg0: ChannelHandlerContext, arg1: ChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  33. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  34. def toString(): String
    Definition Classes
    AnyRef → Any
  35. def unbindRequested(arg0: ChannelHandlerContext, arg1: ChannelStateEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )
  36. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  37. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  38. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  39. def writeComplete(ctx: ChannelHandlerContext, e: WriteCompletionEvent): Unit
    Definition Classes
    ChannelStatsHandler → SimpleChannelHandler
  40. def writeRequested(arg0: ChannelHandlerContext, arg1: MessageEvent): Unit
    Definition Classes
    SimpleChannelHandler
    Annotations
    @throws( classOf[java.lang.Exception] )

Inherited from SimpleChannelHandler

Inherited from ChannelDownstreamHandler

Inherited from ChannelUpstreamHandler

Inherited from ChannelHandler

Inherited from AnyRef

Inherited from Any

Ungrouped