Merge branch 'master' of http://github.com/jboner/akka
Conflicts: akka-amqp/src/main/scala/AMQP.scala
This commit is contained in:
commit
53d682bfee
27 changed files with 182 additions and 125 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -17,6 +17,7 @@ deploy/*.jar
|
|||
data
|
||||
out
|
||||
logs
|
||||
.codefellow
|
||||
storage
|
||||
.codefellow
|
||||
_dump
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ final class ActiveObjectContext {
|
|||
* Scala style getter.
|
||||
*/
|
||||
def sender: AnyRef = {
|
||||
if (_sender eq null) throw new IllegalStateException("Sender reference should not be null.")
|
||||
if (_sender eq null) throw new IllegalActorStateException("Sender reference should not be null.")
|
||||
else _sender
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ final class ActiveObjectContext {
|
|||
* Java style getter.
|
||||
*/
|
||||
def getSender: AnyRef = {
|
||||
if (_sender eq null) throw new IllegalStateException("Sender reference should not be null.")
|
||||
if (_sender eq null) throw new IllegalActorStateException("Sender reference should not be null.")
|
||||
else _sender
|
||||
}
|
||||
|
||||
|
|
@ -392,9 +392,9 @@ object ActiveObject extends Logging {
|
|||
*/
|
||||
def link(supervisor: AnyRef, supervised: AnyRef) = {
|
||||
val supervisorActor = actorFor(supervisor).getOrElse(
|
||||
throw new IllegalStateException("Can't link when the supervisor is not an active object"))
|
||||
throw new IllegalActorStateException("Can't link when the supervisor is not an active object"))
|
||||
val supervisedActor = actorFor(supervised).getOrElse(
|
||||
throw new IllegalStateException("Can't link when the supervised is not an active object"))
|
||||
throw new IllegalActorStateException("Can't link when the supervised is not an active object"))
|
||||
supervisorActor.link(supervisedActor)
|
||||
}
|
||||
|
||||
|
|
@ -407,9 +407,9 @@ object ActiveObject extends Logging {
|
|||
*/
|
||||
def link(supervisor: AnyRef, supervised: AnyRef, handler: FaultHandlingStrategy, trapExceptions: Array[Class[_ <: Throwable]]) = {
|
||||
val supervisorActor = actorFor(supervisor).getOrElse(
|
||||
throw new IllegalStateException("Can't link when the supervisor is not an active object"))
|
||||
throw new IllegalActorStateException("Can't link when the supervisor is not an active object"))
|
||||
val supervisedActor = actorFor(supervised).getOrElse(
|
||||
throw new IllegalStateException("Can't link when the supervised is not an active object"))
|
||||
throw new IllegalActorStateException("Can't link when the supervised is not an active object"))
|
||||
supervisorActor.trapExit = trapExceptions.toList
|
||||
supervisorActor.faultHandler = Some(handler)
|
||||
supervisorActor.link(supervisedActor)
|
||||
|
|
@ -422,9 +422,9 @@ object ActiveObject extends Logging {
|
|||
*/
|
||||
def unlink(supervisor: AnyRef, supervised: AnyRef) = {
|
||||
val supervisorActor = actorFor(supervisor).getOrElse(
|
||||
throw new IllegalStateException("Can't unlink when the supervisor is not an active object"))
|
||||
throw new IllegalActorStateException("Can't unlink when the supervisor is not an active object"))
|
||||
val supervisedActor = actorFor(supervised).getOrElse(
|
||||
throw new IllegalStateException("Can't unlink when the supervised is not an active object"))
|
||||
throw new IllegalActorStateException("Can't unlink when the supervised is not an active object"))
|
||||
supervisorActor.unlink(supervisedActor)
|
||||
}
|
||||
|
||||
|
|
@ -435,7 +435,7 @@ object ActiveObject extends Logging {
|
|||
*/
|
||||
def trapExit(supervisor: AnyRef, trapExceptions: Array[Class[_ <: Throwable]]) = {
|
||||
val supervisorActor = actorFor(supervisor).getOrElse(
|
||||
throw new IllegalStateException("Can't set trap exceptions when the supervisor is not an active object"))
|
||||
throw new IllegalActorStateException("Can't set trap exceptions when the supervisor is not an active object"))
|
||||
supervisorActor.trapExit = trapExceptions.toList
|
||||
this
|
||||
}
|
||||
|
|
@ -447,7 +447,7 @@ object ActiveObject extends Logging {
|
|||
*/
|
||||
def faultHandler(supervisor: AnyRef, handler: FaultHandlingStrategy) = {
|
||||
val supervisorActor = actorFor(supervisor).getOrElse(
|
||||
throw new IllegalStateException("Can't set fault handler when the supervisor is not an active object"))
|
||||
throw new IllegalActorStateException("Can't set fault handler when the supervisor is not an active object"))
|
||||
supervisorActor.faultHandler = Some(handler)
|
||||
this
|
||||
}
|
||||
|
|
@ -553,7 +553,7 @@ private[akka] sealed class ActiveObjectAspect {
|
|||
} else {
|
||||
val result = (actorRef !! (Invocation(joinPoint, false, isOneWay, sender, senderFuture), timeout)).as[AnyRef]
|
||||
if (result.isDefined) result.get
|
||||
else throw new IllegalStateException("No result defined for invocation [" + joinPoint + "]")
|
||||
else throw new IllegalActorStateException("No result defined for invocation [" + joinPoint + "]")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -581,8 +581,8 @@ private[akka] sealed class ActiveObjectAspect {
|
|||
future.get.await
|
||||
val result = getResultOrThrowException(future.get)
|
||||
if (result.isDefined) result.get
|
||||
else throw new IllegalStateException("No result returned from call to [" + joinPoint + "]")
|
||||
} else throw new IllegalStateException("No future returned from call to [" + joinPoint + "]")
|
||||
else throw new IllegalActorStateException("No result returned from call to [" + joinPoint + "]")
|
||||
} else throw new IllegalActorStateException("No future returned from call to [" + joinPoint + "]")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -686,12 +686,12 @@ private[akka] class Dispatcher(transactionalRequired: Boolean, var callbacks: Op
|
|||
case Some(RestartCallbacks(pre, post)) =>
|
||||
preRestart = Some(try {
|
||||
targetInstance.getClass.getDeclaredMethod(pre, ZERO_ITEM_CLASS_ARRAY: _*)
|
||||
} catch { case e => throw new IllegalStateException(
|
||||
} catch { case e => throw new IllegalActorStateException(
|
||||
"Could not find pre restart method [" + pre + "] \nin [" +
|
||||
targetClass.getName + "]. \nIt must have a zero argument definition.") })
|
||||
postRestart = Some(try {
|
||||
targetInstance.getClass.getDeclaredMethod(post, ZERO_ITEM_CLASS_ARRAY: _*)
|
||||
} catch { case e => throw new IllegalStateException(
|
||||
} catch { case e => throw new IllegalActorStateException(
|
||||
"Could not find post restart method [" + post + "] \nin [" +
|
||||
targetClass.getName + "]. \nIt must have a zero argument definition.") })
|
||||
}
|
||||
|
|
@ -701,11 +701,11 @@ private[akka] class Dispatcher(transactionalRequired: Boolean, var callbacks: Op
|
|||
if (!postRestart.isDefined) postRestart = methods.find(m => m.isAnnotationPresent(Annotations.postrestart))
|
||||
|
||||
if (preRestart.isDefined && preRestart.get.getParameterTypes.length != 0)
|
||||
throw new IllegalStateException(
|
||||
throw new IllegalActorStateException(
|
||||
"Method annotated with @prerestart or defined as a restart callback in \n[" +
|
||||
targetClass.getName + "] must have a zero argument definition")
|
||||
if (postRestart.isDefined && postRestart.get.getParameterTypes.length != 0)
|
||||
throw new IllegalStateException(
|
||||
throw new IllegalActorStateException(
|
||||
"Method annotated with @postrestart or defined as a restart callback in \n[" +
|
||||
targetClass.getName + "] must have a zero argument definition")
|
||||
|
||||
|
|
@ -715,7 +715,7 @@ private[akka] class Dispatcher(transactionalRequired: Boolean, var callbacks: Op
|
|||
// see if we have a method annotated with @inittransactionalstate, if so invoke it
|
||||
initTxState = methods.find(m => m.isAnnotationPresent(Annotations.inittransactionalstate))
|
||||
if (initTxState.isDefined && initTxState.get.getParameterTypes.length != 0)
|
||||
throw new IllegalStateException("Method annotated with @inittransactionalstate must have a zero argument definition")
|
||||
throw new IllegalActorStateException("Method annotated with @inittransactionalstate must have a zero argument definition")
|
||||
if (initTxState.isDefined) initTxState.get.setAccessible(true)
|
||||
}
|
||||
|
||||
|
|
@ -736,7 +736,7 @@ private[akka] class Dispatcher(transactionalRequired: Boolean, var callbacks: Op
|
|||
case Link(target) => self.link(target)
|
||||
case Unlink(target) => self.unlink(target)
|
||||
case unexpected =>
|
||||
throw new IllegalStateException("Unexpected message [" + unexpected + "] sent to [" + this + "]")
|
||||
throw new IllegalActorStateException("Unexpected message [" + unexpected + "] sent to [" + this + "]")
|
||||
}
|
||||
|
||||
override def preRestart(reason: Throwable) {
|
||||
|
|
|
|||
|
|
@ -47,11 +47,11 @@ case class Link(child: ActorRef) extends LifeCycleMessage
|
|||
case class Unlink(child: ActorRef) extends LifeCycleMessage
|
||||
case class UnlinkAndStop(child: ActorRef) extends LifeCycleMessage
|
||||
case object Kill extends LifeCycleMessage
|
||||
|
||||
case object ReceiveTimeout
|
||||
case object ReceiveTimeout extends LifeCycleMessage
|
||||
|
||||
// Exceptions for Actors
|
||||
class ActorStartException private[akka](message: String) extends RuntimeException(message)
|
||||
class IllegalActorStateException private[akka](message: String) extends RuntimeException(message)
|
||||
class ActorKilledException private[akka](message: String) extends RuntimeException(message)
|
||||
class ActorInitializationException private[akka](message: String) extends RuntimeException(message)
|
||||
|
||||
|
|
@ -438,7 +438,7 @@ trait Actor extends Logging {
|
|||
cancelReceiveTimeout
|
||||
lifeCycles orElse (self.hotswap getOrElse receive)
|
||||
} catch {
|
||||
case e: NullPointerException => throw new IllegalStateException(
|
||||
case e: NullPointerException => throw new IllegalActorStateException(
|
||||
"The 'self' ActorRef reference for [" + getClass.getName + "] is NULL, error in the ActorRef initialization process.")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ trait ActorRef extends TransactionManagement {
|
|||
* Used if the receive (or HotSwap) contains a case handling ReceiveTimeout.
|
||||
*/
|
||||
@volatile var receiveTimeout: Long = Actor.RECEIVE_TIMEOUT
|
||||
|
||||
|
||||
/**
|
||||
* User overridable callback/setting.
|
||||
*
|
||||
|
|
@ -319,7 +319,7 @@ trait ActorRef extends TransactionManagement {
|
|||
if (sender.get.senderFuture.isDefined) postMessageToMailboxAndCreateFutureResultWithTimeout(
|
||||
message, timeout, sender.get.sender, sender.get.senderFuture)
|
||||
else if (sender.get.sender.isDefined) postMessageToMailbox(message, Some(sender.get.sender.get))
|
||||
else throw new IllegalStateException("Can't forward message when initial sender is not an actor")
|
||||
else throw new IllegalActorStateException("Can't forward message when initial sender is not an actor")
|
||||
} else throw new ActorInitializationException("Actor has not been started, you need to invoke 'actor.start' before using it")
|
||||
}
|
||||
|
||||
|
|
@ -329,7 +329,7 @@ trait ActorRef extends TransactionManagement {
|
|||
* <p/>
|
||||
* Throws an IllegalStateException if unable to determine what to reply to.
|
||||
*/
|
||||
def reply(message: Any) = if(!reply_?(message)) throw new IllegalStateException(
|
||||
def reply(message: Any) = if(!reply_?(message)) throw new IllegalActorStateException(
|
||||
"\n\tNo sender in scope, can't reply. " +
|
||||
"\n\tYou have probably: " +
|
||||
"\n\t\t1. Sent a message to an Actor from an instance that is NOT an Actor." +
|
||||
|
|
@ -585,7 +585,7 @@ sealed class LocalActorRef private[akka](
|
|||
__format: Format[_ <: Actor]) = {
|
||||
this(() => {
|
||||
val actorClass = __loader.loadClass(__actorClassName)
|
||||
if (__format.isInstanceOf[SerializerBasedActorFormat[_]])
|
||||
if (__format.isInstanceOf[SerializerBasedActorFormat[_]])
|
||||
__format.asInstanceOf[SerializerBasedActorFormat[_]]
|
||||
.serializer
|
||||
.fromBinary(__actorBytes, Some(actorClass)).asInstanceOf[Actor]
|
||||
|
|
@ -760,7 +760,7 @@ sealed class LocalActorRef private[akka](
|
|||
* To be invoked from within the actor itself.
|
||||
*/
|
||||
def link(actorRef: ActorRef) = guard.withGuard {
|
||||
if (actorRef.supervisor.isDefined) throw new IllegalStateException(
|
||||
if (actorRef.supervisor.isDefined) throw new IllegalActorStateException(
|
||||
"Actor can only have one supervisor [" + actorRef + "], e.g. link(actor) fails")
|
||||
linkedActors.put(actorRef.uuid, actorRef)
|
||||
actorRef.supervisor = Some(this)
|
||||
|
|
@ -773,7 +773,7 @@ sealed class LocalActorRef private[akka](
|
|||
* To be invoked from within the actor itself.
|
||||
*/
|
||||
def unlink(actorRef: ActorRef) = guard.withGuard {
|
||||
if (!linkedActors.containsKey(actorRef.uuid)) throw new IllegalStateException(
|
||||
if (!linkedActors.containsKey(actorRef.uuid)) throw new IllegalActorStateException(
|
||||
"Actor [" + actorRef + "] is not a linked actor, can't unlink")
|
||||
linkedActors.remove(actorRef.uuid)
|
||||
actorRef.supervisor = None
|
||||
|
|
@ -943,7 +943,7 @@ sealed class LocalActorRef private[akka](
|
|||
val future = RemoteClient.clientFor(remoteAddress.get).send(
|
||||
createRemoteRequestProtocolBuilder(this, message, false, senderOption).build, senderFuture)
|
||||
if (future.isDefined) future.get
|
||||
else throw new IllegalStateException("Expected a future from remote call to actor " + toString)
|
||||
else throw new IllegalActorStateException("Expected a future from remote call to actor " + toString)
|
||||
} else {
|
||||
val future = if (senderFuture.isDefined) senderFuture.get
|
||||
else new DefaultCompletableFuture[T](timeout)
|
||||
|
|
@ -1011,7 +1011,6 @@ sealed class LocalActorRef private[akka](
|
|||
setTransactionSet(txSet) // restore transaction set to allow atomic block to do commit
|
||||
}
|
||||
} catch {
|
||||
case e: IllegalStateException => {}
|
||||
case e =>
|
||||
_isBeingRestarted = true
|
||||
// abort transaction set
|
||||
|
|
@ -1046,7 +1045,7 @@ sealed class LocalActorRef private[akka](
|
|||
case OneForOneStrategy(maxNrOfRetries, withinTimeRange) =>
|
||||
dead.restart(reason)
|
||||
}
|
||||
} else throw new IllegalStateException(
|
||||
} else throw new IllegalActorStateException(
|
||||
"No 'faultHandler' defined for an actor with the 'trapExit' member field defined " +
|
||||
"\n\tto non-empty list of exception classes - can't proceed " + toString)
|
||||
} else {
|
||||
|
|
@ -1082,7 +1081,7 @@ sealed class LocalActorRef private[akka](
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected[akka] def restartLinkedActors(reason: Throwable) = guard.withGuard {
|
||||
linkedActorsAsList.foreach { actorRef =>
|
||||
if (actorRef.lifeCycle.isEmpty) actorRef.lifeCycle = Some(LifeCycle(Permanent))
|
||||
|
|
@ -1148,7 +1147,7 @@ sealed class LocalActorRef private[akka](
|
|||
case e: NoSuchFieldException =>
|
||||
val parent = clazz.getSuperclass
|
||||
if (parent != null) findActorSelfField(parent)
|
||||
else throw new IllegalStateException(toString + " is not an Actor since it have not mixed in the 'Actor' trait")
|
||||
else throw new IllegalActorStateException(toString + " is not an Actor since it have not mixed in the 'Actor' trait")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1214,7 +1213,7 @@ private[akka] case class RemoteActorRef private[akka] (
|
|||
senderFuture: Option[CompletableFuture[T]]): CompletableFuture[T] = {
|
||||
val future = remoteClient.send(createRemoteRequestProtocolBuilder(this, message, false, senderOption).build, senderFuture)
|
||||
if (future.isDefined) future.get
|
||||
else throw new IllegalStateException("Expected a future from remote call to actor " + toString)
|
||||
else throw new IllegalActorStateException("Expected a future from remote call to actor " + toString)
|
||||
}
|
||||
|
||||
def start: ActorRef = {
|
||||
|
|
|
|||
|
|
@ -37,10 +37,7 @@ object ActorRegistry extends ListenerManagement {
|
|||
* Returns all actors in the system.
|
||||
*/
|
||||
def actors: List[ActorRef] = {
|
||||
val all = new ListBuffer[ActorRef]
|
||||
val elements = actorsByUUID.elements
|
||||
while (elements.hasMoreElements) all += elements.nextElement
|
||||
all.toList
|
||||
filter(_=> true)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -52,20 +49,32 @@ object ActorRegistry extends ListenerManagement {
|
|||
}
|
||||
|
||||
/**
|
||||
* Finds all actors that are subtypes of the class passed in as the Manifest argument.
|
||||
* Finds all actors that are subtypes of the class passed in as the Manifest argument and supproting passed message.
|
||||
*/
|
||||
def actorsFor[T <: Actor](implicit manifest: Manifest[T]): List[ActorRef] = {
|
||||
val all = new ListBuffer[ActorRef]
|
||||
def actorsFor[T <: Actor](message: Any)(implicit manifest: Manifest[T] ): List[ActorRef] =
|
||||
filter(a => manifest.erasure.isAssignableFrom(a.actor.getClass) && a.isDefinedAt(message))
|
||||
|
||||
/**
|
||||
* Finds all actors that satisfy a predicate.
|
||||
*/
|
||||
def filter(p: ActorRef => Boolean): List[ActorRef] = {
|
||||
val all = new ListBuffer[ActorRef]
|
||||
val elements = actorsByUUID.elements
|
||||
while (elements.hasMoreElements) {
|
||||
val actorId = elements.nextElement
|
||||
if (manifest.erasure.isAssignableFrom(actorId.actor.getClass)) {
|
||||
if (p(actorId)) {
|
||||
all += actorId
|
||||
}
|
||||
}
|
||||
all.toList
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds all actors that are subtypes of the class passed in as the Manifest argument.
|
||||
*/
|
||||
def actorsFor[T <: Actor](implicit manifest: Manifest[T]): List[ActorRef] =
|
||||
filter(a => manifest.erasure.isAssignableFrom(a.actor.getClass))
|
||||
|
||||
/**
|
||||
* Finds any actor that matches T.
|
||||
*/
|
||||
|
|
@ -107,7 +116,7 @@ object ActorRegistry extends ListenerManagement {
|
|||
|
||||
// ID
|
||||
val id = actor.id
|
||||
if (id eq null) throw new IllegalStateException("Actor.id is null " + actor)
|
||||
if (id eq null) throw new IllegalActorStateException("Actor.id is null " + actor)
|
||||
if (actorsById.containsKey(id)) actorsById.get(id).add(actor)
|
||||
else {
|
||||
val set = new CopyOnWriteArraySet[ActorRef]
|
||||
|
|
|
|||
|
|
@ -95,4 +95,4 @@ private object SchedulerThreadFactory extends ThreadFactory {
|
|||
thread.setDaemon(true)
|
||||
thread
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,10 +70,10 @@ trait SerializerBasedActorFormat[T <: Actor] extends Format[T] {
|
|||
*/
|
||||
object ActorSerialization {
|
||||
|
||||
def fromBinary[T <: Actor](bytes: Array[Byte])(implicit format: Format[T]): ActorRef =
|
||||
def fromBinary[T <: Actor](bytes: Array[Byte])(implicit format: Format[T]): ActorRef =
|
||||
fromBinaryToLocalActorRef(bytes, format)
|
||||
|
||||
def toBinary[T <: Actor](a: ActorRef)(implicit format: Format[T]): Array[Byte] = {
|
||||
def toBinary[T <: Actor](a: ActorRef)(implicit format: Format[T]): Array[Byte] = {
|
||||
toSerializedActorRefProtocol(a, format).toByteArray
|
||||
}
|
||||
|
||||
|
|
@ -85,7 +85,7 @@ object ActorSerialization {
|
|||
}
|
||||
val builder = LifeCycleProtocol.newBuilder
|
||||
a.lifeCycle match {
|
||||
case Some(LifeCycle(scope, None)) =>
|
||||
case Some(LifeCycle(scope, None)) =>
|
||||
setScope(builder, scope)
|
||||
Some(builder.build)
|
||||
case Some(LifeCycle(scope, Some(callbacks))) =>
|
||||
|
|
@ -118,14 +118,14 @@ object ActorSerialization {
|
|||
builder.build
|
||||
}
|
||||
|
||||
private def fromBinaryToLocalActorRef[T <: Actor](bytes: Array[Byte], format: Format[T]): ActorRef =
|
||||
private def fromBinaryToLocalActorRef[T <: Actor](bytes: Array[Byte], format: Format[T]): ActorRef =
|
||||
fromProtobufToLocalActorRef(SerializedActorRefProtocol.newBuilder.mergeFrom(bytes).build, format, None)
|
||||
|
||||
private def fromProtobufToLocalActorRef[T <: Actor](protocol: SerializedActorRefProtocol, format: Format[T], loader: Option[ClassLoader]): ActorRef = {
|
||||
Actor.log.debug("Deserializing SerializedActorRefProtocol to LocalActorRef:\n" + protocol)
|
||||
|
||||
val serializer =
|
||||
if (format.isInstanceOf[SerializerBasedActorFormat[_]])
|
||||
|
||||
val serializer =
|
||||
if (format.isInstanceOf[SerializerBasedActorFormat[_]])
|
||||
Some(format.asInstanceOf[SerializerBasedActorFormat[_]].serializer)
|
||||
else None
|
||||
|
||||
|
|
@ -133,19 +133,19 @@ object ActorSerialization {
|
|||
if (protocol.hasLifeCycle) {
|
||||
val lifeCycleProtocol = protocol.getLifeCycle
|
||||
val restartCallbacks =
|
||||
if (lifeCycleProtocol.hasPreRestart || lifeCycleProtocol.hasPostRestart)
|
||||
if (lifeCycleProtocol.hasPreRestart || lifeCycleProtocol.hasPostRestart)
|
||||
Some(RestartCallbacks(lifeCycleProtocol.getPreRestart, lifeCycleProtocol.getPostRestart))
|
||||
else None
|
||||
Some(if (lifeCycleProtocol.getLifeCycle == LifeCycleType.PERMANENT) LifeCycle(Permanent, restartCallbacks)
|
||||
else if (lifeCycleProtocol.getLifeCycle == LifeCycleType.TEMPORARY) LifeCycle(Temporary, restartCallbacks)
|
||||
else throw new IllegalStateException("LifeCycle type is not valid: " + lifeCycleProtocol.getLifeCycle))
|
||||
else throw new IllegalActorStateException("LifeCycle type is not valid: " + lifeCycleProtocol.getLifeCycle))
|
||||
} else None
|
||||
|
||||
val supervisor =
|
||||
if (protocol.hasSupervisor)
|
||||
Some(RemoteActorSerialization.fromProtobufToRemoteActorRef(protocol.getSupervisor, loader))
|
||||
else None
|
||||
|
||||
|
||||
val hotswap =
|
||||
if (serializer.isDefined && protocol.hasHotswapStack) Some(serializer.get
|
||||
.fromBinary(protocol.getHotswapStack.toByteArray, Some(classOf[PartialFunction[Any, Unit]]))
|
||||
|
|
@ -214,7 +214,7 @@ object RemoteActorSerialization {
|
|||
RemoteServer.registerActor(homeAddress, uuid, ar)
|
||||
registeredInRemoteNodeDuringSerialization = true
|
||||
}
|
||||
|
||||
|
||||
RemoteActorRefProtocol.newBuilder
|
||||
.setUuid(uuid)
|
||||
.setActorClassname(actorClass.getName)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package se.scalablesolutions.akka.config
|
|||
import com.google.inject._
|
||||
|
||||
import se.scalablesolutions.akka.config.ScalaConfig._
|
||||
import se.scalablesolutions.akka.actor.{Supervisor, ActiveObject, Dispatcher, ActorRef, Actor}
|
||||
import se.scalablesolutions.akka.actor.{Supervisor, ActiveObject, Dispatcher, ActorRef, Actor, IllegalActorStateException}
|
||||
import se.scalablesolutions.akka.remote.RemoteServer
|
||||
import se.scalablesolutions.akka.util.Logging
|
||||
|
||||
|
|
@ -42,10 +42,10 @@ private[akka] class ActiveObjectGuiceConfigurator extends ActiveObjectConfigurat
|
|||
*/
|
||||
def getInstance[T](clazz: Class[T]): List[T] = synchronized {
|
||||
log.debug("Retrieving active object [%s]", clazz.getName)
|
||||
if (injector eq null) throw new IllegalStateException(
|
||||
if (injector eq null) throw new IllegalActorStateException(
|
||||
"inject() and/or supervise() must be called before invoking getInstance(clazz)")
|
||||
val (proxy, targetInstance, component) =
|
||||
activeObjectRegistry.getOrElse(clazz, throw new IllegalStateException(
|
||||
activeObjectRegistry.getOrElse(clazz, throw new IllegalActorStateException(
|
||||
"Class [" + clazz.getName + "] has not been put under supervision" +
|
||||
"\n(by passing in the config to the 'configure' and then invoking 'supervise') method"))
|
||||
injector.injectMembers(targetInstance)
|
||||
|
|
@ -114,7 +114,7 @@ private[akka] class ActiveObjectGuiceConfigurator extends ActiveObjectConfigurat
|
|||
}
|
||||
|
||||
override def inject: ActiveObjectConfiguratorBase = synchronized {
|
||||
if (injector ne null) throw new IllegalStateException("inject() has already been called on this configurator")
|
||||
if (injector ne null) throw new IllegalActorStateException("inject() has already been called on this configurator")
|
||||
injector = Guice.createInjector(modules)
|
||||
this
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
package se.scalablesolutions.akka.dispatch
|
||||
|
||||
import se.scalablesolutions.akka.actor.ActorRef
|
||||
import se.scalablesolutions.akka.actor.{ActorRef, IllegalActorStateException}
|
||||
|
||||
/**
|
||||
* Default settings are:
|
||||
|
|
@ -92,7 +92,7 @@ class ExecutorBasedEventDrivenDispatcher(_name: String, throughput: Int = Dispat
|
|||
} while ((lockAcquiredOnce && !finishedBeforeMailboxEmpty && !mailbox.isEmpty))
|
||||
}
|
||||
})
|
||||
} else throw new IllegalStateException("Can't submit invocations to dispatcher since it's not started")
|
||||
} else throw new IllegalActorStateException("Can't submit invocations to dispatcher since it's not started")
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -133,7 +133,7 @@ class ExecutorBasedEventDrivenDispatcher(_name: String, throughput: Int = Dispat
|
|||
|
||||
def usesActorMailbox = true
|
||||
|
||||
def ensureNotActive: Unit = if (active) throw new IllegalStateException(
|
||||
def ensureNotActive: Unit = if (active) throw new IllegalActorStateException(
|
||||
"Can't build a new thread pool for a dispatcher that is already up and running")
|
||||
|
||||
private[akka] def init = withNewThreadPoolWithLinkedBlockingQueueWithUnboundedCapacity.buildThreadPool
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ package se.scalablesolutions.akka.dispatch
|
|||
|
||||
import java.util.concurrent.CopyOnWriteArrayList
|
||||
|
||||
import se.scalablesolutions.akka.actor.{Actor, ActorRef}
|
||||
import se.scalablesolutions.akka.actor.{Actor, ActorRef, IllegalActorStateException}
|
||||
|
||||
/**
|
||||
* An executor based event driven dispatcher which will try to redistribute work from busy actors to idle actors. It is assumed
|
||||
|
|
@ -55,7 +55,7 @@ class ExecutorBasedEventDrivenWorkStealingDispatcher(_name: String) extends Mess
|
|||
}
|
||||
}
|
||||
})
|
||||
} else throw new IllegalStateException("Can't submit invocations to dispatcher since it's not started")
|
||||
} else throw new IllegalActorStateException("Can't submit invocations to dispatcher since it's not started")
|
||||
|
||||
/**
|
||||
* Try processing the mailbox of the given actor. Fails if the dispatching lock on the actor is already held by
|
||||
|
|
@ -162,7 +162,7 @@ class ExecutorBasedEventDrivenWorkStealingDispatcher(_name: String) extends Mess
|
|||
references.clear
|
||||
}
|
||||
|
||||
def ensureNotActive: Unit = if (active) throw new IllegalStateException(
|
||||
def ensureNotActive: Unit = if (active) throw new IllegalActorStateException(
|
||||
"Can't build a new thread pool for a dispatcher that is already up and running")
|
||||
|
||||
private[akka] def init = withNewThreadPoolWithLinkedBlockingQueueWithUnboundedCapacity.buildThreadPool
|
||||
|
|
@ -187,7 +187,7 @@ class ExecutorBasedEventDrivenWorkStealingDispatcher(_name: String) extends Mess
|
|||
}
|
||||
case Some(aType) => {
|
||||
if (aType != actorOfId.actor.getClass)
|
||||
throw new IllegalStateException(
|
||||
throw new IllegalActorStateException(
|
||||
String.format("Can't register actor %s in a work stealing dispatcher which already knows actors of type %s",
|
||||
actorOfId.actor, aType))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@ import java.util.concurrent.locks.ReentrantLock
|
|||
|
||||
import java.util.{HashSet, HashMap, LinkedList, List}
|
||||
|
||||
import se.scalablesolutions.akka.actor.IllegalActorStateException
|
||||
|
||||
/**
|
||||
* Implements the Reactor pattern as defined in: [http://www.cs.wustl.edu/~schmidt/PDF/reactor-siemens.pdf].<br/>
|
||||
* See also this article: [http://today.java.net/cs/user/print/a/350].
|
||||
|
|
@ -105,10 +107,10 @@ class ReactorBasedThreadPoolEventDrivenDispatcher(_name: String)
|
|||
val invocations = selectedInvocations.iterator
|
||||
while (invocations.hasNext && totalNrOfActors > totalNrOfBusyActors && passFairnessCheck(nrOfBusyMessages)) {
|
||||
val invocation = invocations.next
|
||||
if (invocation eq null) throw new IllegalStateException("Message invocation is null [" + invocation + "]")
|
||||
if (invocation eq null) throw new IllegalActorStateException("Message invocation is null [" + invocation + "]")
|
||||
if (!busyActors.contains(invocation.receiver)) {
|
||||
val invoker = messageInvokers.get(invocation.receiver)
|
||||
if (invoker eq null) throw new IllegalStateException("Message invoker for invocation [" + invocation + "] is null")
|
||||
if (invoker eq null) throw new IllegalActorStateException("Message invoker for invocation [" + invocation + "] is null")
|
||||
resume(invocation.receiver)
|
||||
invocations.remove
|
||||
executor.execute(new Runnable() {
|
||||
|
|
@ -137,7 +139,7 @@ class ReactorBasedThreadPoolEventDrivenDispatcher(_name: String)
|
|||
|
||||
def usesActorMailbox = false
|
||||
|
||||
def ensureNotActive: Unit = if (active) throw new IllegalStateException(
|
||||
def ensureNotActive: Unit = if (active) throw new IllegalActorStateException(
|
||||
"Can't build a new thread pool for a dispatcher that is already up and running")
|
||||
|
||||
class Demultiplexer(private val messageQueue: ReactiveMessageQueue) extends MessageDemultiplexer {
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import java.util.concurrent._
|
|||
import atomic.{AtomicLong, AtomicInteger}
|
||||
import ThreadPoolExecutor.CallerRunsPolicy
|
||||
|
||||
import se.scalablesolutions.akka.actor.IllegalActorStateException
|
||||
import se.scalablesolutions.akka.util.Logging
|
||||
|
||||
trait ThreadPoolBuilder {
|
||||
|
|
@ -142,12 +143,12 @@ trait ThreadPoolBuilder {
|
|||
}
|
||||
|
||||
protected def verifyNotInConstructionPhase = {
|
||||
if (inProcessOfBuilding) throw new IllegalStateException("Is already in the process of building a thread pool")
|
||||
if (inProcessOfBuilding) throw new IllegalActorStateException("Is already in the process of building a thread pool")
|
||||
inProcessOfBuilding = true
|
||||
}
|
||||
|
||||
protected def verifyInConstructionPhase = {
|
||||
if (!inProcessOfBuilding) throw new IllegalStateException(
|
||||
if (!inProcessOfBuilding) throw new IllegalActorStateException(
|
||||
"Is not in the process of building a thread pool, start building one by invoking one of the 'newThreadPool*' methods")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
package se.scalablesolutions.akka.remote
|
||||
|
||||
import se.scalablesolutions.akka.remote.protocol.RemoteProtocol._
|
||||
import se.scalablesolutions.akka.actor.{Exit, Actor, ActorRef, RemoteActorRef}
|
||||
import se.scalablesolutions.akka.actor.{Exit, Actor, ActorRef, RemoteActorRef, IllegalActorStateException}
|
||||
import se.scalablesolutions.akka.dispatch.{DefaultCompletableFuture, CompletableFuture}
|
||||
import se.scalablesolutions.akka.util.{UUID, Logging}
|
||||
import se.scalablesolutions.akka.config.Config.config
|
||||
|
|
@ -230,11 +230,11 @@ class RemoteClient private[akka] (val hostname: String, val port: Int, loader: O
|
|||
}
|
||||
|
||||
private[akka] def registerSupervisorForActor(actorRef: ActorRef) =
|
||||
if (!actorRef.supervisor.isDefined) throw new IllegalStateException("Can't register supervisor for " + actorRef + " since it is not under supervision")
|
||||
if (!actorRef.supervisor.isDefined) throw new IllegalActorStateException("Can't register supervisor for " + actorRef + " since it is not under supervision")
|
||||
else supervisors.putIfAbsent(actorRef.supervisor.get.uuid, actorRef)
|
||||
|
||||
private[akka] def deregisterSupervisorForActor(actorRef: ActorRef) =
|
||||
if (!actorRef.supervisor.isDefined) throw new IllegalStateException("Can't unregister supervisor for " + actorRef + " since it is not under supervision")
|
||||
if (!actorRef.supervisor.isDefined) throw new IllegalActorStateException("Can't unregister supervisor for " + actorRef + " since it is not under supervision")
|
||||
else supervisors.remove(actorRef.supervisor.get.uuid)
|
||||
}
|
||||
|
||||
|
|
@ -302,10 +302,10 @@ class RemoteClientHandler(val name: String,
|
|||
} else {
|
||||
if (reply.hasSupervisorUuid()) {
|
||||
val supervisorUuid = reply.getSupervisorUuid
|
||||
if (!supervisors.containsKey(supervisorUuid)) throw new IllegalStateException(
|
||||
if (!supervisors.containsKey(supervisorUuid)) throw new IllegalActorStateException(
|
||||
"Expected a registered supervisor for UUID [" + supervisorUuid + "] but none was found")
|
||||
val supervisedActor = supervisors.get(supervisorUuid)
|
||||
if (!supervisedActor.supervisor.isDefined) throw new IllegalStateException(
|
||||
if (!supervisedActor.supervisor.isDefined) throw new IllegalActorStateException(
|
||||
"Can't handle restart for remote actor " + supervisedActor + " since its supervisor has been removed")
|
||||
else supervisedActor.supervisor.get ! Exit(supervisedActor, parseException(reply))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ class RemoteServerHandler(
|
|||
|
||||
override def messageReceived(ctx: ChannelHandlerContext, event: MessageEvent) = {
|
||||
val message = event.getMessage
|
||||
if (message eq null) throw new IllegalStateException("Message in remote MessageEvent is null: " + event)
|
||||
if (message eq null) throw new IllegalActorStateException("Message in remote MessageEvent is null: " + event)
|
||||
if (message.isInstanceOf[RemoteRequestProtocol]) {
|
||||
handleRemoteRequestProtocol(message.asInstanceOf[RemoteRequestProtocol], event.getChannel)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class GlobalStm extends TransactionManagement with Logging {
|
|||
val txSet = getTransactionSetInScope
|
||||
log.trace("Committing transaction [%s]\n\tby joining transaction set [%s]", mtx, txSet)
|
||||
// FIXME ? txSet.tryJoinCommit(mtx, TransactionManagement.TRANSACTION_TIMEOUT, TimeUnit.MILLISECONDS)
|
||||
txSet.joinCommit(mtx)
|
||||
try { txSet.joinCommit(mtx) } catch { case e: IllegalStateException => {} }
|
||||
clearTransaction
|
||||
result
|
||||
}
|
||||
|
|
@ -160,13 +160,15 @@ trait StmUtil {
|
|||
* Schedule a deferred task on the thread local transaction (use within an atomic).
|
||||
* This is executed when the transaction commits.
|
||||
*/
|
||||
def deferred[T](body: => T): Unit = MultiverseStmUtils.scheduleDeferredTask(new Runnable { def run = body })
|
||||
def deferred[T](body: => T): Unit =
|
||||
MultiverseStmUtils.scheduleDeferredTask(new Runnable { def run = body })
|
||||
|
||||
/**
|
||||
* Schedule a compensating task on the thread local transaction (use within an atomic).
|
||||
* This is executed when the transaction aborts.
|
||||
*/
|
||||
def compensating[T](body: => T): Unit = MultiverseStmUtils.scheduleCompensatingTask(new Runnable { def run = body })
|
||||
def compensating[T](body: => T): Unit =
|
||||
MultiverseStmUtils.scheduleCompensatingTask(new Runnable { def run = body })
|
||||
|
||||
/**
|
||||
* STM retry for blocking transactions (use within an atomic).
|
||||
|
|
|
|||
|
|
@ -14,6 +14,19 @@ object ActorRegistrySpec {
|
|||
self.reply("got ping")
|
||||
}
|
||||
}
|
||||
|
||||
class TestActor2 extends Actor {
|
||||
self.id = "MyID2"
|
||||
def receive = {
|
||||
case "ping" =>
|
||||
record = "pong" + record
|
||||
self.reply("got ping")
|
||||
case "ping2" =>
|
||||
record = "pong" + record
|
||||
self.reply("got ping")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ActorRegistrySpec extends JUnitSuite {
|
||||
|
|
@ -111,6 +124,34 @@ class ActorRegistrySpec extends JUnitSuite {
|
|||
actor2.stop
|
||||
}
|
||||
|
||||
@Test def shouldGetActorsByMessageFromActorRegistry {
|
||||
|
||||
ActorRegistry.shutdownAll
|
||||
val actor1 = actorOf[TestActor]
|
||||
actor1.start
|
||||
val actor2 = actorOf[TestActor2]
|
||||
actor2.start
|
||||
|
||||
val actorsForAcotrTestActor = ActorRegistry.actorsFor[TestActor]
|
||||
assert(actorsForAcotrTestActor.size === 1)
|
||||
|
||||
val actorsForAcotrTestActor2 = ActorRegistry.actorsFor[TestActor2]
|
||||
assert(actorsForAcotrTestActor2.size === 1)
|
||||
|
||||
val actorsForAcotr = ActorRegistry.actorsFor[Actor]
|
||||
assert(actorsForAcotr.size === 2)
|
||||
|
||||
|
||||
val actorsForMessagePing2 = ActorRegistry.actorsFor[Actor]("ping2")
|
||||
assert(actorsForMessagePing2.size === 1)
|
||||
|
||||
val actorsForMessagePing = ActorRegistry.actorsFor[Actor]("ping")
|
||||
assert(actorsForMessagePing.size === 2)
|
||||
|
||||
actor1.stop
|
||||
actor2.stop
|
||||
}
|
||||
|
||||
@Test def shouldGetAllActorsFromActorRegistry {
|
||||
ActorRegistry.shutdownAll
|
||||
val actor1 = actorOf[TestActor]
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class ExecutorBasedEventDrivenWorkStealingDispatcherSpec extends JUnitSuite with
|
|||
val second = actorOf[SecondActor]
|
||||
|
||||
first.start
|
||||
intercept[IllegalStateException] {
|
||||
intercept[IllegalActorStateException] {
|
||||
second.start
|
||||
}
|
||||
}
|
||||
|
|
@ -99,7 +99,7 @@ class ExecutorBasedEventDrivenWorkStealingDispatcherSpec extends JUnitSuite with
|
|||
val child = actorOf[ChildActor]
|
||||
|
||||
parent.start
|
||||
intercept[IllegalStateException] {
|
||||
intercept[IllegalActorStateException] {
|
||||
child.start
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ class NestedTransactionalActiveObjectSpec extends
|
|||
ShouldMatchers with
|
||||
BeforeAndAfterAll {
|
||||
=======
|
||||
Spec with
|
||||
ShouldMatchers with
|
||||
BeforeAndAfterAll {
|
||||
Spec with
|
||||
ShouldMatchers with
|
||||
BeforeAndAfterAll {
|
||||
>>>>>>> 38e8bea3fe6a7e9fcc9c5f353124144739bdc234:akka-core/src/test/scala/NestedTransactionalActiveObjectSpec.scala
|
||||
|
||||
private val conf = new ActiveObjectConfigurator
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ import java.util.concurrent.TimeUnit
|
|||
import org.multiverse.api.latches.StandardLatch
|
||||
|
||||
class ReceiveTimeoutSpec extends JUnitSuite {
|
||||
|
||||
|
||||
@Test def receiveShouldGetTimeout= {
|
||||
|
||||
val timeoutLatch = new StandardLatch
|
||||
|
||||
|
||||
val timeoutActor = actorOf(new Actor {
|
||||
self.receiveTimeout = 500
|
||||
|
||||
|
|
@ -21,8 +21,7 @@ class ReceiveTimeoutSpec extends JUnitSuite {
|
|||
}
|
||||
}).start
|
||||
|
||||
// after max 1 second the timeout should already been sent
|
||||
assert(timeoutLatch.tryAwait(1, TimeUnit.SECONDS))
|
||||
assert(timeoutLatch.tryAwait(3, TimeUnit.SECONDS))
|
||||
}
|
||||
|
||||
@Test def swappedReceiveShouldAlsoGetTimout = {
|
||||
|
|
@ -37,15 +36,14 @@ class ReceiveTimeoutSpec extends JUnitSuite {
|
|||
}).start
|
||||
|
||||
// after max 1 second the timeout should already been sent
|
||||
assert(timeoutLatch.tryAwait(1, TimeUnit.SECONDS))
|
||||
assert(timeoutLatch.tryAwait(3, TimeUnit.SECONDS))
|
||||
|
||||
val swappedLatch = new StandardLatch
|
||||
timeoutActor ! HotSwap(Some{
|
||||
case ReceiveTimeout => swappedLatch.open
|
||||
})
|
||||
|
||||
// after max 1 second the timeout should already been sent
|
||||
assert(swappedLatch.tryAwait(1, TimeUnit.SECONDS))
|
||||
assert(swappedLatch.tryAwait(3, TimeUnit.SECONDS))
|
||||
}
|
||||
|
||||
@Test def timeoutShouldBeCancelledAfterRegularReceive = {
|
||||
|
|
@ -62,7 +60,6 @@ class ReceiveTimeoutSpec extends JUnitSuite {
|
|||
}).start
|
||||
timeoutActor ! Tick
|
||||
|
||||
// timeout already after 500 ms, so 1 second wait should be enough
|
||||
assert(timeoutLatch.tryAwait(3, TimeUnit.SECONDS) == false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ object RemoteTransactionalActiveObjectSpec {
|
|||
|
||||
@RunWith(classOf[JUnitRunner])
|
||||
class RemoteTransactionalActiveObjectSpec extends
|
||||
Spec with
|
||||
ShouldMatchers with
|
||||
BeforeAndAfterAll {
|
||||
Spec with
|
||||
ShouldMatchers with
|
||||
BeforeAndAfterAll {
|
||||
|
||||
import RemoteTransactionalActiveObjectSpec._
|
||||
Config.config
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import java.util.concurrent.{CountDownLatch, TimeUnit}
|
|||
import org.junit.{After, Test}
|
||||
|
||||
class SchedulerSpec extends JUnitSuite {
|
||||
|
||||
|
||||
@Test def schedulerShouldScheduleMoreThanOnce = {
|
||||
|
||||
case object Tick
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class SerializableTypeClassActorSpec extends
|
|||
act.count = p.getCount
|
||||
act
|
||||
}
|
||||
def toBinary(ac: MyActor) =
|
||||
def toBinary(ac: MyActor) =
|
||||
ProtobufProtocol.Counter.newBuilder.setCount(ac.count).build.toByteArray
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ class SerializableTypeClassActorSpec extends
|
|||
act.count2 = p.getCount2
|
||||
act
|
||||
}
|
||||
def toBinary(ac: MyActorWithDualCounter) =
|
||||
def toBinary(ac: MyActorWithDualCounter) =
|
||||
ProtobufProtocol.DualCounter.newBuilder.setCount1(ac.count1).setCount2(ac.count2).build.toByteArray
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,9 +24,9 @@ class TransactionalActiveObjectSpec extends
|
|||
ShouldMatchers with
|
||||
BeforeAndAfterAll {
|
||||
=======
|
||||
Spec with
|
||||
ShouldMatchers with
|
||||
BeforeAndAfterAll {
|
||||
Spec with
|
||||
ShouldMatchers with
|
||||
BeforeAndAfterAll {
|
||||
>>>>>>> 38e8bea3fe6a7e9fcc9c5f353124144739bdc234:akka-core/src/test/scala/TransactionalActiveObjectSpec.scala
|
||||
|
||||
private val conf = new ActiveObjectConfigurator
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
package se.scalablesolutions.akka.security
|
||||
|
||||
import se.scalablesolutions.akka.actor.{Scheduler, Actor, ActorRef, ActorRegistry}
|
||||
import se.scalablesolutions.akka.actor.{Scheduler, Actor, ActorRef, ActorRegistry, IllegalActorStateException}
|
||||
import se.scalablesolutions.akka.actor.Actor._
|
||||
import se.scalablesolutions.akka.config.Config
|
||||
import se.scalablesolutions.akka.util.Logging
|
||||
|
|
@ -102,7 +102,7 @@ class AkkaSecurityFilterFactory extends ResourceFilterFactory with Logging {
|
|||
|
||||
lazy val authenticatorFQN = {
|
||||
val auth = Config.config.getString("akka.rest.authenticator", "N/A")
|
||||
if (auth == "N/A") throw new IllegalStateException("The config option 'akka.rest.authenticator' is not defined in 'akka.conf'")
|
||||
if (auth == "N/A") throw new IllegalActorStateException("The config option 'akka.rest.authenticator' is not defined in 'akka.conf'")
|
||||
auth
|
||||
}
|
||||
|
||||
|
|
@ -400,7 +400,7 @@ trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] w
|
|||
*/
|
||||
lazy val servicePrincipal = {
|
||||
val p = Config.config.getString("akka.rest.kerberos.servicePrincipal", "N/A")
|
||||
if (p == "N/A") throw new IllegalStateException("The config option 'akka.rest.kerberos.servicePrincipal' is not defined in 'akka.conf'")
|
||||
if (p == "N/A") throw new IllegalActorStateException("The config option 'akka.rest.kerberos.servicePrincipal' is not defined in 'akka.conf'")
|
||||
p
|
||||
}
|
||||
|
||||
|
|
@ -409,13 +409,13 @@ trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] w
|
|||
*/
|
||||
lazy val keyTabLocation = {
|
||||
val p = Config.config.getString("akka.rest.kerberos.keyTabLocation", "N/A")
|
||||
if (p == "N/A") throw new IllegalStateException("The config option 'akka.rest.kerberos.keyTabLocation' is not defined in 'akka.conf'")
|
||||
if (p == "N/A") throw new IllegalActorStateException("The config option 'akka.rest.kerberos.keyTabLocation' is not defined in 'akka.conf'")
|
||||
p
|
||||
}
|
||||
|
||||
lazy val kerberosDebug = {
|
||||
val p = Config.config.getString("akka.rest.kerberos.kerberosDebug", "N/A")
|
||||
if (p == "N/A") throw new IllegalStateException("The config option 'akka.rest.kerberos.kerberosDebug' is not defined in 'akka.conf'")
|
||||
if (p == "N/A") throw new IllegalActorStateException("The config option 'akka.rest.kerberos.kerberosDebug' is not defined in 'akka.conf'")
|
||||
p
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import org.springframework.util.xml.DomUtils
|
|||
import org.w3c.dom.Element
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
import se.scalablesolutions.akka.actor.IllegalActorStateException
|
||||
|
||||
/**
|
||||
* Parser trait for custom namespace configuration for active-object.
|
||||
* @author michaelkober
|
||||
|
|
@ -36,7 +38,7 @@ trait ActiveObjectParser extends BeanParser with DispatcherParser {
|
|||
objectProperties.preRestart = callbacksElement.getAttribute(PRE_RESTART)
|
||||
objectProperties.postRestart = callbacksElement.getAttribute(POST_RESTART)
|
||||
if ((objectProperties.preRestart.isEmpty) && (objectProperties.preRestart.isEmpty)) {
|
||||
throw new IllegalStateException("At least one of pre or post must be defined.")
|
||||
throw new IllegalActorStateException("At least one of pre or post must be defined.")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@
|
|||
|
||||
import sbt._
|
||||
import sbt.CompileOrder._
|
||||
|
||||
import spde._
|
||||
import de.tuxed.codefellow.plugin.CodeFellowPlugin
|
||||
|
||||
import java.util.jar.Attributes
|
||||
import java.util.jar.Attributes.Name._
|
||||
|
|
@ -174,7 +176,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
|
|||
|
||||
// ------------------------------------------------------------
|
||||
// subprojects
|
||||
class AkkaCoreProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
|
||||
class AkkaCoreProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with CodeFellowPlugin {
|
||||
val netty = "org.jboss.netty" % "netty" % "3.2.1.Final" % "compile"
|
||||
val commons_codec = "commons-codec" % "commons-codec" % "1.4" % "compile"
|
||||
val commons_io = "commons-io" % "commons-io" % "1.4" % "compile"
|
||||
|
|
@ -201,7 +203,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
|
|||
val junit = "junit" % "junit" % "4.5" % "test"
|
||||
}
|
||||
|
||||
class AkkaAMQPProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
|
||||
class AkkaAMQPProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with CodeFellowPlugin {
|
||||
val commons_io = "commons-io" % "commons-io" % "1.4" % "compile"
|
||||
val rabbit = "com.rabbitmq" % "amqp-client" % "1.8.0" % "compile"
|
||||
|
||||
|
|
@ -211,7 +213,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
|
|||
val junit = "junit" % "junit" % "4.5" % "test"
|
||||
}
|
||||
|
||||
class AkkaHttpProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
|
||||
class AkkaHttpProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with CodeFellowPlugin {
|
||||
val jackson_core_asl = "org.codehaus.jackson" % "jackson-core-asl" % "1.2.1" % "compile"
|
||||
val stax_api = "javax.xml.stream" % "stax-api" % "1.0-2" % "compile"
|
||||
val servlet = "javax.servlet" % "servlet-api" % "2.5" % "compile"
|
||||
|
|
@ -236,7 +238,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
|
|||
val mockito = "org.mockito" % "mockito-all" % "1.8.1" % "test"
|
||||
}
|
||||
|
||||
class AkkaCamelProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
|
||||
class AkkaCamelProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with CodeFellowPlugin {
|
||||
val camel_core = "org.apache.camel" % "camel-core" % "2.3.0" % "compile"
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +284,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
|
|||
|
||||
class AkkaKernelProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath)
|
||||
|
||||
class AkkaSpringProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
|
||||
class AkkaSpringProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with CodeFellowPlugin {
|
||||
val spring_beans = "org.springframework" % "spring-beans" % "3.0.1.RELEASE" % "compile"
|
||||
val spring_context = "org.springframework" % "spring-context" % "3.0.1.RELEASE" % "compile"
|
||||
|
||||
|
|
@ -294,7 +296,7 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
|
|||
val junit = "junit" % "junit" % "4.5" % "test"
|
||||
}
|
||||
|
||||
class AkkaJTAProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
|
||||
class AkkaJTAProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with CodeFellowPlugin {
|
||||
val atomikos_transactions = "com.atomikos" % "transactions" % "3.2.3" % "compile"
|
||||
val atomikos_transactions_jta = "com.atomikos" % "transactions-jta" % "3.2.3" % "compile"
|
||||
val atomikos_transactions_api = "com.atomikos" % "transactions-api" % "3.2.3" % "compile"
|
||||
|
|
@ -303,22 +305,22 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
|
|||
}
|
||||
|
||||
// ================= TEST ==================
|
||||
class AkkaActiveObjectTestProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) {
|
||||
class AkkaActiveObjectTestProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) with CodeFellowPlugin {
|
||||
// testing
|
||||
val junit = "junit" % "junit" % "4.5" % "test"
|
||||
val jmock = "org.jmock" % "jmock" % "2.4.0" % "test"
|
||||
}
|
||||
|
||||
// ================= EXAMPLES ==================
|
||||
class AkkaSampleAntsProject(info: ProjectInfo) extends DefaultSpdeProject(info) {
|
||||
class AkkaSampleAntsProject(info: ProjectInfo) extends DefaultSpdeProject(info) with CodeFellowPlugin {
|
||||
val scalaToolsSnapshots = ScalaToolsSnapshots
|
||||
override def spdeSourcePath = mainSourcePath / "spde"
|
||||
}
|
||||
|
||||
class AkkaSampleChatProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath)
|
||||
class AkkaSamplePubSubProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath)
|
||||
class AkkaSampleChatProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) with CodeFellowPlugin
|
||||
class AkkaSamplePubSubProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) with CodeFellowPlugin
|
||||
|
||||
class AkkaSampleLiftProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) {
|
||||
class AkkaSampleLiftProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) with CodeFellowPlugin {
|
||||
val commons_logging = "commons-logging" % "commons-logging" % "1.1.1" % "compile"
|
||||
val lift = "net.liftweb" % "lift-webkit" % LIFT_VERSION % "compile"
|
||||
val lift_util = "net.liftweb" % "lift-util" % LIFT_VERSION % "compile"
|
||||
|
|
@ -328,22 +330,22 @@ class AkkaParent(info: ProjectInfo) extends DefaultProject(info) {
|
|||
val junit = "junit" % "junit" % "4.5" % "test"
|
||||
}
|
||||
|
||||
class AkkaSampleRestJavaProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath)
|
||||
class AkkaSampleRestJavaProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) with CodeFellowPlugin
|
||||
|
||||
class AkkaSampleRemoteProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath)
|
||||
class AkkaSampleRemoteProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) with CodeFellowPlugin
|
||||
|
||||
class AkkaSampleRestScalaProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) {
|
||||
class AkkaSampleRestScalaProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) with CodeFellowPlugin {
|
||||
val jsr311 = "javax.ws.rs" % "jsr311-api" % "1.1.1" % "compile"
|
||||
}
|
||||
|
||||
class AkkaSampleCamelProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) {
|
||||
class AkkaSampleCamelProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) with CodeFellowPlugin {
|
||||
val spring_jms = "org.springframework" % "spring-jms" % "3.0.1.RELEASE" % "compile"
|
||||
val camel_jetty = "org.apache.camel" % "camel-jetty" % "2.3.0" % "compile"
|
||||
val camel_jms = "org.apache.camel" % "camel-jms" % "2.3.0" % "compile"
|
||||
val activemq_core = "org.apache.activemq" % "activemq-core" % "5.3.2" % "compile"
|
||||
}
|
||||
|
||||
class AkkaSampleSecurityProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) {
|
||||
class AkkaSampleSecurityProject(info: ProjectInfo) extends AkkaDefaultProject(info, deployPath) with CodeFellowPlugin {
|
||||
val jsr311 = "javax.ws.rs" % "jsr311-api" % "1.1.1" % "compile"
|
||||
val jsr250 = "javax.annotation" % "jsr250-api" % "1.0" % "compile"
|
||||
val commons_codec = "commons-codec" % "commons-codec" % "1.4" % "compile"
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import sbt._
|
|||
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
|
||||
val databinderRepo = "Databinder Repository" at "http://databinder.net/repo"
|
||||
val spdeSbt = "us.technically.spde" % "spde-sbt-plugin" % "0.4.1"
|
||||
val codeFellow = "de.tuxed" % "codefellow-plugin" % "0.1" // for code completion and more in VIM
|
||||
// val repo = "GH-pages repo" at "http://mpeltonen.github.com/maven/"
|
||||
// val idea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.1-SNAPSHOT"
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue