1.4. Upgrading from JBoss Data Grid 6.3.x to 6.4
The Hot Rod size() method in JBoss Data Grid 6.3 is used to obtain the size by looking at the numberOfEntries statistic on the server. This required statistics to be enabled and the ADMIN permission if security was in use (instead of the more appropriate BULK_READ). It also only returned the number of entries in the node that responded to the request. This included potentially expired entries and did not take stores/loaders into account. In JBoss Data Grid 6.4, the size method's behavior can be modified to include the size of the entire cluster (not just the local node). If the infinispan.accurate.bulk.ops system property is set to true then the size method will use the new behavior by utilizing the entry iterator to count all entries.
The size() method no longer returns the value of the currentNumberOfEntries statistic. Instead it will retrieve all the keys using keySet() and will then return the number of entries in this set.
keySet() is a costly operation and because of this size() is now a costly operation as well. Distributed caches it will retrieve all the keys from all the nodes in the cluster.