Package org.apache.fulcrum.cache

Examples of org.apache.fulcrum.cache.RefreshableCachedObject


        }
        if (obj.isStale())
        {
            if (obj instanceof RefreshableCachedObject)
            {
                RefreshableCachedObject rco = (RefreshableCachedObject) obj;
                if (rco.isUntouched())
                {
                    throw new ObjectExpiredException();
                }
                // Refresh Object
                rco.refresh();
                if (rco.isStale())
                {
                    throw new ObjectExpiredException();
                }
            }
            else
            {
                // Expired.
                throw new ObjectExpiredException();
            }
        }
        if (obj instanceof RefreshableCachedObject)
        {
            // notify it that it's being accessed.
            RefreshableCachedObject rco = (RefreshableCachedObject) obj;
            rco.touch();
        }
        return obj;
    }
View Full Code Here


            {
                String key = (String) e.nextElement();
                CachedObject co = (CachedObject) this.cache.get(key);
                if (co instanceof RefreshableCachedObject)
                {
                    RefreshableCachedObject rco = (RefreshableCachedObject) co;
                    if (rco.isUntouched())
                    {
                        this.cache.remove(key);
                    }
                    else if (rco.isStale())
                    {
                        // to prolong holding the lock on this object
                        refreshThese.add(key);
                    }
                }
                else if (co.isStale())
                {
                    this.cache.remove(key);
                }
            }
        }
        for (Iterator i = refreshThese.iterator(); i.hasNext();)
        {
            String key = (String) i.next();
            CachedObject co = (CachedObject) this.cache.get(key);
            RefreshableCachedObject rco = (RefreshableCachedObject) co;
            rco.refresh();
        }
    }
View Full Code Here

       
        if (obj.isStale())
        {
            if (obj instanceof RefreshableCachedObject)
            {
                RefreshableCachedObject rco = (RefreshableCachedObject) obj;
                if (rco.isUntouched())
                {
                    // Do not refresh an object that has exceeded TimeToLive
                    removeObject(id);
                    throw new ObjectExpiredException();
                }

                // Refresh Object
                rco.refresh();
                if (rco.isStale())
                {
                    // Object is Expired, remove it from cache.
                    removeObject(id);
                    throw new ObjectExpiredException();
                }
            }
            else
            {
                // Expired.
                removeObject(id);
                throw new ObjectExpiredException();
            }
        }

        if (obj instanceof RefreshableCachedObject)
        {
            // notify it that it's being accessed.
            RefreshableCachedObject rco = (RefreshableCachedObject) obj;
            rco.touch();
        }

        return obj;
    }
View Full Code Here

               
                Object o = cachedElement.getObjectValue();
               
                if (o instanceof RefreshableCachedObject)
                {
                    RefreshableCachedObject rco = (RefreshableCachedObject) o;
                    if (rco.isUntouched())
                    {
                        this.cache.remove(key);
                    }
                    else if (rco.isStale())
                    {
                        rco.refresh();
                    }
                }
            }
        }
    }
View Full Code Here

        if (obj.isStale())
        {
            if (obj instanceof RefreshableCachedObject)
            {
                RefreshableCachedObject rco = (RefreshableCachedObject) obj;
                if (rco.isUntouched())
                {
                    // Do not refresh an object that has exceeded TimeToLive
                    removeObject(id);
                    throw new ObjectExpiredException();
                }

                // Refresh Object
                rco.refresh();
                if (rco.isStale())
                {
                    // Object is Expired, remove it from cache.
                    removeObject(id);
                    throw new ObjectExpiredException();
                }
            }
            else
            {
                // Expired.
                removeObject(id);
                throw new ObjectExpiredException();
            }
        }

        if (obj instanceof RefreshableCachedObject)
        {
            // notify it that it's being accessed.
            RefreshableCachedObject rco = (RefreshableCachedObject) obj;
            rco.touch();
        }

        return obj;
    }
View Full Code Here

                }
                else
                {
                    if (o instanceof RefreshableCachedObject)
                    {
                        RefreshableCachedObject rco = (RefreshableCachedObject) o;
                        if (rco.isUntouched())
                        {
                            this.cacheManager.remove(key, group);
                        }
                        else if (rco.isStale())
                        {
                            rco.refresh();
                        }
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.fulcrum.cache.RefreshableCachedObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.