|
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. 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[Look And Feel - ServiceGrid] = new View (microsoftStock , "name='microsoft' and price>1000"); Properties props = new Properties(); props.put("views" ,views ); IJSpace spaceView = (IJSpace) SpaceFinder.find("jini://*/*/mySpace?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:
|
(works on Firefox 2 and Internet Explorer 7)

For details on how to run a two-level cache: a local cache in the physical address space of the application and a master cache in a different process, refer to the