[
https://issues.apache.org/jira/browse/IGNITE-5994?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16119754#comment-16119754
]
Anton Vinogradov edited comment on IGNITE-5994 at 8/9/17 11:48 AM:
-------------------------------------------------------------------
[~yzhdanov],
Currently,
{{IgniteCache.invokeAsync()}} is defined as {{<T> IgniteFuture<T>
invokeAsync(...)}},
but {{IgniteInternalCache.invokeAsync()}} is defined as {{<T>
IgniteInternalFuture<EntryProcessorResult<T>> invokeAsync(...)}}
and question about second one.
When {{EntryProcessor}} returns {{null}} we will gain {{null}} at
{{invokeAsync(...).get()}},
But when it returns {{not null}} we will gain {{EntryProcessorResult}} instance
at {{invokeAsync(...).get()}}
So, the question is, is it optimization or bug?
was (Author: avinogradov):
[~yzhdanov],
Currently,
{{IgniteCache.invokeAsync()}} is defined as {{<T> IgniteFuture<T>
invokeAsync(...)}},
but {{IgniteInternalCache.invokeAsync()}} is defined as {{<T>
IgniteInternalFuture<EntryProcessorResult<T>> invokeAsync(...)}}
and question about second one.
When {{EntryProcessor}} returns {{null}} we will gain {{null}} at
{{invokeAsync(...).get()}},
But when it returns {{not null}} we will gain {{EntryProcessorResult}} instance
at {{invokeAsync("test", ep).get()}}
So, the question is, is it optimization or bug?
> IgniteInternalCache.invokeAsync().get() can return null
> -------------------------------------------------------
>
> Key: IGNITE-5994
> URL: https://issues.apache.org/jira/browse/IGNITE-5994
> Project: Ignite
> Issue Type: Bug
> Components: cache
> Affects Versions: 2.1
> Reporter: Alexander Menshikov
> Priority: Minor
> Labels: newbie
> Attachments: IgniteCacheSelfTest.java
>
>
> The IgniteInternalCache.invoke() always return an EntryProcessorResult, but
> the IgniteInternalCache.invokeAsync().get() can return the null in case when
> an EntryProcessor has returned the null.
> Code from reproducer:
> {noformat}
> final EntryProcessor<Object, Object, Object> ep = new EntryProcessor<Object,
> Object, Object>() {
> @Override
> public Object process(MutableEntry<Object, Object> entry,
> Object... objects) throws EntryProcessorException {
> return null;
> }
> };
> EntryProcessorResult<Object> result = utilCache.invoke("test", ep);
> assertNotNull(result);
> assertNull(result.get());
> result = utilCache.invokeAsync("test", ep).get();
> // Assert here!!!
> assertNotNull(result);
> assertNull(result.get());
> {noformat}
> It can be optimization. Nevertheless results of invoke() must be equals with
> results of invokeAsync().get(). So there are two options:
> 1) To do so would be the invokeAsync(key, ep).get() returned the null too for
> the optimization.
> 2) Or to do so would be the invoke(key, ep) returned an EntryProcessorResult
> for a logical consistency.
> NOTE: Don't confuse with IgniteCache.invoke.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)