Package org.apache.stratum.jcs.engine.behavior

Examples of org.apache.stratum.jcs.engine.behavior.ICache


        }

        // Removes from all auxiliary disk caches.
        for ( int i = 0; i < auxCaches.length; i++ )
        {
            ICache aux = auxCaches[i];

            if ( aux != null && aux.getCacheType() == ICache.DISK_CACHE )
            {
                try
                {
                    aux.removeAll();
                }
                catch ( IOException ex )
                {
                    handleException( ex );
                }
View Full Code Here


            for ( int i = 0; i < auxCaches.length; i++ )
            {
                try
                {
                    ICache aux = auxCaches[i];

                    if ( aux == null || fromRemote && aux.getCacheType() == REMOTE_CACHE )
                    {
                        continue;
                    }
                    if ( aux.getStatus() == ICache.STATUS_ALIVE )
                    {

                        if ( log.isDebugEnabled() )
                        {
                            log.debug( "size = " + memCache.getSize() );
                        }

                        if ( !( aux.getCacheType() == ICacheType.LATERAL_CACHE && !this.cacheAttr.getUseLateral() ) )
                        {

                            Iterator itr = memCache.getIterator();

                            while ( itr.hasNext() )
                            {
                                Map.Entry entry = ( Map.Entry ) itr.next();
                                Serializable key = ( Serializable ) entry.getKey();
                                MemoryElementDescriptor me = ( MemoryElementDescriptor ) entry.getValue();
                                try
                                {
                                    if ( aux.getCacheType() == ICacheType.LATERAL_CACHE && !me.ce.getElementAttributes().getIsLateral() )
                                    {
                                        continue;
                                    }
                                    aux.put( key, me.ce.getVal(), me.ce.getElementAttributes() );
                                }
                                catch ( Exception e )
                                {
                                    log.error( e );
                                }
                            }
                        }
                        if ( aux.getCacheType() == ICache.DISK_CACHE )
                        {
                            aux.dispose();
                        }
                    }
                }
                catch ( IOException ex )
                {
View Full Code Here

            for ( int i = 0; i < auxCaches.length; i++ )
            {
                try
                {
                    ICache aux = auxCaches[i];

                    if ( aux.getStatus() == ICache.STATUS_ALIVE )
                    {

                        Iterator itr = memCache.getIterator();

                        while ( itr.hasNext() )
                        {
                            Map.Entry entry = ( Map.Entry ) itr.next();
                            Serializable key = ( Serializable ) entry.getKey();
                            MemoryElementDescriptor me = ( MemoryElementDescriptor ) entry.getValue();
                            //try {
                            // should call update
                            aux.put( key, me.ce.getVal(), me.ce.getElementAttributes() );
                            // remove this exception from the interface
                            //} catch( Exception e ) {
                            //  log.error( e );
                            //}
                        }
View Full Code Here

    /** Description of the Method */
    public void freeCache( String name )
        throws IOException
    {
        ICache c = null;

        synchronized ( caches )
        {
            c = ( ICache ) caches.get( name );
        }
        if ( c != null )
        {
            c.dispose();
        }
    }
View Full Code Here

    {
        StringBuffer stats = new StringBuffer();
        Iterator allCaches = caches.values().iterator();
        while ( allCaches.hasNext() )
        {
            ICache c = ( ICache ) allCaches.next();
            if ( c != null )
            {
                stats.append( "<br>&nbsp;&nbsp;&nbsp;" + c.getStats() );
            }
        }
        return stats.toString();
    }
View Full Code Here

        synchronized ( caches )
        {
            Iterator allCaches = caches.values().iterator();
            while ( allCaches.hasNext() )
            {
                ICache c = ( ICache ) allCaches.next();
                if ( c != null )
                {
                    try
                    {
                        c.dispose();
                    }
                    catch ( IOException ex )
                    {
                        log.error( ex );
                    }
View Full Code Here

            String server = ( String ) it.nextElement();
            //p( "tcp server = " +  server );
            rca.setRemoteHost( server.substring( 0, server.indexOf( ":" ) ) );
            rca.setRemotePort( Integer.parseInt( server.substring( server.indexOf( ":" ) + 1 ) ) );
            RemoteCacheClusterManager rcm = RemoteCacheClusterManager.getInstance( rca );
            ICache ic = rcm.getCache( rca.getCacheName() );
            if ( ic != null )
            {
                noWaits.add( ic );
            }
            else
View Full Code Here

        if ( log.isDebugEnabled() )
        {
            log.debug( "handleRemoveAll> cacheName=" + cacheName );
        }
        getCacheManager();
        ICache cache = cacheMgr.getCache( cacheName );
        cache.removeAll();
    }
View Full Code Here

            {
                return null;
            }
        }

        ICache auxCache;
        String auxName;
        while ( st.hasMoreTokens() )
        {
            auxName = st.nextToken().trim();
            if ( auxName == null || auxName.equals( "," ) )
            {
                continue;
            }
            log.debug( "Parsing auxiliary named \"" + auxName + "\"." );

            auxCache = parseAuxiliary( props, auxName, regName );
            if ( auxCache != null )
            {
                auxList.add( auxCache );
            }
        }

        ICache[] auxCaches = ( ICache[] ) auxList.toArray( new ICache[0] );

        // GET COMPOSITECACHEATTRIBUTES
        if ( cca == null )
        {
            cca = parseCompositeCacheAttributes( props, regName, regionPrefix );
        }

        IElementAttributes ea = parseElementAttributes( props, regName, regionPrefix );


        ICache cache = null;
        if ( regionPrefix.equals( SYSTEM_REGION_PREFIX ) )
        {
            //cache = ccMgr.createSystemCache( regName, auxCaches, cca, new ElementAttributes() );
            cache = ccMgr.createSystemCache( regName, auxCaches, cca, ea );
        }
View Full Code Here

    /** Get an aux cache for the listed aux for a region. */
    protected ICache parseAuxiliary( Properties props,
                                     String auxName,
                                     String regName )
    {
        ICache auxCache;

        // GET FACTORY
        IAuxiliaryCacheFactory auxFac = ccMgr.registryFacGet( auxName );
        if ( auxFac == null )
        {
View Full Code Here

TOP

Related Classes of org.apache.stratum.jcs.engine.behavior.ICache

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.