asmuts      02/01/18 13:53:47

  Modified:    src/java/org/apache/stratum/jcs/auxiliary/lateral
                        LateralCacheNoWaitFacade.java
                        LateralCacheManager.java
                        LateralCacheAttributes.java LateralCache.java
  Log:
  put in some rough safe guards against blocking on reads.
  
  Allowed for get operations in the TCP Lateral cache, can an easy way
  to turn off this functionality in the configuration files.  You can specify
  that putOnlyMode=true.
  
  Revision  Changes    Path
  1.5       +1 -0      
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
  
  Index: LateralCacheNoWaitFacade.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LateralCacheNoWaitFacade.java     18 Jan 2002 06:45:27 -0000      1.4
  +++ LateralCacheNoWaitFacade.java     18 Jan 2002 21:53:47 -0000      1.5
  @@ -171,6 +171,7 @@
               }
               catch ( Exception ex )
               {
  +                log.error( ex );
                   p( "Failed to get." );
               }
               return null;
  
  
  
  1.4       +1 -1      
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/LateralCacheManager.java
  
  Index: LateralCacheManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/LateralCacheManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LateralCacheManager.java  15 Jan 2002 21:33:30 -0000      1.3
  +++ LateralCacheManager.java  18 Jan 2002 21:53:47 -0000      1.4
  @@ -251,7 +251,7 @@
               c = ( LateralCacheNoWait ) caches.get( cacheName );
               if ( c == null )
               {
  -                c = new LateralCacheNoWait( new LateralCache( cacheName, 
lateralService ) );
  +                c = new LateralCacheNoWait( new LateralCache( lca, lateralService ) 
);
                   caches.put( cacheName, c );
               }
           }
  
  
  
  1.4       +28 -3     
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/LateralCacheAttributes.java
  
  Index: LateralCacheAttributes.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/LateralCacheAttributes.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LateralCacheAttributes.java       15 Jan 2002 21:33:30 -0000      1.3
  +++ LateralCacheAttributes.java       18 Jan 2002 21:53:47 -0000      1.4
  @@ -43,6 +43,7 @@
       private String cacheName;
       private String name;
   
  +    boolean putOnlyMode = true;
   
       /////////////////////////////////////////
       /**
  @@ -314,12 +315,34 @@
           this.name = name;
       }
   
  +    /////////////////////////////////////////
  +    /**
  +     *  Sets the outgoingOnlyMode attribute of the ILateralCacheAttributes. When
  +     *  this is true the lateral cache will only issue put and remove order and
  +     *  will not try to retrieve elements from other lateral caches.
  +     *
  +     *@param  val  The new transmissionTypeName value
  +     */
  +    public void setPutOnlyMode( boolean val )
  +    {
  +        this.putOnlyMode = val;
  +    }
  +
  +
  +    /**
  +     *@return    The outgoingOnlyMode value. Stops gets from going remote.
  +     */
  +    public boolean getPutOnlyMode()
  +    {
  +        return putOnlyMode;
  +    }
  +
   
       /////////////////////////////////////////////////
       /**
  -     *  Description of the Method
  +     *  Returns a clone of the attributes.
        *
  -     *@return    Description of the Return Value
  +     *@return    Self
        */
       public IAuxiliaryCacheAttributes copy()
       {
  @@ -328,7 +351,8 @@
               return ( IAuxiliaryCacheAttributes ) this.clone();
           }
           catch ( Exception e )
  -        {}
  +        {
  +        }
           return ( IAuxiliaryCacheAttributes ) this;
       }
   
  @@ -343,6 +367,7 @@
       {
           StringBuffer buf = new StringBuffer();
           buf.append( "cacheName=" + cacheName + "\n" );
  +        buf.append( "putOnlyMode=" + putOnlyMode + "\n" );
           buf.append( "transmissionTypeName=" + transmissionTypeName + "\n" );
           buf.append( "transmissionType=" + transmissionType + "\n" );
           buf.append( "tcpServer=" + tcpServer + "\n" );
  
  
  
  1.6       +35 -19    
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/LateralCache.java
  
  Index: LateralCache.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/lateral/LateralCache.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LateralCache.java 18 Jan 2002 06:45:27 -0000      1.5
  +++ LateralCache.java 18 Jan 2002 21:53:47 -0000      1.6
  @@ -68,12 +68,14 @@
       /**
        *  Constructor for the LateralCache object
        *
  -     *@param  cacheName  Description of the Parameter
        *@param  lateral    Description of the Parameter
  +     *@param  cattr      Description of the Parameter
        */
  -    protected LateralCache( String cacheName, ILateralCacheService lateral )
  +    protected LateralCache( ILateralCacheAttributes cattr, ILateralCacheService 
lateral )
       {
  -        this.cacheName = cacheName;
  +
  +        this.cacheName = cattr.getCacheName();
  +        this.cattr = cattr;
           this.lateral = lateral;
           log = LoggerManager.getLogger( this );
   
  @@ -190,7 +192,7 @@
       // end update
   
       /**
  -     *  Return null. The performace costs are too great. Can implement later.
  +     *  Returns null. The performace costs are too great.
        *
        *@param  key              Description of the Parameter
        *@return                  Description of the Return Value
  @@ -200,8 +202,15 @@
           throws IOException
       {
           //p( "get(key)" );
  -        //return get( key, true );
  -        return null;
  +        if ( cattr.getPutOnlyMode() )
  +        {
  +            //p( "put only mode" );
  +            return null;
  +        }
  +        else
  +        {
  +            return get( key, true );
  +        }
       }
   
   
  @@ -216,19 +225,26 @@
       public Serializable get( Serializable key, boolean container )
           throws IOException
       {
  -        return null;
  -//        //p( "get(key,container)" );
  -//        Serializable obj = null;
  -//        try
  -//        {
  -//            obj = lateral.get( cacheName, key, container );
  -//        }
  -//        catch ( Exception e )
  -//        {
  -//            log.error( e );
  -//            // do something with this
  -//        }
  -//        return obj;
  +        //p( "get(key,container)" );
  +        Serializable obj = null;
  +        if ( cattr.getPutOnlyMode() )
  +        {
  +            //p( "put only mode" );
  +            return null;
  +        }
  +        else
  +        {
  +            try
  +            {
  +                obj = lateral.get( cacheName, key, container );
  +            }
  +            catch ( Exception e )
  +            {
  +                log.error( e );
  +                // do something with this
  +            }
  +        }
  +        return obj;
       }
   
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to