pjfanning commented on code in PR #3300:
URL: https://github.com/apache/pekko/pull/3300#discussion_r3535790490
##########
remote/src/main/scala/org/apache/pekko/remote/serialization/ProtobufSerializer.scala:
##########
@@ -74,25 +72,24 @@ class ProtobufSerializer(val system: ExtendedActorSystem)
extends BaseSerializer
override def fromBinary(bytes: Array[Byte], manifest: Option[Class[?]]):
AnyRef = {
manifest match {
case Some(clazz) =>
- @tailrec
- def parsingMethod(method: Method = null): Method = {
+ def parsingMethod(): MethodHandle = {
val parsingMethodBinding = parsingMethodBindingRef.get()
parsingMethodBinding.get(clazz) match {
- case Some(cachedParsingMethod) => cachedParsingMethod
+ case Some(cachedParsingHandle) => cachedParsingHandle
case None =>
checkAllowedClass(clazz)
- val unCachedParsingMethod =
- if (method eq null) clazz.getDeclaredMethod("parseFrom",
ProtobufSerializer.ARRAY_OF_BYTE_ARRAY: _*)
- else method
+ val unCachedHandle = MethodHandles
+ .publicLookup()
Review Comment:
can we cache the publicLookup value?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]