Supress stack trace for exc thrown when remoting is stopped

This commit is contained in:
Patrik Nordwall 2013-04-08 17:16:40 +02:00
parent 4b563dacb2
commit bc06a266b8
2 changed files with 10 additions and 2 deletions

View file

@ -9,6 +9,7 @@ import akka.actor._
import akka.event.LoggingAdapter
import scala.collection.immutable
import scala.concurrent.Future
import scala.util.control.NoStackTrace
/**
* RemoteTransportException represents a general failure within a RemoteTransport,
@ -17,6 +18,13 @@ import scala.concurrent.Future
@SerialVersionUID(1L)
class RemoteTransportException(message: String, cause: Throwable) extends AkkaException(message, cause)
/**
* [[RemoteTransportException]] without stack trace.
*/
@SerialVersionUID(1L)
class RemoteTransportExceptionNoStackTrace(message: String, cause: Throwable)
extends RemoteTransportException(message, cause) with NoStackTrace
/**
* INTERNAL API
*

View file

@ -194,7 +194,7 @@ private[remote] class Remoting(_system: ExtendedActorSystem, _provider: RemoteAc
override def send(message: Any, senderOption: Option[ActorRef], recipient: RemoteActorRef): Unit = endpointManager match {
case Some(manager) manager.tell(Send(message, senderOption, recipient), sender = senderOption getOrElse Actor.noSender)
case None throw new IllegalStateException("Attempted to send remote message but Remoting is not running.")
case None throw new RemoteTransportExceptionNoStackTrace("Attempted to send remote message but Remoting is not running.", null)
}
override def managementCommand(cmd: Any): Future[Boolean] = endpointManager match {
@ -202,7 +202,7 @@ private[remote] class Remoting(_system: ExtendedActorSystem, _provider: RemoteAc
import system.dispatcher
implicit val timeout = CommandAckTimeout
manager ? ManagementCommand(cmd) map { case ManagementCommandAck(status) status }
case None throw new IllegalStateException("Attempted to send management command but Remoting is not running.")
case None throw new RemoteTransportExceptionNoStackTrace("Attempted to send management command but Remoting is not running.", null)
}
// Not used anywhere only to keep compatibility with RemoteTransport interface