cleaned up supervisor and actor api, breaking changes
This commit is contained in:
parent
50e73c2a9f
commit
a1adfd42e8
51 changed files with 637 additions and 806 deletions
|
|
@ -135,7 +135,7 @@ object ActiveObject {
|
|||
|
||||
|
||||
private[akka] def supervise(restartStrategy: RestartStrategy, components: List[Supervise]): Supervisor = {
|
||||
object factory extends SupervisorFactory {
|
||||
val factory = SupervisorFactory {
|
||||
override def getSupervisorConfig = SupervisorConfig(restartStrategy, components)
|
||||
}
|
||||
val supervisor = factory.newSupervisor
|
||||
|
|
@ -333,7 +333,7 @@ private[akka] class Dispatcher(val callbacks: Option[RestartCallbacks]) extends
|
|||
//if (initTxState.isDefined) initTxState.get.setAccessible(true)
|
||||
}
|
||||
|
||||
override def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case Invocation(joinPoint, isOneWay, _) =>
|
||||
if (Actor.SERIALIZE_MESSAGES) serializeArguments(joinPoint)
|
||||
if (isOneWay) joinPoint.proceed
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ trait Actor extends Logging with TransactionManagement {
|
|||
* <p/>
|
||||
* Example code:
|
||||
* <pre>
|
||||
* def receive: PartialFunction[Any, Unit] = {
|
||||
* def receive = {
|
||||
* case Ping =>
|
||||
* println("got a ping")
|
||||
* reply("pong")
|
||||
|
|
@ -171,7 +171,7 @@ trait Actor extends Logging with TransactionManagement {
|
|||
* }
|
||||
* </pre>
|
||||
*/
|
||||
protected def receive: PartialFunction[Any, Unit]
|
||||
protected def receive
|
||||
|
||||
/**
|
||||
* User overridable callback/setting.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ case class SchedulerException(msg: String, e: Throwable) extends RuntimeExceptio
|
|||
class ScheduleActor(val receiver: Actor, val future: ScheduledFuture[AnyRef]) extends Actor with Logging {
|
||||
lifeCycleConfig = Some(LifeCycle(Permanent))
|
||||
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case UnSchedule =>
|
||||
Scheduler.stopSupervising(this)
|
||||
future.cancel(true)
|
||||
|
|
@ -77,7 +77,7 @@ object Scheduler extends Actor {
|
|||
service.shutdown
|
||||
}
|
||||
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case _ => {} // ignore all messages
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ class Supervisor private[akka] (handler: FaultHandlingStrategy) extends Actor wi
|
|||
|
||||
def stopSupervisor = this ! StopSupervisor
|
||||
|
||||
protected def receive: PartialFunction[Any, Unit] = {
|
||||
protected def receive = {
|
||||
case StartSupervisor =>
|
||||
linkedActors.toArray.toList.asInstanceOf[List[Actor]].foreach { actor => actor.start; log.info("Starting actor: %s", actor) }
|
||||
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@
|
|||
<p/>
|
||||
Example code:
|
||||
<pre>
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case Ping =>
|
||||
println("got a ping")
|
||||
reply("pong")
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@
|
|||
<p/>
|
||||
Example code:
|
||||
<pre>
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case Ping =>
|
||||
println("got a ping")
|
||||
reply("pong")
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@
|
|||
<p/>
|
||||
Example code:
|
||||
<pre>
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case Ping =>
|
||||
println("got a ping")
|
||||
reply("pong")
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@
|
|||
<p/>
|
||||
Example code:
|
||||
<pre>
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case Ping =>
|
||||
println("got a ping")
|
||||
reply("pong")
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import java.io.IOException
|
|||
* val consumer = AMQP.newConsumer(params, hostname, port, exchange, ExchangeType.Direct, Serializer.ScalaJSON, None, 100)
|
||||
*
|
||||
* consumer ! MessageConsumerListener(queue, routingKey, new Actor() {
|
||||
* def receive: PartialFunction[Any, Unit] = {
|
||||
* def receive = {
|
||||
* case Message(payload, _, _, _, _) => log.debug("Received message: %s", payload)
|
||||
* }
|
||||
* })
|
||||
|
|
@ -209,7 +209,7 @@ object AMQP extends Actor {
|
|||
|
||||
log.info("AMQP.Producer [%s] is started", toString)
|
||||
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case message @ Message(payload, routingKey, mandatory, immediate, properties) =>
|
||||
log.debug("Sending message [%s]", message)
|
||||
channel.basicPublish(exchangeName, routingKey, mandatory, immediate, properties, serializer.out(payload))
|
||||
|
|
@ -312,7 +312,7 @@ object AMQP extends Actor {
|
|||
listener.tag = Some(listenerTag)
|
||||
}
|
||||
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case listener: MessageConsumerListener =>
|
||||
startLink(listener.actor)
|
||||
listeners.put(listener, listener)
|
||||
|
|
@ -425,7 +425,7 @@ object AMQP extends Actor {
|
|||
override def postRestart(reason: AnyRef, config: Option[AnyRef]) = reconnect(initReconnectDelay)
|
||||
}
|
||||
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case _ => {} // ignore all messages
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ object ExampleSession {
|
|||
def direct = {
|
||||
val consumer = AMQP.newConsumer(CONFIG, HOSTNAME, PORT, IM, ExchangeType.Direct, SERIALIZER, None, 100, false, false, Map[String, AnyRef]())
|
||||
consumer ! MessageConsumerListener("@george_bush", "direct", new Actor() {
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case Message(payload, _, _, _, _) => log.info("@george_bush received message from: %s", payload)
|
||||
}
|
||||
})
|
||||
|
|
@ -51,12 +51,12 @@ object ExampleSession {
|
|||
def fanout = {
|
||||
val consumer = AMQP.newConsumer(CONFIG, HOSTNAME, PORT, CHAT, ExchangeType.Fanout, SERIALIZER, None, 100, false, false, Map[String, AnyRef]())
|
||||
consumer ! MessageConsumerListener("@george_bush", "", new Actor() {
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case Message(payload, _, _, _, _) => log.info("@george_bush received message from: %s", payload)
|
||||
}
|
||||
})
|
||||
consumer ! MessageConsumerListener("@barack_obama", "", new Actor() {
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case Message(payload, _, _, _, _) => log.info("@barack_obama received message from: %s", payload)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@
|
|||
val consumer = AMQP.newConsumer(params, hostname, port, exchange, ExchangeType.Direct, Serializer.ScalaJSON, None, 100)
|
||||
|
||||
consumer ! MessageConsumerListener(queue, routingKey, new Actor() {
|
||||
def receive: PartialFunction[Any, Unit] = {
|
||||
def receive = {
|
||||
case Message(payload, _, _, _, _) => log.debug("Received message: %s", payload)
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ trait AuthenticationActor[C <: Credentials] extends Actor with Logging
|
|||
}
|
||||
}
|
||||
|
||||
override def receive: PartialFunction[Any, Unit] = authenticate
|
||||
def receive = authenticate
|
||||
|
||||
//returns the string value of the "Authorization"-header of the request
|
||||
def auth(r : Req) = r.getHeaderValue("Authorization")
|
||||
|
|
@ -284,7 +284,7 @@ trait DigestAuthenticationActor extends AuthenticationActor[DigestCredentials]
|
|||
Scheduler.schedule(this, InvalidateNonces, noncePurgeInterval, noncePurgeInterval, TimeUnit.MILLISECONDS )
|
||||
|
||||
//authenticate or invalidate nonces
|
||||
override def receive: PartialFunction[Any, Unit] = authenticate orElse invalidateNonces
|
||||
def receive = authenticate orElse invalidateNonces
|
||||
|
||||
override def unauthorized : Response =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@
|
|||
<b>receive</b>..<a name="receive"></a>
|
||||
</td>
|
||||
<td class="signature">
|
||||
<code class="signature">override def receive</code>
|
||||
<code class="signature">def receive</code>
|
||||
|
||||
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@
|
|||
<b>receive</b>..<a name="receive"></a>
|
||||
</td>
|
||||
<td class="signature">
|
||||
<code class="signature">override def receive</code>
|
||||
<code class="signature">def receive</code>
|
||||
|
||||
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@
|
|||
<b>receive</b>..<a name="receive"></a>
|
||||
</td>
|
||||
<td class="signature">
|
||||
<code class="signature">override def receive</code>
|
||||
<code class="signature">def receive</code>
|
||||
|
||||
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@
|
|||
<b>receive</b>..<a name="receive"></a>
|
||||
</td>
|
||||
<td class="signature">
|
||||
<code class="signature">override def receive</code>
|
||||
<code class="signature">def receive</code>
|
||||
|
||||
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue