[Opensymphony-oscache] CacheEntry::needsRefresh

Lars Torunski <[email protected]>
Newsgroups gmane.comp.java.open-symphony.os-cache
Message-ID <20032025.1112679484096.JavaMail.os-j2ee@opensymphony01.contegix.com>
Reviewing the class CacheEntry and it's method needsRefresh due to a bug (Cache-160), I don't understand why isn't the parameter refreshPeriod is used if a policy is set:

....
        else if (policy != null) {
            needsRefresh = policy.needsRefresh(this);
        }
        // check if the last update + update period is in the past
        else if ((refreshPeriod >= 0) && (System.currentTimeMillis() >= (lastUpdate + (refreshPeriod * 1000L)))) {
            needsRefresh = true;
        } else {
            needsRefresh = false;
        }


According to the javadoc my interpretation of the method is:

...
        // check if the last update + update period is in the past
        else if ((refreshPeriod >= 0) && (System.currentTimeMillis() >= (lastUpdate + (refreshPeriod * 1000L)))) {
            needsRefresh = true;
        }
        // check what the policy has to say if there is one
        else if (policy != null) {
            needsRefresh = policy.needsRefresh(this);
        }

This class was never changed, so this may not be a bug. But I think we have to correct this.

Objections and suggestions anyone?

---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=1283&messageID=4038#4038
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.