#2469 - Switching to scala.util.Try instead of Either[Throwable, T] in the codebase
This commit is contained in:
parent
6e4b0dc3de
commit
4eee04cb60
21 changed files with 123 additions and 249 deletions
|
|
@ -20,16 +20,10 @@ private[akka] object MessageSerializer {
|
|||
* Uses Akka Serialization for the specified ActorSystem to transform the given MessageProtocol to a message
|
||||
*/
|
||||
def deserialize(system: ExtendedActorSystem, messageProtocol: MessageProtocol): AnyRef = {
|
||||
val clazz =
|
||||
if (messageProtocol.hasMessageManifest) {
|
||||
system.dynamicAccess.getClassFor[AnyRef](messageProtocol.getMessageManifest.toStringUtf8)
|
||||
.fold(throw _, Some(_))
|
||||
} else None
|
||||
SerializationExtension(system)
|
||||
.deserialize(messageProtocol.getMessage.toByteArray, messageProtocol.getSerializerId, clazz) match {
|
||||
case Left(e) ⇒ throw e
|
||||
case Right(r) ⇒ r
|
||||
}
|
||||
SerializationExtension(system).deserialize(
|
||||
messageProtocol.getMessage.toByteArray,
|
||||
messageProtocol.getSerializerId,
|
||||
if (messageProtocol.hasMessageManifest) Some(system.dynamicAccess.getClassFor[AnyRef](messageProtocol.getMessageManifest.toStringUtf8).get) else None).get
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue