Coverage report

  %line %branch
org.apache.jcs.engine.CacheEventQueueFactory
88% 
100% 

 1  
 package org.apache.jcs.engine;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.commons.logging.Log;
 23  
 import org.apache.commons.logging.LogFactory;
 24  
 import org.apache.jcs.engine.behavior.ICacheEventQueue;
 25  
 import org.apache.jcs.engine.behavior.ICacheListener;
 26  
 
 27  
 /**
 28  
  * This class hands out event Queues. This allows us to change the
 29  
  * implementation more easily.
 30  
  * <p>
 31  
  * @author aaronsm
 32  
  */
 33  687
 public class CacheEventQueueFactory
 34  
 {
 35  
 
 36  332
     private static final Log log = LogFactory.getLog( CacheEventQueueFactory.class );
 37  
 
 38  
     /**
 39  
      * The most commonly used factory method.
 40  
      * <p>
 41  
      * @param listener
 42  
      * @param listenerId
 43  
      * @param cacheName
 44  
      * @param threadPoolName
 45  
      * @param poolType
 46  
      * @return
 47  
      */
 48  
     public ICacheEventQueue createCacheEventQueue( ICacheListener listener, long listenerId, String cacheName,
 49  
                                                   String threadPoolName, int poolType )
 50  
     {
 51  687
         return createCacheEventQueue( listener, listenerId, cacheName, 10, 500, threadPoolName, poolType );
 52  
     }
 53  
 
 54  
     /**
 55  
      * Fully configured event queue.
 56  
      * <p>
 57  
      * @param listener
 58  
      * @param listenerId
 59  
      * @param cacheName
 60  
      * @param maxFailure
 61  
      * @param waitBeforeRetry
 62  
      * @param threadPoolName
 63  
      *            null is ok, if not a pooled event queue this is ignored
 64  
      * @param poolType
 65  
      *            single or pooled
 66  
      * @return
 67  
      */
 68  
     public ICacheEventQueue createCacheEventQueue( ICacheListener listener, long listenerId, String cacheName,
 69  
                                                   int maxFailure, class="keyword">int waitBeforeRetry, String threadPoolName,
 70  
                                                   int poolType )
 71  
     {
 72  687
         if ( log.isDebugEnabled() )
 73  
         {
 74  0
             log.debug( "threadPoolName = [" + threadPoolName + "] poolType = " + poolType + " " );
 75  
         }
 76  
 
 77  687
         if ( poolType == ICacheEventQueue.SINGLE_QUEUE_TYPE )
 78  
         {
 79  645
             return new CacheEventQueue( listener, listenerId, cacheName, maxFailure, waitBeforeRetry );
 80  
         }
 81  
         else
 82  
         {
 83  42
             return new PooledCacheEventQueue( listener, listenerId, cacheName, maxFailure, waitBeforeRetry,
 84  
                                               threadPoolName );
 85  
         }
 86  
     }
 87  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.