|
Summary: The space local view proxy maintains a subset of the master space's data, allowing the client to read distributed data without any remote operations.
OverviewThe space local view proxy maintains a subset of the master space's data, allowing the client to read distributed data without any remote operations. Data is streamed into the client view in an implicit manner – as opposed to local cache data, that is loaded into the client on-demand, and later updated or evicted. The local view is defined via a filter – regular template or SQLQuery – as opposed to the local cache that caches data at the client side only after the data has been read. The space local view can be constructed using: IJSpace localViewSpace = (IJSpace)SpaceFinder.find("jini://*/*/myMasterSpace?useLocalCache&
views={com.gs.MyClass1:A=3 AND b=3,com.gs.MyClass2:g=3 AND b=3}");
IJSpace localViewSpace = (IJSpace)SpaceFinder.find("jini://*/*/myMasterSpace?useLocalCache" , properties);
Streaming Space Subset Data into ClientOnce the local view is constructed, data is pre-loaded into the client based on the view filter criteria (as opposed to the local cache that does not have a pre-load phase). The local view is continuously updated by the master space in an asynchronous mode (using notifications). Both write and update operations are delivered into the client based on the view filter criteria (as opposed to the local cache that delivers only update operations to the client). All read operations (including readMultiple) use the local view proxy only (as opposed to the local cache that might read data from a remote master space). Data is not evicted from the local view. Write, update, or take operations using the local view proxy affect also the remote master space. Code ExampleStock ibmStock = new Stock("ibm"); Stock microsoftStock = new Stock("microsoft"); View[] views = new View [2]; views[0] = new View (ibmStock , "name='ibm' and price<1000"); views[1] = new View (microsoftStock , "name='microsoft' and price>1000"); Properties props = new Properties(); props.put("views" ,views ); IJSpace spaceView = (IJSpace) SpaceFinder.find("jini://*/*/myCache?timeout=10000&useLocalCache" , props); NotifyDelegator ntf = new NotifyDelegator(spaceView,new Stock() , null ,this , Lease.FOREVER , null , true , NotifyModifiers.NOTIFY_ALL); // will get notifications from local view Entry[] stocks = spaceView.readMultiple(new Stock() , null, 1000 ); // will read data only from local view IRemoteJSpaceAdmin admin = (IRemoteJSpaceAdmin)spaceView.getAdmin(); admin.stop(); // stop the local view from being updated admin.restart(); Example
The example includes:
|
Wiki Content Tree
Your Feedback Needed!
We need your help to improve this wiki site. If you have any suggestions or corrections, write to us at techw@gigaspaces.com. Please provide a link to the wiki page you are referring to.

Add Comment