1 | defaultServerResource(String) on ClusteringServiceConfigurationBuilder instance sets the default server off-heap resource for the cache manager. From the example, cache manager sets its default server off-heap resource to "primary-server-resource" in the server. |
2 | Adds a resource pool for the cache manager with the specified name ("resource-pool-a") and size (28MB) consumed out of the named server off-heap resource "secondary-server-resource". A resource pool at the cache manager level maps directly to a shared pool at the server side. |
3 | Adds another resource pool for the cache manager with the specified name ("resource-pool-b") and size (32MB). Since the server resource identifier is not explicitly passed, this resource pool will be consumed out of default server resource provided in Step 3. This demonstrates that a cache manager with clustering support can have multiple resource pools created out of several server off-heap resources. |
4 | Provide the cache configuration to be created. |
5 | ClusteredResourcePoolBuilder.clusteredDedicated(String , long , MemoryUnit) allocates a dedicated pool of storage to the cache from the specified server off-heap resource. In this example, a dedicated pool of 32MB is allocated for clustered-cache from "primary-server-resource". |
6 | ClusteredResourcePoolBuilder.clusteredShared(String), passing the name of the resource pool specifies that "shared-cache-1" shares the storage resources with other caches using the same resource pool ("resource-pool-a"). |
7 | Configures another cache ("shared-cache-2") that shares the resource pool ("resource-pool-a") with "shared-cache-1". |
8 | Creates fully initialized cache manager with the clustered caches. |