Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Is there a generic issue with AsyncFutureListener and DistributedTask?

Hi,

I am unable to setup an AsyncFutureListener appropriately when using DistributedTask<t, r="">. When using AsyncFutureListener<r> or public void onResult(AsyncResult<r> result) { } this method is never invoked. If I use AsyncFutureListener<t> or public void onResult(AsyncResult<t> result) { T t = result.getResult(); } I can see the system entering onResult (by debugging) but I get ClassCastException when R is not cast-able to T. I workaround this problem by specifying: Object resultObject = result.getResult(); R r = (R) resultObject; but it shouldn't be like this. It seems to me the generics are mixed (bug). Am I doing something wrong?

If you try to do the same with the ExecutorExample from the page http://wiki.gigaspaces.com/wiki/displ... , you'll get the same results. Just change (in MyTask.java): public class MyTask implements DistributedTask { with public class MyTask implements DistributedTask{ This will make u change the the execute return type to String and the reduce method parameter type to List>.

If you deploy the space in this situation and run the ExecutorTaskClientMain in async mode, it will not enter the onResult method from ExecutorTaskClientMain. This is because the listener is intended to take the results from the reduce, not the intermediate results. Ok. Then if you change (,to cover up for this): implements AsyncFutureListener<integer> to implements AsyncFutureListener<string> it will make u change the onResult from: public void onResult(AsyncResult<integer> result) { to public void onResult(AsyncResult<string> result) {

In this case you get a ClassCastException(java.lang.Integer cannot be cast to java.lang.String) when you try to do the following: String someString = result.getResult();

Can anyone confirm this? Does this bug really exist?

Kind Regards, despot

p.s.: It would be great if you could make the example log the RuntimeException (with a try catch clause for example) since it never shows it in logs or console. When people try to use it, they want be able to trace the problem if it happens.

Edited by: Despot Jakimovski on Nov 29, 2012 5:55 AM

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3971]{quote}

asked 2012-11-29 05:46:58 -0500

Despot gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

Hello,

I've reproduced the bug that you have described in the latest version of our product. Thanks for pointing this out, we will schedule a fix for this issue.
The internal reference number for this issue is "GS-10855".

How urgent is this issue for you?

Regards,
Itai
XAP Core team
R&D

answered 2012-12-02 05:48:15 -0500

itaif gravatar image
edit flag offensive delete link more

Comments

Hi Itai,

Thank you for inspecting this.

As I mentioned I already found a work-around, but it would be great if we could use the generics appropriately. So, no urgency.

Kind Regards, Despot

Despot gravatar imageDespot ( 2012-12-03 14:25:10 -0500 )edit
0

Hello,

can you provide more info, like what version of Gigaspaces are you using.

Also there is a very simple example of how to use distributed tasks here : http://wiki.gigaspaces.com/wiki/displ...

let me know if this helps,

Guy

answered 2012-11-29 21:33:07 -0500

dragnot gravatar image
edit flag offensive delete link more

Comments

Hi Guy,

thanks for replying.

I am using version 8.0.0 RC2.

As much as I can see, what you are suggesting from the link above is pretty much the same as the part for [Task Execution|http://wiki.gigaspaces.com/wiki/display/SBP/Map-Reduce+Pattern+-+Executors+Example#Map-ReducePattern-ExecutorsExample-ExecutorsTaskExample|Task Execution] in my link. Is it possible for you to download the [ExecutorExample|http://wiki.gigaspaces.com/wiki/download/attachments/49414729/ExecutorExample.zip?version=4|The executor example zip] and make the appropriate changes in your version and tell me if you encounter the same issue?

Kind Regards, despot

Despot gravatar imageDespot ( 2012-12-01 06:09:29 -0500 )edit

Hello Despot,

RC version may have issue, version 8.0.0 from last year. i strongly suggest to download out latest version 9.1.0. and try a basic distributed example. its more a case of copy and paste from our wiki page.

if you need a basic working example, let me know to my email guyl@gigaspaces.com and i will mail it to you.

Regards, Guy

dragnot gravatar imagedragnot ( 2012-12-01 07:34:54 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2012-11-29 05:46:58 -0500

Seen: 178 times

Last updated: Dec 02 '12