Return-Path: X-Original-To: apmail-lucenenet-commits-archive@www.apache.org Delivered-To: apmail-lucenenet-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E7EA31748E for ; Sat, 2 May 2015 17:37:23 +0000 (UTC) Received: (qmail 86893 invoked by uid 500); 2 May 2015 17:37:23 -0000 Delivered-To: apmail-lucenenet-commits-archive@lucenenet.apache.org Received: (qmail 86784 invoked by uid 500); 2 May 2015 17:37:23 -0000 Mailing-List: contact commits-help@lucenenet.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucene-net-dev@lucenenet.apache.org Delivered-To: mailing list commits@lucenenet.apache.org Received: (qmail 86695 invoked by uid 99); 2 May 2015 17:37:23 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 May 2015 17:37:23 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 876CFE17CB; Sat, 2 May 2015 17:37:23 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: synhershko@apache.org To: commits@lucenenet.apache.org Date: Sat, 02 May 2015 17:37:25 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/3] lucenenet git commit: use appropriate filestream share mode use appropriate filestream share mode Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/ef7a7ad8 Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/ef7a7ad8 Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/ef7a7ad8 Branch: refs/heads/master Commit: ef7a7ad88668ef87a880aed2d1f9e4bff6ccae21 Parents: ff6f242 Author: Laimonas Simutis Authored: Fri May 1 21:26:14 2015 -0400 Committer: Laimonas Simutis Committed: Fri May 1 21:26:14 2015 -0400 ---------------------------------------------------------------------- src/Lucene.Net.Core/Store/MMapDirectory.cs | 18 ++++++------------ src/Lucene.Net.Core/Store/NIOFSDirectory.cs | 4 ++-- 2 files changed, 8 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ef7a7ad8/src/Lucene.Net.Core/Store/MMapDirectory.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Store/MMapDirectory.cs b/src/Lucene.Net.Core/Store/MMapDirectory.cs index 2e2d8ab..b59ad88 100644 --- a/src/Lucene.Net.Core/Store/MMapDirectory.cs +++ b/src/Lucene.Net.Core/Store/MMapDirectory.cs @@ -198,23 +198,17 @@ namespace Lucene.Net.Store public override IndexInput OpenInput(string name, IOContext context) { EnsureOpen(); - FileInfo file = new FileInfo(Path.Combine(Directory.FullName, name)); + var file = new FileInfo(Path.Combine(Directory.FullName, name)); - FileStream c = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read); + var c = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); - return new MMapIndexInput(this, "MMapIndexInput(path=\"" + file.ToString() + "\")", c); + return new MMapIndexInput(this, "MMapIndexInput(path=\"" + file + "\")", c); } public override IndexInputSlicer CreateSlicer(string name, IOContext context) { - EnsureOpen(); - FileInfo file = new FileInfo(Path.Combine(Directory.FullName, name)); - - FileStream c = new FileStream(file.FullName, FileMode.Open, FileAccess.Read, FileShare.Read); - - var full = new MMapIndexInput(this, "MMapIndexInputSlicer(path=\"" + file.ToString() + "\")", c); + var full = (MMapIndexInput)OpenInput(name, context); - //MMapIndexInput full = (MMapIndexInput)OpenInput(name, context); return new IndexInputSlicerAnonymousInnerClassHelper(this, full); } @@ -222,9 +216,9 @@ namespace Lucene.Net.Store { private readonly MMapDirectory OuterInstance; - private Lucene.Net.Store.MMapDirectory.MMapIndexInput Full; + private MMapIndexInput Full; - public IndexInputSlicerAnonymousInnerClassHelper(MMapDirectory outerInstance, Lucene.Net.Store.MMapDirectory.MMapIndexInput full) + public IndexInputSlicerAnonymousInnerClassHelper(MMapDirectory outerInstance, MMapIndexInput full) : base(outerInstance) { this.OuterInstance = outerInstance; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ef7a7ad8/src/Lucene.Net.Core/Store/NIOFSDirectory.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs index 682c8a8..42fa5e6 100644 --- a/src/Lucene.Net.Core/Store/NIOFSDirectory.cs +++ b/src/Lucene.Net.Core/Store/NIOFSDirectory.cs @@ -80,7 +80,7 @@ namespace Lucene.Net.Store //File path = new File(Directory, name); FileInfo path = new FileInfo(Path.Combine(Directory.FullName, name)); //path.Create(); - FileStream fc = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.Read);//FileChannel.open(path.toPath(), StandardOpenOption.READ); + FileStream fc = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);//FileChannel.open(path.toPath(), StandardOpenOption.READ); return new NIOFSIndexInput("NIOFSIndexInput(path=\"" + path + "\")", fc, context); //return new NIOFSIndexInput(new FileInfo(Path.Combine(Directory.FullName, name)), context, ReadChunkSize); } @@ -91,7 +91,7 @@ namespace Lucene.Net.Store //File path = new File(Directory, name); //FileStream descriptor = FileChannel.open(path.toPath(), StandardOpenOption.READ); FileInfo path = new FileInfo(Path.Combine(Directory.FullName, name)); - FileStream fc = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.Read); + FileStream fc = new FileStream(path.FullName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); return new IndexInputSlicerAnonymousInnerClassHelper(this, context, path, fc); }