Examples of ICache


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

        }

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

            if ( aux == null )
            {
                continue;
            }

            int cacheType = aux.getCacheType();

            // for now let laterals call remote remove but not vice versa

            if ( localOnly && ( cacheType == REMOTE_CACHE || cacheType == LATERAL_CACHE ) )
            {
                continue;
            }
            try
            {

                if ( log.isDebugEnabled() )
                {
                  log.debug( "Removing " + key + " from cacheType" + cacheType );
                }

                boolean b = aux.remove( key );

                // Don't take the remote removal into account.
                if ( !removed && cacheType != REMOTE_CACHE )
                {
                    removed = b;
View Full Code Here

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

        }

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

            int cacheType = aux.getCacheType();

            if ( aux != null
                 && ( cacheType == ICache.DISK_CACHE || ! localOnly ) )
            {
                try
                {
                    aux.removeAll();
                }
                catch ( IOException ex )
                {
                    log.error( "Failure removing all from aux", ex );
                }
View Full Code Here

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

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

                // Skip this auxilliary if:
                //   - The auxilliary is null
                //   - The auxilliary is not alive
                //   - The auxilliary is remote and the invocation was remote

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

                // If the auxilliary is not a lateral, or the cache attributes
                // have 'getUseLateral' set, all the elements currently in
                // memory are written to the lateral before disposing

                if ( aux.getCacheType() != ICacheType.LATERAL_CACHE
                     || this.cacheAttr.getUseLateral() )
                {
                    Iterator itr = memCache.getIterator();

                    while ( itr.hasNext() )
                    {
                        Map.Entry entry = ( Map.Entry ) itr.next();

                        ICacheElement ce = (ICacheElement) entry.getValue();
                        try
                        {
                            if ( aux.getCacheType() == ICacheType.LATERAL_CACHE
                                 && !ce.getElementAttributes().getIsLateral() )
                            {
                                continue;
                            }
                            aux.update( ce );
                        }
                        catch ( Exception e )
                        {
                            log.error( e );
                        }
                    }
                }

                // Only call the dispose method for disk auxilliaries

                // FIXME: Why not always call it?

                if ( aux.getCacheType() == ICache.DISK_CACHE )
                {
                    aux.dispose();
                }

            }
            catch ( IOException ex )
            {
View Full Code Here

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

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

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

                        Iterator itr = memCache.getIterator();

                        while ( itr.hasNext() )
                        {
                            Map.Entry entry = ( Map.Entry ) itr.next();

                            ICacheElement ce = (ICacheElement) entry.getValue();

                            aux.update(ce);
                        }
                    }
                }
                catch ( IOException ex )
                {
View Full Code Here

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

        String result = "";

        try
        {

            ICache cache = cacheMgr.getCache( cacheName );

            if ( key != null )
            {
                if ( key.toUpperCase().equals( "ALL" ) )
                {
                    cache.removeAll();

                    if ( log.isDebugEnabled() )
                    {
                        log.debug( "Removed all elements from " + cacheName );
                    }
                    result = "key = " + key;
                }
                else
                {
                    if ( log.isDebugEnabled() )
                    {
                        log.debug( "key = " + key );
                    }
                    result = "key = " + key;
                    StringTokenizer toke = new StringTokenizer( key, "_" );

                    while ( toke.hasMoreElements() )
                    {
                        String temp = ( String ) toke.nextElement();
                        cache.remove( key );

                        if ( log.isDebugEnabled() )
                        {
                            log.debug( "Removed " + temp + " from " + cacheName );
                        }
View Full Code Here

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

        {
            Hashtable ht = new Hashtable();
            String name = list[ i ];
            ht.put( "name", name );

            ICache cache = cacheMgr.getCache( name );
            int size = cache.getSize();
            ht.put( "size", Integer.toString( size ) );

            int status = cache.getStatus();
            String stat = status == CacheConstants.STATUS_ALIVE ? "ALIVE"
                : status == CacheConstants.STATUS_DISPOSED ? "DISPOSED"
                : status == CacheConstants.STATUS_ERROR ? "ERROR"
                : "UNKNOWN";
            ht.put( "stat", stat );
View Full Code Here

Examples of org.apache.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.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.jcs.engine.behavior.ICache

        ArrayList noWaits = new ArrayList();

        if ( lac.getTransmissionType() == lac.UDP )
        {
            LateralCacheManager lcm = LateralCacheManager.getInstance( lac );
            ICache ic = lcm.getCache( lac.getCacheName() );
            if ( ic != null )
            {
                noWaits.add( ic );
            }
        }
        else if ( lac.getTransmissionType() == lac.JAVAGROUPS )
        {
            LateralCacheManager lcm = LateralCacheManager.getInstance( lac );
            ICache ic = lcm.getCache( lac.getCacheName() );
            if ( ic != null )
            {
                noWaits.add( ic );
            }
        }
        else if ( lac.getTransmissionType() == lac.TCP )
        {

            //pars up the tcp servers and set the tcpServer value and
            // get the manager and then get the cache
            //Iterator it = lac.tcpServers.iterator();
            //while( it.hasNext() ) {

            StringTokenizer it = new StringTokenizer( lac.tcpServers, "," );
            while ( it.hasMoreElements() )
            {
                //String server = (String)it.next();
                String server = ( String ) it.nextElement();
                if ( log.isDebugEnabled() )
                {
                  log.debug( "tcp server = " +  server );
                }
                lac.setTcpServer( server );
                LateralCacheManager lcm = LateralCacheManager.getInstance( lac );
                ICache ic = lcm.getCache( lac.getCacheName() );
                if ( ic != null )
                {
                    noWaits.add( ic );
                }
                else
                {
                    //p( "noWait is null" );
                }
            }

        }
        else if ( lac.getTransmissionType() == lac.XMLRPC )
        {

            //pars up the tcp servers and set the tcpServer value and
            // get the manager and then get the cache
            //Iterator it = lac.tcpServers.iterator();
            //while( it.hasNext() ) {

            StringTokenizer it = new StringTokenizer( lac.getHttpServers(), "," );
            while ( it.hasMoreElements() )
            {
                //String server = (String)it.next();
                String server = ( String ) it.nextElement();
                //p( "tcp server = " +  server );
                lac.setHttpServer( server );
                LateralCacheManager lcm = LateralCacheManager.getInstance( lac );
                ICache ic = lcm.getCache( lac.getCacheName() );
                if ( ic != null )
                {
                    noWaits.add( ic );
                }
                else
                {
                    log.warn( "noWait is null" );
                }
            }

        }
        else if ( lac.getTransmissionType() == lac.HTTP )
        {
            StringTokenizer it = new StringTokenizer( lac.getHttpServers(), "," );
            while ( it.hasMoreElements() )
            {
                String server = ( String ) it.nextElement();
                lac.setHttpServer( server );
                LateralCacheManager lcm = LateralCacheManager.getInstance( lac );
                ICache ic = lcm.getCache( lac.getCacheName() );
                if ( ic != null )
                {
                    noWaits.add( ic );
                }
            }
View Full Code Here

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

                    Arrays.sort( list );

                    for ( int i = 0; i < list.length; i++ )
                    {
                        String name = list[i];
                        ICache cache = cacheMgr.getCache( name );
                        cache.removeAll();
                    }
                    out.println( "All caches have been cleared!" );
                }
                else
                {

                    ICache cache = cacheMgr.getCache( hashtableName );

                    String task = ( String ) params.get( "task" );
                    if ( task == null )
                    {
                        task = "delete";
                    }

                    if ( task.equalsIgnoreCase( "stats" ) )
                    {

//                        out.println( "<br><br>" );
//                        out.println( "<b>Stats for " + hashtableName + ":</b><br>" );
//                        out.println( cache.getStats() );
//                        out.println( "<br>" );

                    }
                    else
                    {

                        // Remove the specified cache.

                        if ( key != null )
                        {
                            if ( key.toUpperCase().equals( "ALL" ) )
                            {
                                cache.removeAll();

                                if ( log.isDebugEnabled() )
                                {
                                    log.debug( "Removed all elements from " + hashtableName );
                                }
                                out.println( "key = " + key );
                            }
                            else
                            {
                                if ( log.isDebugEnabled() )
                                {
                                    log.debug( "key = " + key );
                                }
                                out.println( "key = " + key );
                                StringTokenizer toke = new StringTokenizer( key, "_" );

                                while ( toke.hasMoreElements() )
                                {
                                    String temp = ( String ) toke.nextElement();
                                    cache.remove( key );

                                    if ( log.isDebugEnabled() )
                                    {
                                        log.debug( "Removed " + temp + " from " + hashtableName );
                                    }
                                }
                            }
                        }
                        else
                        {
                            out.println( "key is null" );
                        }

                    }
                    // end is task == delete

                }
            }
            else
            {
                out.println( "(No hashTableName specified.)" );
            }

            // PRINT OUT MENU
            out.println( "<br>" );
            int antiCacheRandom = ( int ) ( 10000.0 * Math.random() );
            out.println( "<a href=?antiCacheRandom=" + antiCacheRandom
                 + ">List all caches</a><br>" );
            out.println( "<br>" );
            out.println( "<a href=?hashtableName=ALL&key=ALL&antiCacheRandom="
                 + antiCacheRandom
                 + "><font color=RED>Clear All Cache Regions</font></a><br>" );
            out.println( "<br>" );
            String[] list = cacheMgr.getCacheNames();
            Arrays.sort( list );
            out.println( "<div align=CENTER>" );
            out.println( "<table border=1 width=80%>" );
            out.println( "<tr bgcolor=#eeeeee><td>Cache Region Name</td><td>Size</td><td>Status</td><td>Stats</td>" );
            for ( int i = 0; i < list.length; i++ )
            {
                String name = list[i];
                out.println( "<tr><td><a href=?hashtableName=" + name + "&key=ALL&antiCacheRandom="
                     + antiCacheRandom + ">" + name + "</a></td>" );
                ICache cache = cacheMgr.getCache( name );
                out.println( "<td>" );
                out.print( cache.getSize() );
                out.print( "</td><td>" );
                int status = cache.getStatus();
                out.print( status == CacheConstants.STATUS_ALIVE ? "ALIVE"
                     : status == CacheConstants.STATUS_DISPOSED ? "DISPOSED"
                     : status == CacheConstants.STATUS_ERROR ? "ERROR"
                     : "UNKNOWN" );
                out.print( "</td>" );
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.