#2189 - Removing RemoteClientWriteFailed and log it as a RemoteClientError and send the message to DeadLetters

This commit is contained in:
Viktor Klang 2012-06-06 13:56:46 +02:00
parent 4d3e9f19fe
commit 211435048a
4 changed files with 8 additions and 29 deletions

View file

@ -280,10 +280,6 @@ which holds the transport used (RemoteTransport) and the outbound address that i
To intercept when an outbound client is shut down you listen to ``RemoteClientShutdown``
which holds the transport used (RemoteTransport) and the outbound address that it was connected to (Address).
To intercept when an outbound message cannot be sent, you listen to ``RemoteClientWriteFailed`` which holds
the payload that was not written (AnyRef), the cause of the failed send (Throwable),
the transport used (RemoteTransport) and the outbound address that was the destination (Address).
For general outbound-related errors, that do not classify as any of the others, you can listen to ``RemoteClientError``,
which holds the cause (Throwable), the transport used (RemoteTransport) and the outbound address (Address).

View file

@ -288,10 +288,6 @@ which holds the transport used (RemoteTransport) and the outbound address that i
To intercept when an outbound client is shut down you listen to ``RemoteClientShutdown``
which holds the transport used (RemoteTransport) and the outbound address that it was connected to (Address).
To intercept when an outbound message cannot be sent, you listen to ``RemoteClientWriteFailed`` which holds
the payload that was not written (AnyRef), the cause of the failed send (Throwable),
the transport used (RemoteTransport) and the outbound address that was the destination (Address).
For general outbound-related errors, that do not classify as any of the others, you can listen to ``RemoteClientError``,
which holds the cause (Throwable), the transport used (RemoteTransport) and the outbound address (Address).

View file

@ -77,21 +77,6 @@ case class RemoteClientShutdown(
override def toString: String = "RemoteClientShutdown@" + remoteAddress
}
/**
* RemoteClientWriteFailed is published when a remote send of a message detectably fails (throws an exception).
*/
case class RemoteClientWriteFailed(
@BeanProperty request: AnyRef,
@BeanProperty cause: Throwable,
@transient @BeanProperty remote: RemoteTransport,
@BeanProperty remoteAddress: Address) extends RemoteClientLifeCycleEvent {
override def logLevel: Logging.LogLevel = Logging.WarningLevel
override def toString: String =
"RemoteClientWriteFailed@" + remoteAddress +
": MessageClass[" + (if (request ne null) request.getClass.getName else "no message") +
"] Error[" + cause + "]"
}
/**
* Life-cycle events for RemoteServer.
*/

View file

@ -13,11 +13,11 @@ import org.jboss.netty.handler.codec.frame.{ LengthFieldPrepender, LengthFieldBa
import org.jboss.netty.handler.execution.ExecutionHandler
import org.jboss.netty.handler.timeout.{ IdleState, IdleStateEvent, IdleStateAwareChannelHandler, IdleStateHandler }
import akka.remote.RemoteProtocol.{ RemoteControlProtocol, CommandType, AkkaRemoteProtocol }
import akka.remote.{ RemoteProtocol, RemoteMessage, RemoteLifeCycleEvent, RemoteClientStarted, RemoteClientShutdown, RemoteClientException, RemoteClientError, RemoteClientDisconnected, RemoteClientConnected, RemoteClientWriteFailed }
import akka.actor.{ Address, ActorRef }
import akka.remote.{ RemoteProtocol, RemoteMessage, RemoteLifeCycleEvent, RemoteClientStarted, RemoteClientShutdown, RemoteClientException, RemoteClientError, RemoteClientDisconnected, RemoteClientConnected }
import akka.AkkaException
import akka.event.Logging
import akka.util.Switch
import akka.actor.{ DeadLetter, Address, ActorRef }
import akka.util.{ NonFatal, Switch }
/**
* This is the abstract baseclass for netty remote clients, currently there's only an
@ -65,7 +65,9 @@ private[akka] abstract class RemoteClient private[akka] (val netty: NettyRemoteT
new ChannelFutureListener {
def operationComplete(future: ChannelFuture) {
if (future.isCancelled || !future.isSuccess) {
netty.notifyListeners(RemoteClientWriteFailed(request, future.getCause, netty, remoteAddress))
netty.notifyListeners(RemoteClientError(future.getCause, netty, remoteAddress))
val (message, sender, recipient) = request
netty.system.deadLetters ! DeadLetter(message, sender.getOrElse(netty.system.deadLetters), recipient)
}
}
})
@ -75,11 +77,11 @@ private[akka] abstract class RemoteClient private[akka] (val netty: NettyRemoteT
if (backoff.length > 0 && !f.await(backoff.length, backoff.unit)) f.cancel() //Waited as long as we could, now back off
}
} catch {
case e: Exception netty.notifyListeners(RemoteClientError(e, netty, remoteAddress))
case NonFatal(e) netty.notifyListeners(RemoteClientError(e, netty, remoteAddress))
}
}
override def toString = name
override def toString: String = name
}
/**