On Fri, Oct 11, 2019 at 11:32 AM Luca Burgazzoli <lburgazz...@gmail.com> wrote: > > I would evaluate to replace anonymous classes with lambda as per case by > case as i.e. capturing lambdas may be a source of massive allocations, also > we need to take into account how they impact meta space allocations. >
Yes be a bit careful with lambdas. We did some optimisations on camel-core engine routing engine to reduce some overheads with too many lamdas in the callstack. That are internally faced. However for end users then some places if its a single method interface then marking them as @FunctionalInterface can aid the end user API. > --- > Luca Burgazzoli > > > On Fri, Oct 11, 2019 at 11:16 AM Babak Vahdat <babak.vah...@swissonline.ch> > wrote: > > > Hi Zoran > > > > Which IDE do you make use of? I tried it using eclipse which is a bit > > buggy and I had to manually fix a lot of changes it made by hand (I wish I > > had tried it with IntelliJ first). Currently more than 3K outgoing changes > > in my workspace with all tests & checkstyle rules passing locally. > > > > I would provide a PR in case this effort should become concrete. > > > > Babak > > > > > On 11 Oct 2019, at 10:51, Zoran Regvart <zo...@regvart.com> wrote: > > > > > > Hi Babak, > > > I like lambdas as a concise way of writing callbacks and short > > > stateless functions. I have my IDE auto replace inner classes with > > > lambdas where applicable. > > > > > > I wouldn't use them on hot paths as they incur a deeper stack. On hot > > > paths I'd prefer that we use stateless anonymous classes and avoid > > > allocating new instances if possible, i.e. cache them in a class > > > field. > > > > > > Where possible we should annotate Camel public API with > > > @FunctionalInterface, to enable users to use them as they see fit. > > > > > > 2c > > > > > > zoran > > > > > > On Fri, Oct 11, 2019 at 10:12 AM Babak Vahdat > > > <babak.vah...@swissonline.ch> wrote: > > >> > > >> Hi > > >> > > >> Would it make sense to you if we would change all the anonymous classes > > in Camel codebase to lambda expression where possible? Or any other idea > > you may have in this context? > > >> > > >> Babak > > > > > > > > > > > > -- > > > Zoran Regvart > > > > -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2