Package org.apache.jcs.engine.behavior

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


     */
    private void handleElementEvents( ICacheElement cacheElement,
                                      int eventType )
        throws IOException
    {
        IElementAttributes attributes = cacheElement.getElementAttributes();

        ArrayList eventHandlers = attributes.getElementEventHandlers();

        if ( eventHandlers != null )
        {
            if ( log.isDebugEnabled() )
            {
View Full Code Here


//                            attrp.setIsRemote(true);

                            long n_start = System.currentTimeMillis();
                            for ( int n = 0; n < num; n++ )
                            {
                                IElementAttributes attrp = cache_control.getElementAttributes();
                                TestElementEventHandler hand = new TestElementEventHandler();
                                attrp.addElementEventHandler( hand );
                                cache_control.put( "key" + n,
                                    "data" + n + " put from ta = junk", attrp );
                            }
                            long n_end = System.currentTimeMillis();
                            p( "---put " + num + " in " + String.valueOf( n_end - n_start ) + " millis ---" );
                        }
                    }
                    else
                        if ( message.startsWith( "put" ) )
                    {

                        String key = null;
                        String val = null;
                        StringTokenizer toke = new StringTokenizer( message );
                        int tcnt = 0;
                        while ( toke.hasMoreElements() )
                        {
                            tcnt++;
                            String t = ( String ) toke.nextElement();
                            if ( tcnt == 2 )
                            {
                                key = t.trim();
                            }
                            else
                                if ( tcnt == 3 )
                            {
                                val = t.trim();
                            }
                        }

                        if ( tcnt < 3 )
                        {
                            p( "usage: put key val" );
                        }
                        else
                        {
//                            IElementAttributes attrp = new ElementAttributes();
//                            attrp.setIsLateral(true);
//                            attrp.setIsRemote(true);
                            long n_start = System.currentTimeMillis();
//                            cache_control.put( key, val, attrp.copy() );
                            cache_control.put( key, val );
                            long n_end = System.currentTimeMillis();
                            p( "---put " + key + " | " + val + " in " + String.valueOf( n_end - n_start ) + " millis ---" );
                        }
                    }
                    else
                        if ( message.startsWith( "remove" ) )
                    {
                        String key = message.substring( message.indexOf( " " ) + 1, message.length() );
                        cache_control.remove( key );
                        p( "removed " + key );
                    }
                    else
                        if ( message.startsWith( "deattr" ) )
                    {
                        IElementAttributes ae = cache_control.getElementAttributes( );
                        p( "Default IElementAttributes " + ae );
                    }
                    else
                        if ( message.startsWith( "cloneattr" ) )
                    {
                        String numS = message.substring( message.indexOf( " " ) + 1, message.length() );
                        int num = Integer.parseInt( numS.trim() );
                        if ( numS == null )
                        {
                            p( "usage: put numbertoput" );
                        }
                        else
                        {
                            IElementAttributes attrp = new ElementAttributes();
                            long n_start = System.currentTimeMillis();
                            for ( int n = 0; n < num; n++ )
                            {
                                attrp.copy();
                            }
                            long n_end = System.currentTimeMillis();
                            p( "---cloned attr " + num + " in " + String.valueOf( n_end - n_start ) + " millis ---" );
                        }
                    }
View Full Code Here

        {
            log.debug( "put(key,value) -- updating " + key + " via super method" );
        }

        //super.put(key, val);
        IElementAttributes attrE = ( IElementAttributes ) this.attr.copy();
        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
View Full Code Here

            {
                if ( log.isDebugEnabled() )
                {
                    log.debug( "update(ce,invocation) >putting via ga method" );
                }
                IElementAttributes attrE = ( IElementAttributes ) this.attr.copy();
                putGAN( ( GroupAttrName ) key, ce.getVal(), attrE, localOnly );
            }
            catch ( IOException ioe )
            {
            }
View Full Code Here

                                            + val + " must not be null." );
            log.error( ex );
            throw ex;
        }

        IElementAttributes attrE = ( IElementAttributes ) this.attr.copy();
        putGAN( key, val, attrE );
        return;
    }
View Full Code Here

     * @exception CacheException
     */
    public IElementAttributes getElementAttributes( Object name )
        throws CacheException
    {
        IElementAttributes attr = null;

        try
        {
            attr = cacheControl.getElementAttributes( ( Serializable ) name );
        }
View Full Code Here

    private BookVObjManager()
    {
        try
        {
            bookCache = JCS.getInstance("bookCache");
      IElementAttributes attributes = bookCache.getDefaultElementAttributes();

 
        }
        catch (Exception e)
        {
View Full Code Here

    {
        MyEventHandler meh = new MyEventHandler();

        JCS jcs = JCS.getInstance( "WithDisk" );
        // this should add the event handler to all items as they are created.
        IElementAttributes attributes = jcs.getDefaultElementAttributes();
        attributes.addElementEventHandler( meh );
        jcs.setDefaultElementAttributes( attributes );

        // put them in
        for ( int i = 0; i <= items; i++ )
        {
View Full Code Here

        JCS jcs = JCS.getInstance( "NoDisk" );

        MyEventHandler meh = new MyEventHandler();

        // this should add the event handler to all items as they are created.
        IElementAttributes attributes = jcs.getDefaultElementAttributes();
        attributes.addElementEventHandler( meh );
        jcs.setDefaultElementAttributes( attributes );

        // put them in
        for ( int i = 0; i <= items; i++ )
        {
View Full Code Here

    {
        MyEventHandler meh = new MyEventHandler();

        JCS jcs = JCS.getInstance( "DiskButNotAllowed" );
        // this should add the event handler to all items as they are created.
        IElementAttributes attributes = jcs.getDefaultElementAttributes();
        attributes.addElementEventHandler( meh );
        jcs.setDefaultElementAttributes( attributes );

        // put them in
        for ( int i = 0; i <= items; i++ )
        {
View Full Code Here

TOP

Related Classes of org.apache.jcs.engine.behavior.IElementAttributes

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.