Removed reflective coupling to akka cloud

This commit is contained in:
Jonas Bonér 2010-11-22 17:58:21 +01:00
parent fd2faeccba
commit 188d7e9c19
8 changed files with 33 additions and 99 deletions

View file

@ -6,7 +6,8 @@ package akka.dispatch
import java.util.concurrent._
import atomic. {AtomicInteger, AtomicBoolean, AtomicReference, AtomicLong}
import akka.util. {Switch, ReentrantGuard, Logging, HashCode}
import akka.util.{Switch, ReentrantGuard, Logging, HashCode, ReflectiveAccess}
import akka.actor._
/**
@ -59,11 +60,27 @@ object MessageDispatcher {
*/
trait MessageDispatcher extends MailboxFactory with Logging {
import MessageDispatcher._
protected val uuids = new ConcurrentSkipListSet[Uuid]
protected val guard = new ReentrantGuard
private var shutdownSchedule = UNSCHEDULED //This can be non-volatile since it is protected by guard withGuard
protected val active = new Switch(false)
private var shutdownSchedule = UNSCHEDULED //This can be non-volatile since it is protected by guard withGuard
/**
* Creates and returns a mailbox for the given actor.
*/
def createMailbox(mailboxImplClassname: String, actorRef: ActorRef): MessageQueue = {
ReflectiveAccess.createInstance(
mailboxImplClassname,
Array(classOf[ActorRef]),
Array(actorRef).asInstanceOf[Array[AnyRef]],
ReflectiveAccess.loader)
.getOrElse(throw new IllegalActorStateException(
"Could not create mailbox [" + mailboxImplClassname + "] for actor [" + actorRef + "]"))
.asInstanceOf[MessageQueue]
}
/**
* Attaches the specified actorRef to this dispatcher
*/