ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yakov Zhdanov <yzhda...@apache.org>
Subject Re: AsyncSupportAdapter.withAsync() semantcis issue.
Date Mon, 30 Mar 2015 12:45:36 GMT
I think that current approach is fine. At least since A==B in your example.

--Yakov

2015-03-23 16:06 GMT+03:00 Vladimir Ozerov <vozerov@gridgain.com>:

> I was a bit wrong in my explanation. The problem exists not when shating an
> instance between threads, but when different instances are processed inside
> the same thread. E.g. in one method you operate on instance A, then
> somewhere deeper in the stack you operate on instance B. There is a chance,
> the you will get a future from instance A when calling B.future().
>
> On Mon, Mar 23, 2015 at 3:40 PM, Sergey Evdokimov <sevdokimov@gridgain.com
> >
> wrote:
>
> > Result of asynchronous operation will be saved to ThreadLocal, so no
> > problem with sharing between threads.
> >
> > On Mon, Mar 23, 2015 at 1:47 PM, Vladimir Ozerov <vozerov@gridgain.com>
> > wrote:
> >
> > > Hi,
> > >
> > > Consider the following scenario:
> > >
> > > IgniteCache cache = ignite.cache();
> > >
> > > IgniteCache cache1 = cache.withAsync();
> > > IgniteCache cache2 = cache1.withAsync();
> > >
> > > cache1.put(...);
> > >
> > > assert cache2.future() != null;
> > >
> > > It means that currently no async instance can be shared between threads
> > > safely.
> > >
> > > Shouldn't we create new instance every time "withAsync()" is called? Or
> > > current semantics was implemented intentionally?
> > >
> > > Vladimir.
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message