debasishg/scala-redis-nb — pull request #90 by knutwalker (2014-07-16 00:28:50+00:00)
Title: Replace Akka IO Pipelines with Akka Stream (Reactive Streams)

Some note about this implementation:
- this is based on #89
- Reactive Streams handle back pressure by requesting demand if needed. The `BackpressureBufferSettings` are ignored, but it may be possible to somehow integrate these with the ActorProducer
- Each client<->server connection is represented by a `Flow`
- The `pipe` Actor no longer is the underlying connection pipeline but the producer for the connection Flow
- termination management can be removed, since the connection Flow completes upon disconnection. Reacting to the `Terminated` message is done in `unhandled`
- The tracking of the requests in flight is done by a Flow manipulator (`RequestResponseHandler`). This is one instance per Flow and is therefore shared amongst different threads/dispatchers. Concurrent manipulation is now backed by java.util.concurrent.* stuff. (Indeed, using the s.c.i.Queue randomly fails tests.)
- I moved case classes and objects from the package object to a types.scala file. Using class likes in package objects in dispreferred by -Xlint and gave sometimes weird compiler issues
- I changed the parsing of Boolean results.
- Before, it would accept any String response as true, now it's only the Status string (`OK`). Redis sends other strings like +QUEUED that would have been treated as true.
- It peeks at the result and pushes back the peeked bytes. I don't really like that solution, but i didn't wanted to change too much with the reply parsing.
- This is also the part, where I'm not quite sure, how it could have worked before :)
- Occasionally, Akka throws an Exception and complains about a terminated Processor. This does not seem to have any influence on the result, tests are green regardless. I'm also not sure, why the Exception is sometimes thrown and sometimes not. The Stacktrace gives no hints about own code, but it looks like this happens during Actor shutdown. I assume it has something to do with the fact, that akka-streams is still experimental, so maybe this is a bug in Akka.
```
01:43:51.717 [redis-test-9-akka.actor.default-dispatcher-14] ERROR a.stream.impl.TransformProcessorImpl - failure during processing
java.lang.IllegalStateException: Processor actor terminated abruptly
at akka.stream.impl.ActorProcessorImpl.postStop(ActorProcessor.scala:287) ~[akka-stream-experimental_2.11-0.4.jar:na]
at akka.stream.impl.TransformProcessorImpl.postStop(SingleStreamProcessors.scala:82) ~[akka-stream-experimental_2.11-0.4.jar:na]
at akka.actor.Actor$class.aroundPostStop(Actor.scala:475) ~[akka-actor_2.11-2.3.4.jar:na]
at akka.stream.impl.ActorProcessorImpl.aroundPostStop(ActorProcessor.scala:238) ~[akka-stream-experimental_2.11-0.4.jar:na]
at akka.actor.dungeon.FaultHandling$class.akka$actor$dungeon$FaultHandling$$finishTerminate(FaultHandling.scala:210) ~[akka-actor_2.11-2.3.4.jar:na]
at akka.actor.dungeon.FaultHandling$class.terminate(FaultHandling.scala:172) ~[akka-actor_2.11-2.3.4.jar:na]
at akka.actor.ActorCell.terminate(ActorCell.scala:369) ~[akka-actor_2.11-2.3.4.jar:na]
at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:462) ~[akka-actor_2.11-2.3.4.jar:na]
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:478) ~[akka-actor_2.11-2.3.4.jar:na]
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:263) ~[akka-actor_2.11-2.3.4.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:219) ~[akka-actor_2.11-2.3.4.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_20-ea]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_20-ea]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_20-ea]
```

Looking forward to your Review :)