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

Ask Your Question
0

Pattern for states that timeout

A task in my system has a complex workflow (many states) and a few of these states are long-lived while waiting for the user to interact. If the user fails to interact within a specific amount of time I want the system to take control and change the state of the task. Is there a recommended way to establish processes/workers that will execute after tasks reach a certain time threshold in a particular state? I can't depend on the client to indicate this threshold has been met.

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

asked 2008-06-15 22:06:04 -0500

oravecz gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted
0

Why can’t you use a leased object and relevant notification will be triggered once the object will expire.
Constructing such a PU should be straightforward.
Note that notifications for expired lease sent both from the primary and backup - so your business logic should ignore double notification for the same object.
Shay

answered 2008-06-16 15:50:01 -0500

shay hassidim gravatar image
edit flag offensive delete link more
0

You can setup a timer bean that periodically scans entries at some state and based on elapsed time, changes their state.

Guy

answered 2008-06-15 23:40:49 -0500

nirpaz gravatar image
edit flag offensive delete link more
0

Thanks for the responses. I will start with lease notification since it is more elegant. I suppose as long as I "take" on notification, I don't have to worry about any concurrency issues surrounding the dual notifications.

answered 2008-06-16 20:50:22 -0500

oravecz gravatar image
edit flag offensive delete link more

Comments

Make sure u do not register for take operations notifications but only for lease expiration notifications.

Shay

shay hassidim gravatar image shay hassidim  ( 2008-06-16 22:22:21 -0500 )edit
0

You add have a Date field in your task that is updated once the Task is in the System. Have the timer bean poll objects and check if the time has elapsed, if so update their state and write them back, otherwise just right them back as is.

answered 2008-06-16 01:30:42 -0500

eitany 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

Stats

Asked: 2008-06-15 22:06:04 -0500

Seen: 194 times

Last updated: Jun 16 '08