Scala Unfiltered - What is the intended pattern for dealing with ClosedChannelException

95 views Asked by At

In the following example:

object AsyncPlan extends unfiltered.filter.async.Plan  {
    def intent = { 
      case GET(UFPath("/pass")) => Pass
      case req@GET(UFPath("/async")) =>

        // sleep for a bit

        req.respond(ResponseString("test") ~> Ok) 
    }   
}

There is the chance that the client closes the connection before respond is called. In that scenario Unfiltered allows the underlying ClosedChannelException to bubble through.

What is the intended pattern for gracefully dealing with this scenario?

0

There are 0 answers