示例#1
0
        private NativeBlockStream GetStream(int idx, FileAccess access)
        {
            HpcLinqFileStream fileStream = null;

            string[] pathAlternatives = this.m_srcList[idx];

            for (int i = 0; i < pathAlternatives.Length; i++)
            {
                bool   bLastIter  = (i == pathAlternatives.Length - 1);
                string curSrcPath = pathAlternatives[i];
                try
                {
                    fileStream = new HpcLinqFileStream(curSrcPath, access, this.m_compressionScheme);
                }
                catch (Exception exp)
                {
                    // if we have more path alternatives to try we will continue,
                    // otherwise we'll propagate the exception from this last attempt
                    if (bLastIter)
                    {
                        // if we caught the HpcLinqException thrown by HpcLinqFileStream.Initialize,
                        // we want to propagate its inner exception (which contains the actual IO error)
                        // otherwise we'll attach the exception we caught as is
                        Exception innerException = exp is DryadLinqException ? innerException = exp.InnerException : exp;
                        throw new DryadLinqException(HpcLinqErrorCode.MultiBlockCannotAccesFilePath,
                                                     String.Format(SR.MultiBlockCannotAccesFilePath,
                                                                   curSrcPath, m_associatedDscStreamName),
                                                     innerException);
                    }
                }

                // if the attempt to initialize an HpcLinqFileStream with this path succeeded we'll return the object
                if (fileStream != null)
                {
                    break;
                }
            }

            return(fileStream);
        }
示例#2
0
        private NativeBlockStream GetStream(int idx, FileAccess access)
        {
            HpcLinqFileStream fileStream = null;
            string[] pathAlternatives = this.m_srcList[idx];

            for (int i = 0; i < pathAlternatives.Length; i++)
            {
                bool bLastIter = (i == pathAlternatives.Length - 1);
                string curSrcPath = pathAlternatives[i];
                try
                {
                    fileStream = new HpcLinqFileStream(curSrcPath, access, this.m_compressionScheme);
                }
                catch(Exception exp)
                {

                    // if we have more path alternatives to try we will continue,
                    // otherwise we'll propagate the exception from this last attempt
                    if (bLastIter)
                    {
                        // if we caught the HpcLinqException thrown by HpcLinqFileStream.Initialize,
                        // we want to propagate its inner exception (which contains the actual IO error)
                        // otherwise we'll attach the exception we caught as is
                        Exception innerException = exp is DryadLinqException ? innerException = exp.InnerException : exp;
                        throw new DryadLinqException(HpcLinqErrorCode.MultiBlockCannotAccesFilePath,
                                                   String.Format(SR.MultiBlockCannotAccesFilePath,
                                                                 curSrcPath, m_associatedDscStreamName),
                                                   innerException);
                    }
                }

                // if the attempt to initialize an HpcLinqFileStream with this path succeeded we'll return the object
                if (fileStream != null) break;
            }

            return fileStream;
        }