=rem #16428 optimize protobuf serializer for master

#16428 for master
Local method should be defined as close to its use as possible for hygiene
reasons IMHO.

-- 
Cheers,
√
On 16 Dec 2014 14:17, "Roland Kuhn" <notifications@github.com> wrote:

> In
> akka-remote/src/main/scala/akka/remote/serialization/ProtobufSerializer.scala
> <https://github.com/akka/akka/pull/16429#discussion-diff-21896225>:
>
> > +              val parsingMethodBinding = parsingMethodBindingRef.get()
> > +              parsingMethodBinding.get(clazz) match {
> > +                case Some(otherCached) ⇒ otherCached
> > +                case None ⇒
> > +                  val newParsingMethodBinding = parsingMethodBinding.updated(clazz, parsingMethod)
> > +                  if (parsingMethodBindingRef.compareAndSet(parsingMethodBinding, newParsingMethodBinding))
> > +                    parsingMethod
> > +                  else
> > +                    cacheMethod(parsingMethod)
> > +              }
> > +            }
> > +            import ProtobufSerializer.ARRAY_OF_BYTE_ARRAY
> > +            parse(cacheMethod(clazz.getDeclaredMethod("parseFrom", ARRAY_OF_BYTE_ARRAY: _*)))
> > +          }
> > +        }
> > +        parse(parsingMethodBindingRef.get().get(clazz).orNull)
>
> Ah, and one more thought: the declaration of the local methods does not
> need to be nested as far as I can see. Is it possible that this discussion
> has drilled itself into some rabbit hole?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/akka/akka/pull/16429/files#r21896225>.
>