8000 Uniform channels creation · rssh/scala-gopher@0750748 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0750748

Browse files
committed
Uniform channels creation
1 parent a0ea6a4 commit 0750748

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/main/scala/gopher/channels/ChannelSupervisor.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ class ChannelSupervisor(api: GopherAPI) extends Actor
1212

1313
def receive = {
1414
case NewChannel(id,capacity) =>
15-
val props = if (capacity==0) {
16-
Props(classOf[UnbufferedChannelActor[_]],id, api)
17-
} else {
18-
Props(classOf[BufferedChannelActor[_]],id, capacity, api)
19-
}
15+
val actorClass = capacity match {
16+
case 0 => classOf[UnbufferedChannelActor[_]]
17+
case Int.MaxValue => classOf[GrowingBufferedChannelActor[_]]
18+
case _ => classOf[BufferedChannelActor[_]]
19+
}
20+
val props = Props(actorClass,id, capacity, api)
2021
sender ! context.actorOf(props, name=id.toString)
2122
case CloseChannel(id) =>
2223
context.actorSelection(id.toString) ! ChannelClose

src/main/scala/gopher/channels/UnbufferedChannelActor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import gopher._
1010
/**
1111
* ChannelActor - actor, which leave
1212
*/
13-
class UnbufferedChannelActor[A](id:Long, api: GopherAPI) extends ChannelActor[A](id,api)
13+
class UnbufferedChannelActor[A](id:Long, unused:Int, api: GopherAPI) extends ChannelActor[A](id,api)
1414
{
1515

1616
protected[this] def onContWrite(cw:ContWrite[A,_]):Unit =

0 commit comments

Comments
 (0)
0