You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by Dmitriy Setrakyan <ds...@apache.org> on 2015/02/23 08:28:02 UTC

java8 and serializable

Hello Ignite experts,

I just noticed that EntryProcessor does not implement Serializable, which
makes it impossible to serialize when used in Java8 lambda notations.

However, what if we define IgniteEntryProcessor which extends both,
EntryProcessor and Serializable? And also add invoke method on IgniteCache
which accepts IgniteEntryProcessor, like so:
----------------
*@IgniteAsyncSupported*
*public <T> T invoke(K key, IgniteEntryProcessor<K, V, T> entryProcessor,
Object... arguments);*


*@IgniteAsyncSupported*
*@Override public <T> T invoke(K key, EntryProcessor<K, V, T>
entryProcessor, Object... arguments);*
------------------

Does anyone know which method will be invoked when used with Java8 lambdas
without any casting, like so (is it JDK specific?):
-------------------
*cache.invoke("mykey", (entry, args) -> { .... }); *
-------------------

D.

Re: java8 and serializable

Posted by Dmitriy Setrakyan <ds...@apache.org>.
Jira ticket filed:
https://issues.apache.org/jira/browse/IGNITE-326

D.

On Mon, Feb 23, 2015 at 12:47 PM, Valentin Kulichenko <
valentin.kulichenko@gmail.com> wrote:

> I just checked this - a new method with IgniteEntryProcessor is called.
>
> On Sun, Feb 22, 2015 at 11:28 PM, Dmitriy Setrakyan <dsetrakyan@apache.org
> >
> wrote:
>
> > Hello Ignite experts,
> >
> > I just noticed that EntryProcessor does not implement Serializable, which
> > makes it impossible to serialize when used in Java8 lambda notations.
> >
> > However, what if we define IgniteEntryProcessor which extends both,
> > EntryProcessor and Serializable? And also add invoke method on
> IgniteCache
> > which accepts IgniteEntryProcessor, like so:
> > ----------------
> > *@IgniteAsyncSupported*
> > *public <T> T invoke(K key, IgniteEntryProcessor<K, V, T> entryProcessor,
> > Object... arguments);*
> >
> >
> > *@IgniteAsyncSupported*
> > *@Override public <T> T invoke(K key, EntryProcessor<K, V, T>
> > entryProcessor, Object... arguments);*
> > ------------------
> >
> > Does anyone know which method will be invoked when used with Java8
> lambdas
> > without any casting, like so (is it JDK specific?):
> > -------------------
> > *cache.invoke("mykey", (entry, args) -> { .... }); *
> > -------------------
> >
> > D.
> >
>

Re: java8 and serializable

Posted by Valentin Kulichenko <va...@gmail.com>.
I just checked this - a new method with IgniteEntryProcessor is called.

On Sun, Feb 22, 2015 at 11:28 PM, Dmitriy Setrakyan <ds...@apache.org>
wrote:

> Hello Ignite experts,
>
> I just noticed that EntryProcessor does not implement Serializable, which
> makes it impossible to serialize when used in Java8 lambda notations.
>
> However, what if we define IgniteEntryProcessor which extends both,
> EntryProcessor and Serializable? And also add invoke method on IgniteCache
> which accepts IgniteEntryProcessor, like so:
> ----------------
> *@IgniteAsyncSupported*
> *public <T> T invoke(K key, IgniteEntryProcessor<K, V, T> entryProcessor,
> Object... arguments);*
>
>
> *@IgniteAsyncSupported*
> *@Override public <T> T invoke(K key, EntryProcessor<K, V, T>
> entryProcessor, Object... arguments);*
> ------------------
>
> Does anyone know which method will be invoked when used with Java8 lambdas
> without any casting, like so (is it JDK specific?):
> -------------------
> *cache.invoke("mykey", (entry, args) -> { .... }); *
> -------------------
>
> D.
>