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

Ask Your Question
0

Help, very easy problem

Hi, I'm very new on Gigaspaces and I've a problem. I'm "extending" the HelloWorld example to do my proyect. The proyect is like the HelloWorld example, I write objects in the space and the processor bean process the objects. The problem is that the Feeder must wait until the proccesor finish and then read the result.

So, 1) How do I wait the entire process of the mesagges? 2) How do I get an object from the space?

Thanks and sorry for my english.

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

asked 2009-09-19 13:45:03 -0500

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

You can wait for a matching object to "arrive" into the space via Gigaspace.read(Object template , Integer blockingreadtimeout).
If you would like to consume it and remove in one atomic operation , you should use Gigaspace.take(Object template , Integer blockingtaketimeout).

The read and take operation can get also SQLQuery which you can use to specify a SQL query statement to fetch your object.
If you have multiple objects you want to read you should use the Gigaspace.readMultiple(Object template , Integer maxobjectsto_read).

For more details see the Gigaspaces tutorial and the POJO operations page:
http://www.gigaspaces.com/wiki/display/XAP7/QuickStartGuide
http://www.gigaspaces.com/wiki/display/XAP7/POJOSupport#POJOSupport-CodeSnippets

Shay

answered 2009-09-20 05:39:50 -0500

shay hassidim gravatar image
edit flag offensive delete link more
0

Thanks, but in the method Gigaspace.read(Object template , Integer blocking_read_timeout) I need a timeout, and I don't know how much time it will take. I need to block the feeder until all the mesagges have been processed.

1) is there any Gigaspace.read(Object template , Integer BLOCK_UNTIL_NO_PROCCES) ? I mean, is there any way to tell from the space to the feeder that all the process is finished?

2) Can the feeder read an atributte directly from the space?

Thanks for the reply

answered 2009-09-20 08:04:03 -0500

edit flag offensive delete link more

Comments

  1. Use: Lease.FOREVER. This will return the control to the client when the space will have a matching object. This works only with a single space. With partitioned space you will need to use the technique described here: http://www.gigaspaces.com/wiki/displa...

  2. It need to read the object first. You can use Executor to read the object from a colocated space without reading it back to the client. This would not involve serializing the object back to the client. See: http://www.gigaspaces.com/wiki/displa...

Shay

shay hassidim gravatar imageshay hassidim ( 2009-09-20 11:03:43 -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: 2009-09-19 13:45:03 -0500

Seen: 20 times

Last updated: Sep 20 '09