Skip to content

Commit

Permalink
Merge 13d2444 into 9c57ab7
Browse files Browse the repository at this point in the history
  • Loading branch information
wb14123 committed Jan 17, 2016
2 parents 9c57ab7 + 13d2444 commit 4baf860
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/main/scala/redis/Redis.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ abstract class RedisClientActorLike(system: ActorSystem, redisDispatcher: RedisD
implicit val executionContext = system.dispatchers.lookup(redisDispatcher.name)

val redisConnection: ActorRef = system.actorOf(
Props(classOf[RedisClientActor], new InetSocketAddress(host, port), getConnectOperations, onConnectStatus )
Props(classOf[RedisClientActor], new InetSocketAddress(host, port), getConnectOperations,
onConnectStatus, redisDispatcher.name)
.withDispatcher(redisDispatcher.name),
name + '-' + Redis.tempName()
)
Expand All @@ -51,7 +52,7 @@ abstract class RedisClientActorLike(system: ActorSystem, redisDispatcher: RedisD
}

def onConnectStatus(): (Boolean) => Unit = (status: Boolean) => {

}

def getConnectOperations: () => Seq[Operation[_, _]] = () => {
Expand Down Expand Up @@ -135,7 +136,7 @@ case class RedisPubSub(
}

def onConnectStatus(): (Boolean) => Unit = (status: Boolean) => {

}
}

Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/redis/RedisPool.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ abstract class RedisClientPoolLike(system: ActorSystem, redisDispatcher: RedisDi

def makeRedisClientActor(server: RedisServer, active: Ref[Boolean]): ActorRef = {
system.actorOf(
Props(classOf[RedisClientActor], new InetSocketAddress(server.host, server.port), getConnectOperations(server), onConnectStatus(server, active))
Props(classOf[RedisClientActor], new InetSocketAddress(server.host, server.port),
getConnectOperations(server), onConnectStatus(server, active), redisDispatcher.name)
.withDispatcher(redisDispatcher.name),
name + '-' + Redis.tempName()
)
Expand Down
7 changes: 4 additions & 3 deletions src/main/scala/redis/actors/RedisClientActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import akka.actor._
import scala.collection.mutable
import akka.actor.SupervisorStrategy.Stop

class RedisClientActor(override val address: InetSocketAddress, getConnectOperations: () => Seq[Operation[_, _]], onConnectStatus: Boolean => Unit ) extends RedisWorkerIO(address,onConnectStatus) {
class RedisClientActor(override val address: InetSocketAddress, getConnectOperations: () =>
Seq[Operation[_, _]], onConnectStatus: Boolean => Unit, dispatcherName: String) extends RedisWorkerIO(address,onConnectStatus) {


import context._
Expand All @@ -17,8 +18,8 @@ class RedisClientActor(override val address: InetSocketAddress, getConnectOperat
// connection closed on the sending direction
var oldRepliesDecoder: Option[ActorRef] = None

def initRepliesDecoder(implicit redisDispatcher: RedisDispatcher = Redis.dispatcher) =
context.actorOf(Props(classOf[RedisReplyDecoder]).withDispatcher(redisDispatcher.name))
def initRepliesDecoder() =
context.actorOf(Props(classOf[RedisReplyDecoder]).withDispatcher(dispatcherName))

var queuePromises = mutable.Queue[Operation[_, _]]()

Expand Down
6 changes: 3 additions & 3 deletions src/test/scala/redis/actors/RedisClientActorSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class RedisClientActorSpec extends TestKit(ActorSystem()) with SpecificationLike
Seq(opConnectPing, opConnectGet)
}


val redisClientActor = TestActorRef[RedisClientActorMock](Props(classOf[RedisClientActorMock], probeReplyDecoder.ref, probeMock.ref, getConnectOperations, onConnectStatus)
.withDispatcher(Redis.dispatcher.name))

Expand Down Expand Up @@ -134,8 +134,8 @@ class RedisClientActorSpec extends TestKit(ActorSystem()) with SpecificationLike
}

class RedisClientActorMock(probeReplyDecoder: ActorRef, probeMock: ActorRef, getConnectOperations: () => Seq[Operation[_, _]], onConnectStatus: Boolean => Unit )
extends RedisClientActor(new InetSocketAddress("localhost", 6379), getConnectOperations, onConnectStatus) {
override def initRepliesDecoder(implicit redisDispatcher: RedisDispatcher) = probeReplyDecoder
extends RedisClientActor(new InetSocketAddress("localhost", 6379), getConnectOperations, onConnectStatus, Redis.dispatcher.name) {
override def initRepliesDecoder() = probeReplyDecoder

override def preStart() {
// disable preStart of RedisWorkerIO
Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/redis/actors/RedisReplyDecoderSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class RedisReplyDecoderSpec
}

class RedisClientActorMock2(probeMock: ActorRef)
extends RedisClientActor(new InetSocketAddress("localhost", 6379), () => {Seq()}, (status:Boolean) => {()} ) {
extends RedisClientActor(new InetSocketAddress("localhost", 6379), () => {Seq()}, (status:Boolean) => {()}, Redis.dispatcher.name) {
override def preStart() {
// disable preStart of RedisWorkerIO
}
Expand Down

0 comments on commit 4baf860

Please sign in to comment.