stariy95 commented on code in PR #627: URL: https://github.com/apache/cayenne/pull/627#discussion_r1965555035
########## cayenne-server/src/main/java/org/apache/cayenne/access/ObjectStore.java: ########## @@ -213,13 +217,28 @@ synchronized ObjectDiff registerDiff(Object nodeId, NodeDiff diff) { return objectDiff; } + private Persistent getUnwrapped(Object nodeId) { + Persistent persistent = objectMap.get(nodeId); + if(persistent == null) { + return null; + } + return ((ObjectStorePersistentWrapper) persistent).dataObject(); + } + /** * Returns a number of objects currently registered with this ObjectStore. * * @since 1.2 */ public int registeredObjectsCount() { - return objectMap.size(); + AtomicInteger counter = new AtomicInteger(); + objectMap.forEach((id, obj) -> { + ObjectStorePersistentWrapper wrapper = (ObjectStorePersistentWrapper) obj; + if(wrapper.hasObject()){ + counter.incrementAndGet(); + } + }); + return counter.get(); Review Comment: Static cast is a compile-time feature, so it should be ok. But additional wrapper would add some overhead unfortunately. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cayenne.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org