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

Ask Your Question
0

How To Write To All Partitions

Hi All. I´m using GS XAP 6.6.0 and cluster schema:partitioned-sync2backup. When I try to write an object to all partitions (one write operation setting routing field=null) I´m getting:

org.openspaces.core.UncategorizedSpaceException: Broadcast is not supported for 'write' operation. Operation description: class='com.pagosonline.maf.modelo.impl.ComandoTimer', operation=write, transaction=null Operation requires broadcast to all partitions based on: configuration: <broadcast-condition>routing-index-is-null</broadcast-condition> and operation data: <routing index="" field="" is="" not="" defined="" in="" class="" 'com.pagosonline.maf.modelo.impl.comandotimer="" '="" ><="" p="">

I tried to write the object from a remote client.

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

asked 2008-10-28 12:12:54 -0500

nullcipher2 gravatar image

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

jaissefsfex gravatar image
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

You can't write an object to all partitions.
You can only perform a query (read) , remove data or execute methods on services running on multiple partitions.

When writing object from a remote space into a partitioned space you must have a value without the routing field. This value will be used to rout the write operation to the relevant target space.

You can use the executors to call a method on each partition to write data into its collocated space.

Can you explain why you need to write the same object into multiple partition? Any chance you simply need to execute a method on each partition?

Shay

answered 2008-10-28 12:30:15 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Hi Shay. I need to activate the UtilTimerStack in all partitions for profiling purposes, so I create a notify container. I´m sending a command object for that. How can I use the executors in my case, I only need to execute the following line in all partitions: UtilTimerStack.setActive(...);.

Thanks.

nullcipher2 gravatar imagenullcipher2 ( 2008-10-28 13:00:47 -0500 )edit

So the right way to do this is via executors.
See the distributed task docs.
Shay

shay hassidim gravatar imageshay hassidim ( 2008-10-28 13:07:19 -0500 )edit

I did some reviews of the Executor Component.

I need to implement in the client side something like:

AsyncFuture<string> future = gigaSpace.execute(new TimerTask());

What gigaSpace is refering to?, How can I register the Executor in the pu.xml, it´s necessary to do it?

Thanks

nullcipher2 gravatar imagenullcipher2 ( 2008-10-28 14:14:10 -0500 )edit

gigaSpace is the org.openspaces.core.GigaSpace Interface

See:

http://www.gigaspaces.com/docs/JavaDocOS6.6/org/openspaces/core/GigaSpace.html

You should use DistributedTask :

public class MyDistTask implements DistributedTask<Integer, Long> {

public Integer execute() throws Exception {

return 1;

}

public Long reduce(List<AsyncResult<Integer>> results)

throws Exception {

long sum = 0;

for (AsyncResult result : results) {

if (result.getException() != null) {

throw result.getException();

}

sum += result.getResult();

}

return sum;

}

}

AsyncFuture<Integer> future = gigaSpace.execute(new MyDistTask());

int result = future.get();

Shay

shay hassidim gravatar imageshay hassidim ( 2008-10-28 17:10:53 -0500 )edit

I understand it. I can use any GigaSpace implementation I choose?. How can I register the Executor in the GigaSpace, maybe using th pu.xml like a sync-remoting registration?

Thanks

nullcipher2 gravatar imagenullcipher2 ( 2008-10-28 17:47:33 -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: 2008-10-28 12:12:54 -0500

Seen: 313 times

Last updated: Oct 28 '08