Example #1
0
        /// <summary>Constructor</summary>
        /// <param name="cacheName">name to identify the cache by</param>
        /// <param name="percentage">percentage of total java heap space used by this cache</param>
        /// <param name="expirationTime">time for an entry to expire in nanoseconds</param>
        public RetryCache(string cacheName, double percentage, long expirationTime)
        {
            int capacity = LightWeightGSet.ComputeCapacity(percentage, cacheName);

            capacity = capacity > 16 ? capacity : 16;
            this.set = new LightWeightCache <RetryCache.CacheEntry, RetryCache.CacheEntry>(capacity
                                                                                           , capacity, expirationTime, 0);
            this.expirationTime    = expirationTime;
            this.cacheName         = cacheName;
            this.retryCacheMetrics = RetryCacheMetrics.Create(this);
        }
Example #2
0
        internal static Org.Apache.Hadoop.Hdfs.Server.Namenode.INodeMap NewInstance(INodeDirectory
                                                                                    rootDir)
        {
            // Compute the map capacity by allocating 1% of total memory
            int capacity = LightWeightGSet.ComputeCapacity(1, "INodeMap");
            GSet <INode, INodeWithAdditionalFields> map = new LightWeightGSet <INode, INodeWithAdditionalFields
                                                                               >(capacity);

            map.Put(rootDir);
            return(new Org.Apache.Hadoop.Hdfs.Server.Namenode.INodeMap(map));
        }