Re: [jgroups-users] In which case Rsp could be null?

Questions/problems related to using JGroups <[email protected]>
Newsgroups gmane.comp.java.javagroups.general
Message-ID <CA+nfvwRbPosUGYR-wVntZ5qdXNX5JyA16ur35gX8ojiDrtGDRw@mail.gmail.com>
Hi Eugene

MessageDispatcher.cast (which is used by
RpcDispatcher.callRemoteMethods) will return null if
real_dests.isEmpty(). In your case, that would happen if the cluster
has a single member.

Cheers
Dan


On Wed, Apr 6, 2016 at 6:32 PM, Questions/problems related to using
JGroups <[email protected]> wrote:
> Hello,
>
> I use RPC, and getting NullPointerException in very unusual place:
>
> Here is my code example:
>
> -----------------
>
> RspList<Boolean> result = dispatcher.callRemoteMethods(null, "fileExists",
> new Object[] { localFileName }, new Class[] { String.class },
> OPT_ALL_IN_5_SEC);
>
> for (Rsp<Boolean> rsp : result.values()) {
>
> if (rsp.getValue()) {
>
> -------------------
>
> the last line sometimes throws NPE. Looks like rsp is null.
>
> The fileExists method returns primitive boolean, so the result cannot be
> null by definition.
>
> Looks like something went wrong during the cluster communication.
>
> What could it be?
>
>
> Thanks,
>
> Eugene
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> javagroups-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/javagroups-users
>

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.