Adding debug messages for all remote exceptions, to ease debugging of remoting
This commit is contained in:
parent
e66d46671a
commit
c2597ed33d
3 changed files with 100 additions and 34 deletions
|
|
@ -10,8 +10,6 @@ import akka.util.Duration
|
||||||
import java.util.concurrent._
|
import java.util.concurrent._
|
||||||
|
|
||||||
object ThreadPoolConfig {
|
object ThreadPoolConfig {
|
||||||
type Bounds = Int
|
|
||||||
type FlowHandler = Either[SaneRejectedExecutionHandler, Bounds]
|
|
||||||
type QueueFactory = () ⇒ BlockingQueue[Runnable]
|
type QueueFactory = () ⇒ BlockingQueue[Runnable]
|
||||||
|
|
||||||
val defaultAllowCoreThreadTimeout: Boolean = false
|
val defaultAllowCoreThreadTimeout: Boolean = false
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ trait ParsedTransportAddress extends RemoteTransportAddress
|
||||||
|
|
||||||
case class RemoteNettyAddress(host: String, ip: Option[InetAddress], port: Int) extends ParsedTransportAddress {
|
case class RemoteNettyAddress(host: String, ip: Option[InetAddress], port: Int) extends ParsedTransportAddress {
|
||||||
def protocol = "akka"
|
def protocol = "akka"
|
||||||
|
|
||||||
|
override def toString(): String = "akka://" + host + ":" + port
|
||||||
}
|
}
|
||||||
|
|
||||||
object RemoteNettyAddress {
|
object RemoteNettyAddress {
|
||||||
|
|
@ -145,29 +147,57 @@ trait RemoteClientLifeCycleEvent extends RemoteLifeCycleEvent {
|
||||||
case class RemoteClientError[T <: ParsedTransportAddress](
|
case class RemoteClientError[T <: ParsedTransportAddress](
|
||||||
@BeanProperty cause: Throwable,
|
@BeanProperty cause: Throwable,
|
||||||
@BeanProperty remote: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent
|
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteClientError@" +
|
||||||
|
remoteAddress +
|
||||||
|
": ErrorMessage[" +
|
||||||
|
(if (cause ne null) cause.getMessage else "no message") +
|
||||||
|
"]"
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteClientDisconnected[T <: ParsedTransportAddress](
|
case class RemoteClientDisconnected[T <: ParsedTransportAddress](
|
||||||
@BeanProperty remote: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent
|
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteClientDisconnected@" + remoteAddress
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteClientConnected[T <: ParsedTransportAddress](
|
case class RemoteClientConnected[T <: ParsedTransportAddress](
|
||||||
@BeanProperty remote: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent
|
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteClientConnected@" + remoteAddress
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteClientStarted[T <: ParsedTransportAddress](
|
case class RemoteClientStarted[T <: ParsedTransportAddress](
|
||||||
@BeanProperty remote: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent
|
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteClientStarted@" + remoteAddress
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteClientShutdown[T <: ParsedTransportAddress](
|
case class RemoteClientShutdown[T <: ParsedTransportAddress](
|
||||||
@BeanProperty remote: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent
|
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteClientShutdown@" + remoteAddress
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteClientWriteFailed[T <: ParsedTransportAddress](
|
case class RemoteClientWriteFailed[T <: ParsedTransportAddress](
|
||||||
@BeanProperty request: AnyRef,
|
@BeanProperty request: AnyRef,
|
||||||
@BeanProperty cause: Throwable,
|
@BeanProperty cause: Throwable,
|
||||||
@BeanProperty remote: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent
|
@BeanProperty remoteAddress: T) extends RemoteClientLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteClientWriteFailed@" +
|
||||||
|
remoteAddress +
|
||||||
|
": MessageClass[" +
|
||||||
|
(if (request ne null) request.getClass.getName else "no message") +
|
||||||
|
"] ErrorMessage[" +
|
||||||
|
(if (cause ne null) cause.getMessage else "no message") +
|
||||||
|
"]"
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Life-cycle events for RemoteServer.
|
* Life-cycle events for RemoteServer.
|
||||||
|
|
@ -175,26 +205,77 @@ case class RemoteClientWriteFailed[T <: ParsedTransportAddress](
|
||||||
trait RemoteServerLifeCycleEvent extends RemoteLifeCycleEvent
|
trait RemoteServerLifeCycleEvent extends RemoteLifeCycleEvent
|
||||||
|
|
||||||
case class RemoteServerStarted[T <: ParsedTransportAddress](
|
case class RemoteServerStarted[T <: ParsedTransportAddress](
|
||||||
@BeanProperty remote: RemoteSupport[T]) extends RemoteServerLifeCycleEvent
|
@BeanProperty remote: RemoteSupport[T]) extends RemoteServerLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteServerStarted@" + remote.name
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteServerShutdown[T <: ParsedTransportAddress](
|
case class RemoteServerShutdown[T <: ParsedTransportAddress](
|
||||||
@BeanProperty remote: RemoteSupport[T]) extends RemoteServerLifeCycleEvent
|
@BeanProperty remote: RemoteSupport[T]) extends RemoteServerLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteServerShutdown@" + remote.name
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteServerError[T <: ParsedTransportAddress](
|
case class RemoteServerError[T <: ParsedTransportAddress](
|
||||||
@BeanProperty val cause: Throwable,
|
@BeanProperty val cause: Throwable,
|
||||||
@BeanProperty remote: RemoteSupport[T]) extends RemoteServerLifeCycleEvent
|
@BeanProperty remote: RemoteSupport[T]) extends RemoteServerLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteServerError@" +
|
||||||
|
remote.name +
|
||||||
|
": ErrorMessage[" +
|
||||||
|
(if (cause ne null) cause.getMessage else "no message") +
|
||||||
|
"]"
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteServerClientConnected[T <: ParsedTransportAddress](
|
case class RemoteServerClientConnected[T <: ParsedTransportAddress](
|
||||||
@BeanProperty remote: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty val clientAddress: Option[T]) extends RemoteServerLifeCycleEvent
|
@BeanProperty val clientAddress: Option[T]) extends RemoteServerLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteServerClientConnected@" +
|
||||||
|
remote.name +
|
||||||
|
": Client[" +
|
||||||
|
(if (clientAddress.isDefined) clientAddress.get else "no address") +
|
||||||
|
"]"
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteServerClientDisconnected[T <: ParsedTransportAddress](
|
case class RemoteServerClientDisconnected[T <: ParsedTransportAddress](
|
||||||
@BeanProperty remote: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty val clientAddress: Option[T]) extends RemoteServerLifeCycleEvent
|
@BeanProperty val clientAddress: Option[T]) extends RemoteServerLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteServerClientDisconnected@" +
|
||||||
|
remote.name +
|
||||||
|
": Client[" +
|
||||||
|
(if (clientAddress.isDefined) clientAddress.get else "no address") +
|
||||||
|
"]"
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteServerClientClosed[T <: ParsedTransportAddress](
|
case class RemoteServerClientClosed[T <: ParsedTransportAddress](
|
||||||
@BeanProperty remote: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty val clientAddress: Option[T]) extends RemoteServerLifeCycleEvent
|
@BeanProperty val clientAddress: Option[T]) extends RemoteServerLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteServerClientClosed@" +
|
||||||
|
remote.name +
|
||||||
|
": Client[" +
|
||||||
|
(if (clientAddress.isDefined) clientAddress.get else "no address") +
|
||||||
|
"]"
|
||||||
|
}
|
||||||
|
|
||||||
case class RemoteServerWriteFailed[T <: ParsedTransportAddress](
|
case class RemoteServerWriteFailed[T <: ParsedTransportAddress](
|
||||||
@BeanProperty request: AnyRef,
|
@BeanProperty request: AnyRef,
|
||||||
@BeanProperty cause: Throwable,
|
@BeanProperty cause: Throwable,
|
||||||
@BeanProperty server: RemoteSupport[T],
|
@BeanProperty remote: RemoteSupport[T],
|
||||||
@BeanProperty remoteAddress: Option[T]) extends RemoteServerLifeCycleEvent
|
@BeanProperty remoteAddress: Option[T]) extends RemoteServerLifeCycleEvent {
|
||||||
|
override def toString =
|
||||||
|
"RemoteServerWriteFailed@" +
|
||||||
|
remote +
|
||||||
|
": ClientAddress[" +
|
||||||
|
remoteAddress +
|
||||||
|
"] MessageClass[" +
|
||||||
|
(if (request ne null) request.getClass.getName else "no message") +
|
||||||
|
"] ErrorMessage[" +
|
||||||
|
(if (cause ne null) cause.getMessage else "no message") +
|
||||||
|
"]"
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown for example when trying to send a message using a RemoteClient that is either not started or shut down.
|
* Thrown for example when trying to send a message using a RemoteClient that is either not started or shut down.
|
||||||
|
|
@ -204,22 +285,6 @@ class RemoteClientException[T <: ParsedTransportAddress] private[akka] (
|
||||||
@BeanProperty val client: RemoteSupport[T],
|
@BeanProperty val client: RemoteSupport[T],
|
||||||
val remoteAddress: T, cause: Throwable = null) extends AkkaException(message, cause)
|
val remoteAddress: T, cause: Throwable = null) extends AkkaException(message, cause)
|
||||||
|
|
||||||
/**
|
|
||||||
* Thrown when the remote server actor dispatching fails for some reason.
|
|
||||||
*/
|
|
||||||
class RemoteServerException private[akka] (message: String) extends AkkaException(message)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Thrown when a remote exception sent over the wire cannot be loaded and instantiated
|
|
||||||
*/
|
|
||||||
case class CannotInstantiateRemoteExceptionDueToRemoteProtocolParsingErrorException private[akka] (cause: Throwable, originalClassName: String, originalMessage: String)
|
|
||||||
extends AkkaException("\nParsingError[%s]\nOriginalException[%s]\nOriginalMessage[%s]"
|
|
||||||
.format(cause.toString, originalClassName, originalMessage)) {
|
|
||||||
override def printStackTrace = cause.printStackTrace
|
|
||||||
override def printStackTrace(printStream: PrintStream) = cause.printStackTrace(printStream)
|
|
||||||
override def printStackTrace(printWriter: PrintWriter) = cause.printStackTrace(printWriter)
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class RemoteSupport[-T <: ParsedTransportAddress](val system: ActorSystemImpl) {
|
abstract class RemoteSupport[-T <: ParsedTransportAddress](val system: ActorSystemImpl) {
|
||||||
/**
|
/**
|
||||||
* Shuts down the remoting
|
* Shuts down the remoting
|
||||||
|
|
@ -253,7 +318,10 @@ abstract class RemoteSupport[-T <: ParsedTransportAddress](val system: ActorSyst
|
||||||
recipient: RemoteActorRef,
|
recipient: RemoteActorRef,
|
||||||
loader: Option[ClassLoader]): Unit
|
loader: Option[ClassLoader]): Unit
|
||||||
|
|
||||||
protected[akka] def notifyListeners(message: RemoteLifeCycleEvent): Unit = system.eventStream.publish(message)
|
protected[akka] def notifyListeners(message: RemoteLifeCycleEvent): Unit = {
|
||||||
|
system.eventStream.publish(message)
|
||||||
|
system.log.debug("REMOTE: {}", message)
|
||||||
|
}
|
||||||
|
|
||||||
override def toString = name
|
override def toString = name
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ class NettyRemoteSupport(_system: ActorSystemImpl, val remote: Remote, val addre
|
||||||
|
|
||||||
def name = currentServer.get match {
|
def name = currentServer.get match {
|
||||||
case Some(server) ⇒ server.name
|
case Some(server) ⇒ server.name
|
||||||
case None ⇒ "Non-running NettyRemoteServer@" + remote.remoteAddress
|
case None ⇒ remote.remoteAddress.toString
|
||||||
}
|
}
|
||||||
|
|
||||||
private val _isRunning = new Switch(false)
|
private val _isRunning = new Switch(false)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue