Package org.apache.fulcrum.cache

Examples of org.apache.fulcrum.cache.CachedObject


     *                when either the object is not in the cache or it has
     *                expired.
     */
    public CachedObject getObject(String id) throws ObjectExpiredException
    {
        CachedObject obj = null;
        obj = (CachedObject) this.cache.get(id);
        if (obj == null)
        {
            // Not in the cache.
            throw new ObjectExpiredException();
        }
        if (obj.isStale())
        {
            if (obj instanceof RefreshableCachedObject)
            {
                RefreshableCachedObject rco = (RefreshableCachedObject) obj;
                if (rco.isUntouched())
View Full Code Here


        synchronized (this)
        {
            for (Iterator itr = this.cache.keySet().iterator(); itr.hasNext();)
            {
                String key = (String) itr.next();
                CachedObject obj = null;
                try
                {
                    obj = getObject(key);
                }
                catch (ObjectExpiredException oee)
View Full Code Here

        synchronized (this)
        {
            for (Enumeration e = this.cache.keys(); e.hasMoreElements();)
            {
                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

        {
            // Not in the cache.
            throw new ObjectExpiredException();
        }

        CachedObject obj = (CachedObject)cachedElement.getObjectValue();
       
        if (obj.isStale())
        {
            if (obj instanceof RefreshableCachedObject)
            {
                RefreshableCachedObject rco = (RefreshableCachedObject) obj;
                if (rco.isUntouched())
View Full Code Here

    /**
     * @see org.apache.fulcrum.cache.GlobalCacheService#getObject(java.lang.String)
     */
    public CachedObject getObject(String id) throws ObjectExpiredException
    {
        CachedObject obj = (CachedObject) this.cacheManager.getFromGroup(id,
                group);

        if (obj == null)
        {
            // Not in the cache.
            throw new ObjectExpiredException();
        }

        if (obj.isStale())
        {
            if (obj instanceof RefreshableCachedObject)
            {
                RefreshableCachedObject rco = (RefreshableCachedObject) obj;
                if (rco.isUntouched())
View Full Code Here

    }
    public void testComponentAndFacaded() throws Exception
    {
        ServiceManager serviceManager = TurbineServices.getInstance();
    GlobalCacheService cache = (GlobalCacheService)serviceManager.getService(GlobalCacheService.ROLE);
    CachedObject inputObject = new CachedObject(new Double(10.2));
    cache.addObject("testObj",inputObject);
    }
View Full Code Here

TOP

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

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.