Examples of ICache


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

                primayDefined = true;

                failovers.add( rca.getRemoteHost() + ":" + rca.getRemotePort() );

                RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca );
                ICache ic = rcm.getCache( rca );
                if ( ic != null )
                {
                    noWaits.add( ic );
                }
                else
                {
                    //p( "noWait is null" );
                }
            }

            // GET HANDLE BUT DONT REGISTER A LISTENER FOR FAILOVERS
            String failoverList = rca.getFailoverServers();
            if ( failoverList != null )
            {
                StringTokenizer fit = new StringTokenizer( failoverList, "," );
                int fCnt = 0;
                while ( fit.hasMoreElements() )
                {
                    fCnt++;

                    String server = ( String ) fit.nextElement();
                    failovers.add( server );

                    rca.setRemoteHost( server.substring( 0, server.indexOf( ":" ) ) );
                    rca.setRemotePort( Integer.parseInt( server.substring( server.indexOf( ":" ) + 1 ) ) );
                    RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca );
                    // add a listener if there are none, need to tell rca what number it is at
                    if ( ( !primayDefined && fCnt == 1 ) || noWaits.size() <= 0 )
                    {
                        ICache ic = rcm.getCache( rca );
                        if ( ic != null )
                        {
                            noWaits.add( ic );
                        }
                        else
                        {
                            //p( "noWait is null" );
                        }
                    }
                }
                // end while
            }
            // end if failoverList != null

            rca.setFailovers( ( String[] ) failovers.toArray( new String[0] ) );

            // if CLUSTER
        }
        else
            if ( rca.getRemoteType() == rca.CLUSTER )
        {

            // REGISTER LISTENERS FOR EACH SYSTEM CLUSTERED CACHEs
            StringTokenizer it = new StringTokenizer( rca.getClusterServers(), "," );
            while ( it.hasMoreElements() )
            {
                //String server = (String)it.next();
                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 ) ) );
                RemoteCacheManager rcm = RemoteCacheManager.getInstance( rca );
                rca.setRemoteType( rca.CLUSTER );
                ICache ic = rcm.getCache( rca );
                if ( ic != null )
                {
                    noWaits.add( ic );
                }
                else
View Full Code Here

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

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

            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

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

            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

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

    /** 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

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

    {
        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

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

        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

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

            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

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

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

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

            {
                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
TOP
Copyright © 2018 www.massapi.com. 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.