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

Ask Your Question

Task failover?

Hi, I have a partition with a backup. I want to submit a task and if the primary fails (I kill it) during the task execution i want the task to be retried on the backup when it moves to Primary mode. Is this possible? I made a simple test and by default it does not seem to work that way. Thanks

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

asked 2009-06-05 08:27:09 -0500

lukeh gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

Lucian, Are you using Task executors? In case of a failover , the task should be routed to the new primary. Shay

answered 2009-06-08 09:09:17 -0500

shay hassidim gravatar image
edit flag offensive delete link more


Hi, I'm using GigaSpace#execute(Task task). What I mean by failover is to call execute once and if the primary dies during the execution the new primary to execute the task again without another call of the execute(Task). Shay, are you saying that it should happend like this? If I call execute again is true that it gets executed on the new primary, but I want to be reexecuted without another explicit call. Thanks, Lucian

lukeh gravatar imagelukeh ( 2009-06-09 02:05:10 -0500 )edit


Failover of executors is automatic, please open a support case with reproduction.

Thanks Eitan

eitany gravatar imageeitany ( 2009-06-09 12:05:07 -0500 )edit

Hi, I opened a case but further testing today I realized that it failsover only if I call get() on the Future object returned by the execute(). Thanks, Lucian

lukeh gravatar imagelukeh ( 2009-06-10 03:57:51 -0500 )edit


The problem in your test scenario is that the feeder is an application that start, do an execute command and terminates. The part of the system that is in charge of failover of the execute command is the client which recognizes the primary is unavailable and resubmit the task to the backup which becomes primary. Since the client doesn't exist anymore there's no failover process. That is why you didn't see this behavior when you called get on the result future, because you kept the client running until the task is complete.

Unlike all the blocking operations, such as write, take etc', Execute is an async operation that returns immediately once dispatched. while the blocking operations block until they are completed. For that reason, if you need to be sure the task is executed you should call the future.get() method which is released once the task is completed. (Or you can use a listener which is invoked once the task is complete to be notified when the task is complete).


eitany gravatar imageeitany ( 2009-06-14 10:44:12 -0500 )edit

How about using a colocated polling container to take the task and execute it? this will work when you have primary backup.

answered 2009-06-05 17:32:02 -0500

eitany gravatar image
edit flag offensive delete link more

Thanks for answers. I understand your point.

answered 2009-06-22 02:45:03 -0500

lukeh gravatar image
edit flag offensive delete link more

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


Asked: 2009-06-05 08:27:09 -0500

Seen: 29 times

Last updated: Jun 22 '09