Hi all,

for the project I'm working in I need to change the caching 
behaviour of Slide. Looking at StandardStore, which does the 
caching, I wonder:

If caching is disabled, read calls are forwarded to super 
(AbstractStore), which then calls the actual Store 
implementation.

If caching is enabled but the object to read is not in the 
cache, the calls are not forwarded to super but to the actual 
Store implementation, e.g. DescriptorsStore.

Why is it done this way? Is it just style?
When super is called, the Stores are listed in a transaction...

I think this is important to understand when I change the way 
the caching is done.

Please see one example below.

Thanks.
Andreas


StandardStore:
    public ObjectNode retrieveObject(Uri uri)
        throws ServiceAccessException, ObjectNotFoundException {
        if (nodeStore.cacheResults()) {
            Object tempObject = 
objectsCache.get(uri.toString());
            if (tempObject != null) {
                return ((ObjectNode) tempObject).cloneObject();
            } else {
                ObjectNode objectNode = 
nodeStore.retrieveObject(uri);
                objectNode.validate(uri.toString());
                objectsCache.put(uri.toString(), 
objectNode.cloneObject());
                return objectNode;
            }
        } else {
            return super.retrieveObject(uri);
        }
    }


AbstractStore:
    public ObjectNode retrieveObject(Uri uri)
        throws ServiceAccessException, ObjectNotFoundException {
        ObjectNode objectNode = null;
        if (isForceStoreEnlistment(uri)) {
            enlist(nodeStore);
            try {
                objectNode = nodeStore.retrieveObject(uri);
            }  catch (ServiceAccessException e) {
                delist(nodeStore, false);
                throw e;
            } catch (ObjectNotFoundException e) {
                // Note : Failed reads aren't considered fatal 
(ie, the
                // transaction won't be always rolledback when 
committed)
                delist(nodeStore);
                throw e;
            } catch (Throwable t) {
                delist(nodeStore, false);
                // Wrap everything else in a 
ServiceAccessException
                throw new ServiceAccessException(nodeStore, t);
            }
            delist(nodeStore);
        } else {
            try {
                objectNode = nodeStore.retrieveObject(uri);
            } catch (ServiceAccessException e) {
                throw e;
            } catch (ObjectNotFoundException e) {
                throw e;
            } catch (Throwable t) {
                // Wrap everything else in a 
ServiceAccessException
                throw new ServiceAccessException(nodeStore, t);
            }
        }
        objectNode.validate(uri.toString());
        return objectNode;
    }


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to