Esempio n. 1
0
 /// <summary>
 /// Initializes the Value Queues for the provided keys by calling the
 /// fill Method with "numInitValues" values
 /// </summary>
 /// <param name="keyNames">Array of key Names</param>
 /// <exception cref="ExecutionException"/>
 public virtual void InitializeQueuesForKeys(params string[] keyNames)
 {
     foreach (string keyName in keyNames)
     {
         keyQueues.Get(keyName);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Obtains the file status, first by checking the stat cache if it is
 /// available, and then by getting it explicitly from the filesystem.
 /// </summary>
 /// <remarks>
 /// Obtains the file status, first by checking the stat cache if it is
 /// available, and then by getting it explicitly from the filesystem. If we got
 /// the file status from the filesystem, it is added to the stat cache.
 /// The stat cache is expected to be managed by callers who provided it to
 /// FSDownload.
 /// </remarks>
 /// <exception cref="System.IO.IOException"/>
 private static FileStatus GetFileStatus(FileSystem fs, Path path, LoadingCache <Path
                                                                                 , Future <FileStatus> > statCache)
 {
     // if the stat cache does not exist, simply query the filesystem
     if (statCache == null)
     {
         return(fs.GetFileStatus(path));
     }
     try
     {
         // get or load it from the cache
         return(statCache.Get(path).Get());
     }
     catch (ExecutionException e)
     {
         Exception cause = e.InnerException;
         // the underlying exception should normally be IOException
         if (cause is IOException)
         {
             throw (IOException)cause;
         }
         else
         {
             throw new IOException(cause);
         }
     }
     catch (Exception e)
     {
         // should not happen
         Sharpen.Thread.CurrentThread().Interrupt();
         throw new IOException(e);
     }
 }
Esempio n. 3
0
        /// <summary>Get the group memberships of a given user.</summary>
        /// <remarks>
        /// Get the group memberships of a given user.
        /// If the user's group is not cached, this method may block.
        /// </remarks>
        /// <param name="user">User's name</param>
        /// <returns>the group memberships of the user</returns>
        /// <exception cref="System.IO.IOException">if user does not exist</exception>
        public virtual IList <string> GetGroups(string user)
        {
            // No need to lookup for groups of static users
            IList <string> staticMapping = staticUserToGroupsMap[user];

            if (staticMapping != null)
            {
                return(staticMapping);
            }
            // Check the negative cache first
            if (IsNegativeCacheEnabled())
            {
                if (negativeCache.Contains(user))
                {
                    throw NoGroupsForUser(user);
                }
            }
            try
            {
                return(cache.Get(user));
            }
            catch (ExecutionException e)
            {
                throw (IOException)e.InnerException;
            }
        }
Esempio n. 4
0
        internal virtual DFSClient GetDfsClient(string userName)
        {
            DFSClient client = null;

            try
            {
                client = clientCache.Get(userName);
            }
            catch (ExecutionException e)
            {
                Log.Error("Failed to create DFSClient for user:"******" Cause:" + e);
            }
            return(client);
        }
Esempio n. 5
0
        internal virtual FSDataInputStream GetDfsInputStream(string userName, string inodePath
                                                             )
        {
            DFSClientCache.DFSInputStreamCaheKey k = new DFSClientCache.DFSInputStreamCaheKey
                                                         (userName, inodePath);
            FSDataInputStream s = null;

            try
            {
                s = inputstreamCache.Get(k);
            }
            catch (ExecutionException e)
            {
                Log.Warn("Failed to create DFSInputStream for user:"******" Cause:" + e);
            }
            return(s);
        }