Package org.apache.jcs.engine

Examples of org.apache.jcs.engine.CacheElement


            while ( notDone )
            {
                System.out.println( "enter mesage:" );
                message = br.readLine();
                CacheElement ce = new CacheElement( "test", "test", message );
                LateralElementDescriptor led = new LateralElementDescriptor( ce );
                sender.send( led );
            }
        }
        catch ( Exception e )
View Full Code Here


    }

    private CacheElement readElement( Serializable key )
        throws Exception
    {
        CacheElement object = null;

        IndexedDiskElementDescriptor ded =
            ( IndexedDiskElementDescriptor ) keyHash.get( key );

        if ( ded != null )
View Full Code Here

            while ( itr.hasNext() )
            {
                Serializable key = ( Serializable ) itr.next();

                CacheElement tempDe = ( CacheElement ) readElement( key );
                try
                {
                    IndexedDiskElementDescriptor de =
                        dataFileTemp.appendObject( tempDe );
View Full Code Here

        // NOT GROUP RELATED
        try
        {
            //updateCaches( key, val, attr );
            CacheElement ce = new CacheElement( this.getCacheName(), key, val );
            ce.setElementAttributes( attr );
            super.update( ce );

        }
        catch ( IOException ioe )
        {
View Full Code Here

        try
        {
            // must make sure you call the sure here
            // updateCaches( key, val, attrE, ICache.INCLUDE_REMOTE_CACHE );
            // problem super calls back up and the last instruction gets confused
            CacheElement ce = new CacheElement( this.getCacheName(), key, val );
            ce.setElementAttributes( attrE );
            super.update( ce );
        }
        catch ( IOException ioe )
        {
        }
View Full Code Here

        try
        {

            // update the attribute.
            //updateCaches(key, val, attrE, INCLUDE_REMOTE_CACHE);
            CacheElement ce = new CacheElement( this.getCacheName(), key, val );
            ce.setElementAttributes( attrE );

            if ( log.isDebugEnabled() )
            {
                log.debug( "putGAN( gan,val,attr,boolean invocation) > updating group attribute via super" );
            }

            super.update( ce, localOnly );

            // UPDATE THE ATTRIBUTENAME LIST, get it first
            GroupId groupId = key.groupId;
            HashSet attrNameSet = null;
            attrNameSet = (HashSet)systemGroupIdCache.get(groupId.toString());

            if ( attrNameSet == null )
            {
                attrNameSet = new HashSet();
            }
            attrNameSet.add( key.attrName );

            if ( log.isDebugEnabled() )
            {
                log.debug( "putGAN( gan,val,attr,boolean invocation) > attrNameSet.size()  = " + attrNameSet.size() );
            }

            CacheElement ceID = new CacheElement( this.getCacheName(), groupId, attrNameSet );
            ceID.setElementAttributes( attrE );

            // DO NOT SEND THE UPDATE LIST REMOTELY
            // THE ELEMENT WILL BE SENT AND THE LIST MAINTAINED REMOTELY

            systemGroupIdCache.localUpdate( ceID );
View Full Code Here

        {
            throw new CacheException( "createGroup(group,attr) > group " + group + " already exists " );
        }
        try
        {
            CacheElement ceID = new CacheElement( this.getCacheName(), groupId, attrNameSet );
            ceID.setElementAttributes( attrE );
            //updateCaches(groupId.key, attrNameSet, attrE );
            //super.update( ceID, EXCLUDE_REMOTE_CACHE );
            systemGroupIdCache.localUpdate( ceID );

        }
View Full Code Here

        // update the attribute name set.
        // Note: necessary to use super.get to avoid read lock within the current write lock.
        GroupId groupId = key.groupId;
        HashSet attrNameSet = null;
        CacheElement ce = null;

        if ( invocation )
        {
            // Invocation is NOT local
            ce = ( CacheElement ) systemGroupIdCache.localGet( groupId.toString() );
        }
        else
        {
            // Invocation is local
            ce = ( CacheElement ) systemGroupIdCache.get( groupId.toString() );
        }

        // IF THE NAME SET IS FOUND
        // TODO: move -- INITIAL INSERTION IS CURRENTLY DONE BY THE PUT
        if ( ce != null )
        {
            attrNameSet = ( HashSet ) ce.val;

            // HANDLE NON REMOVAL SCENARIOS
            if ( attrNameSet != null || !remove )
            {
                // THE GROUP HAS BEEN CREATED BUT NOTHING IS IN IT
                if ( attrNameSet == null )
                {
                    attrNameSet = new HashSet();
                }

                if ( remove )
                {
                    attrNameSet.remove( key.attrName );
                }
                else
                {
                    attrNameSet.add( key.attrName );
                }

                if ( attrNameSet.size() > 0 )
                {
                    // update the changed name set.
                    try
                    {

                        CacheElement ceID
                            = new CacheElement( this.getCacheName(),
                                                groupId,
                                                attrNameSet );

                        ceID.setElementAttributes( ce.attr );
                        if ( log.isDebugEnabled() )
                        {
                            log.debug( "updateGroupAttrNameSet((groupAttrname)key,invocation,remove) > calling systemGroupIdCache.update( ceID, EXCLUDE_REMOTE_CACHE )" );
                        }
                        // ALWAYS EXCLUDE THE REMOTE CACHE
View Full Code Here

     * @return The elementAttributes value
     */
    public IElementAttributes getElementAttributes( Serializable key )
        throws CacheException, IOException
    {
        CacheElement ce = ( CacheElement ) get( key );
        if ( ce == null )
        {
            throw new ObjectNotFoundException( "key " + key + " is not found" );
        }
        return ce.getElementAttributes();
    }
View Full Code Here

        // Create the element and update. This may throw an IOException which
        // should be wrapped by cache access.

        try
        {
            CacheElement ce = new CacheElement( cacheControl.getCacheName(),
                              (Serializable) key,
                              (Serializable) val );

            ce.setElementAttributes( attr );

            cacheControl.update( ce );
        }
        catch ( Exception e )
        {
View Full Code Here

TOP

Related Classes of org.apache.jcs.engine.CacheElement

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.