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

Ask Your Question
0

iterator with FIFO

Hi,

I'm trying to get objects from the space using an iterator and I want them in FIFO order. The only way I could achieve that was by setting FifoSupport.ALL to the class. I wished to use it with FifoSupport.OPERATION. Is there a performance penalty using ALL instead of OPERATION (i'm concerned both while iterating and/or when objects are written)?

With FifoSupport.OPERATION on the class i tryed the following: final EventSessionConfig sessionConfig = new EventSessionConfig(); sessionConfig.setFifo(true); return gigaSpace.iterator().iteratorScope(IteratorScope.CURRENT).eventSessionConfig(sessionConfig).addTemplate(template).iterate(); But it didn't work in FIFO order if I call this more than once.

And another question: update on an object keeps it's old place in the FIFO list, or after the update the object will be considered the newest (=> last in FIFO list). To me it seems it keeps it's place but I need to be 100% safe here.

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=3258]{quote}

asked 2009-10-01 08:05:49 -0500

lukeh 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

- If you have a partitioned space used with the GSIterator, you won’t get the initial list ordered in a correct manner. You will have to sort the result set.
- Using readMultiple with FIFO mode might lead to problems , since subsequent call will return the same list , so you will be reading the same object again. You should use ORDER BY instead.
- Calling update keeps the object in its old place in the FIFO list.
- The impact of using ALL will be visible mostly with write and take operations. If you would like to get notifications in FIFO mode and it does not work for you please submit a support case.

Shay

answered 2009-11-09 08:54:46 -0500

shay hassidim gravatar image
edit flag offensive delete link more
0

I want to add another question related to FIFO but with readMultiple (not iterator)

If i use a readMultiple on a FIFO class, with a query that has "ORDER BY fieldA" then the objects with the same value for fieldA are supposed to be in FIFO order?

answered 2009-10-02 02:21:50 -0500

lukeh gravatar image
edit flag offensive delete link more

Comments

Sorry for the bump. Are there no answers for this?

lukeh gravatar imagelukeh ( 2009-11-09 05:46:47 -0500 )edit

Thanks Shay

* If you have a partitioned space used with the GSIterator, you won?t get the initial list ordered in a correct manner. You will have to sort the result set.

Actualy I'm calling this from a PU using local url for the space even if the space is partitioned. Am I safe in this situation?

* Using readMultiple with FIFO mode might lead to problems , since subsequent call will return the same list , so you will be reading the same object again. You should use ORDER BY instead.

I'm not concerned of multiple calls. Is it ok during the first (and only) call?

* Calling update keeps the object in its old place in the FIFO list.

Thanks

* The impact of using ALL will be visible mostly with write and take operations. If you would like to get notifications in FIFO mode and it does not work for you please submit a support case.

Thanks. Still can you advice me how an iterator opeeration can be set to use fifo or not?

What about the question: using ORDER BY the entries with the same value for the sorting field will be FIFO?

lukeh gravatar imagelukeh ( 2009-11-10 02:32:01 -0500 )edit

Here is a workaround how to create a GSIterator running in FIFO mode. You need to do 2 things:
1. The event registration needs to be FIFO.
This can be done by creating the GSIterator with GSIteratorConfig which contains an EventSessionConfig with fifo=true (this is new since 7.0).

2. The initial read of existing entries needs to be in FIFO mode.
There's no way to do that per GSIterator instance right now. However, it is possible to use FifoSupport=ALL on the relevant pojo class(es), thus making all read/take operations on this pojo be FIFO, including the GSITerator.

Shay

shay hassidim gravatar imageshay hassidim ( 2009-11-11 23:25:08 -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-10-01 08:05:49 -0500

Seen: 111 times

Last updated: Oct 02 '09