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

Ask Your Question
0

Redeploy Gigaspace with new java objects

Hi,

I have a gigaspace running with java objects working fine.

Problem arises when I need to modify the java object say add another field.

Due to the new field in the java object, i need to redeploy and re-start the gigaspace. However, i still the existing java objects that are still inside the gigaspace.

I need to read out the existing java object and write to DB before i redeploy the new java object. After redeploy, i need to read data from db and populate to gigaspace java object.

Is there any sample code in doing this??

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

asked 2009-04-27 05:22:09 -0500

wkhlim 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 use Hibernate to do it.

The space configured with EDS will do this implicitly. See:
http://www.gigaspaces.com/wiki/display/XAP66/AsyncPersistency-Mirror
http://www.gigaspaces.com/wiki/display/XAP66/HibernateExternalDataSource

Shay

answered 2009-04-27 14:30:35 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Hi,

The examples u mention only mirror the data into DB so that data is not lost, am I rite?? what happen if the gigaspace is already running without this mirroring.....?? and i need to modify the java object in the space.

I cant juz stop the gigaspace as there is data in the java object. i need to populate the existing data in space to DB 1st....and deploy the new java object then restart the space......and repopulate back the data from DB to new java object.

How can i do tat??

wkhlim gravatar imagewkhlim ( 2009-04-27 21:15:03 -0500 )edit

There are 2 options to resolve your problem:
- “dump” the space data into a database. You can do that via executors that will iterate through the space , one iterator per class (in parallel) and write the objects into the database via Hibernate API. Once the space is started , have the same done , but in this case have the executors to read data from the database and write it into their collected space.
- Have constant persistency going on , via the mirror service and once the space is started let the EDS to do its thing and load the data from the database implicitly.

It sounds like that you prefer to go with the explicit option that is the first option.

For example how to use Task executors see:
http://www.gigaspaces.com/wiki/display/SBP/ExecutorsExample#ExecutorsExample-ExecutorsTaskExample

For example how to use space iterator see:
http://www.gigaspaces.com/wiki/display/XAP66/EDGTutorialB-GSIteratorSection

To get the space class list see:
spaces/core/admin/SpaceRuntimeInfo.html">http://www.gigaspaces.com/docs/JavaDoc6.6/com/jspaces/core/admin/SpaceRuntimeInfo.html

Shay

shay hassidim gravatar imageshay hassidim ( 2009-04-27 23:37:49 -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-04-27 05:22:09 -0500

Seen: 53 times

Last updated: Apr 27 '09