本文整理汇总了C#中Lucene.Net.Store.LockFactory类的典型用法代码示例。如果您正苦于以下问题:C# LockFactory类的具体用法?C# LockFactory怎么用?C# LockFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LockFactory类属于Lucene.Net.Store命名空间,在下文中一共展示了LockFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyingLockFactory
/// <param name="id">should be a unique id across all clients
/// </param>
/// <param name="lf">the LockFactory that we are testing
/// </param>
/// <param name="host">host or IP where {@link LockVerifyServer}
/// is running
/// </param>
/// <param name="port">the port {@link LockVerifyServer} is
/// listening on
/// </param>
public VerifyingLockFactory(sbyte id, LockFactory lf, System.String host, int port)
{
this.id = id;
this.lf = lf;
this.host = host;
this.port = port;
}
示例2: LocalTempStorageDirectory
public LocalTempStorageDirectory(
DirectoryInfo tempStorageDir,
FSDirectory realDirectory)
{
if (tempStorageDir == null) throw new ArgumentNullException("tempStorageDir");
if (realDirectory == null) throw new ArgumentNullException("realDirectory");
_tempStorageDir = new SimpleFSDirectory(tempStorageDir);
_realDirectory = realDirectory;
_lockFactory = new MultiIndexLockFactory(_realDirectory, _tempStorageDir);
Enabled = true;
}
示例3: SimpleFSDirectory
public SimpleFSDirectory(System.IO.FileInfo path, LockFactory lockFactory):base(new System.IO.DirectoryInfo(path.FullName), lockFactory)
{
}
示例4: MMapDirectory
/// <summary>Create a new MMapDirectory for the named location.
///
/// </summary>
/// <param name="path">the path of the directory
/// </param>
/// <param name="lockFactory">the lock factory to use, or null for the default.
/// </param>
/// <throws> IOException </throws>
public MMapDirectory(System.IO.DirectoryInfo path, LockFactory lockFactory) : base(path, lockFactory)
{
InitBlock();
}
示例5: SetLockFactory
/// <summary> Set the LockFactory that this Directory instance should
/// use for its locking implementation. Each * instance of
/// LockFactory should only be used for one directory (ie,
/// do not share a single instance across multiple
/// Directories).
///
/// </summary>
/// <param name="lockFactory">instance of <see cref="LockFactory" />.
/// </param>
public virtual void SetLockFactory(LockFactory lockFactory)
{
System.Diagnostics.Debug.Assert(lockFactory != null);
this.interalLockFactory = lockFactory;
lockFactory.LockPrefix = this.GetLockId();
}
示例6: MMapDirectory
/// <summary>
/// Create a new MMapDirectory for the named location, specifying the
/// maximum chunk size used for memory mapping.
/// </summary>
/// <param name="path"> the path of the directory </param>
/// <param name="lockFactory"> the lock factory to use, or null for the default
/// (<seealso cref="NativeFSLockFactory"/>); </param>
/// <param name="maxChunkSize"> maximum chunk size (default is 1 GiBytes for
/// 64 bit JVMs and 256 MiBytes for 32 bit JVMs) used for memory mapping.
/// <p>
/// Especially on 32 bit platform, the address space can be very fragmented,
/// so large index files cannot be mapped. Using a lower chunk size makes
/// the directory implementation a little bit slower (as the correct chunk
/// may be resolved on lots of seeks) but the chance is higher that mmap
/// does not fail. On 64 bit Java platforms, this parameter should always
/// be {@code 1 << 30}, as the address space is big enough.
/// <p>
/// <b>Please note:</b> The chunk size is always rounded down to a power of 2. </param>
/// <exception cref="System.IO.IOException"> if there is a low-level I/O error </exception>
public MMapDirectory(DirectoryInfo path, LockFactory lockFactory, int maxChunkSize)
: base(path, lockFactory)
{
if (maxChunkSize <= 0)
{
throw new System.ArgumentException("Maximum chunk size for mmap must be >0");
}
this.ChunkSizePower = 31 - Number.NumberOfLeadingZeros(maxChunkSize);
Debug.Assert(this.ChunkSizePower >= 0 && this.ChunkSizePower <= 30);
}
示例7: Open
/// <summary>Just like {@link #Open(File)}, but allows you to
/// also specify a custom {@link LockFactory}.
/// </summary>
public static FSDirectory Open(System.IO.DirectoryInfo path, LockFactory lockFactory)
{
/* For testing:
MMapDirectory dir=new MMapDirectory(path, lockFactory);
dir.setUseUnmap(true);
return dir;
*/
if (Constants.WINDOWS)
{
return new SimpleFSDirectory(path, lockFactory);
}
else
{ //LINUX Issue: NIOFSDirectory implementation in lucene.NET is buggy on Mono (Linux)
//Workaround: use SimpleFSDirectory instead
//return new NIOFSDirectory(path, lockFactory);
return new SimpleFSDirectory(path, lockFactory);
}
}
示例8: GetDirectory
public static FSDirectory GetDirectory(System.IO.FileInfo file, LockFactory lockFactory)
{
return GetDirectory(new System.IO.DirectoryInfo(file.FullName), lockFactory);
}
示例9: FSDirectory
// permit subclassing
/// <summary>Create a new FSDirectory for the named location (ctor for subclasses).</summary>
/// <param name="path">the path of the directory
/// </param>
/// <param name="lockFactory">the lock factory to use, or null for the default
/// ({@link NativeFSLockFactory});
/// </param>
/// <throws> IOException </throws>
protected internal FSDirectory(System.IO.FileInfo path, LockFactory lockFactory)
{
path = GetCanonicalPath(path);
// new ctors use always NativeFSLockFactory as default:
if (lockFactory == null)
{
lockFactory = new NativeFSLockFactory();
}
Init(path, lockFactory);
refCount = 1;
}
示例10: SimpleFSDirectory
/// <summary>
/// Create a new SimpleFSDirectory for the named location.
/// </summary>
/// <param name="path"> the path of the directory </param>
/// <param name="lockFactory"> the lock factory to use, or null for the default
/// (<seealso cref="NativeFSLockFactory"/>); </param>
/// <exception cref="System.IO.IOException"> if there is a low-level I/O error </exception>
public SimpleFSDirectory(DirectoryInfo path, LockFactory lockFactory)
: base(path, lockFactory)
{
}
示例11: MMapDirectory
/// <summary>Create a new MMapDirectory for the named location.
///
/// </summary>
/// <param name="path">the path of the directory
/// </param>
/// <param name="lockFactory">the lock factory to use, or null for the default.
/// </param>
/// <throws> IOException </throws>
public MMapDirectory(System.IO.DirectoryInfo path, LockFactory lockFactory) : base(path, lockFactory)
{
throw new System.NotImplementedException("Use FSDirectory (https://issues.apache.org/jira/browse/LUCENENET-425)");
}
示例12: NIOFSDirectory
public NIOFSDirectory(System.IO.DirectoryInfo dir, LockFactory lockFactory)
: base(dir, lockFactory)
{
throw new System.NotImplementedException("Waiting for volunteers to implement this class");
}
示例13: FSDirectory
/// <summary>
/// Create a new FSDirectory for the named location (ctor for subclasses). </summary>
/// <param name="path"> the path of the directory </param>
/// <param name="lockFactory"> the lock factory to use, or null for the default
/// (<seealso cref="NativeFSLockFactory"/>); </param>
/// <exception cref="System.IO.IOException"> if there is a low-level I/O error </exception>
protected internal FSDirectory(DirectoryInfo path, LockFactory lockFactory)
{
// new ctors use always NativeFSLockFactory as default:
if (lockFactory == null)
{
lockFactory = new NativeFSLockFactory();
}
directory = GetCanonicalPath(path);
if (File.Exists(path.FullName))
{
throw new NoSuchDirectoryException("file '" + path.FullName + "' exists but is not a directory"); //should be NoSuchDirectoryException
}
LockFactory = lockFactory;
}
示例14: _testStressLocks
public virtual void _testStressLocks(LockFactory lockFactory, System.IO.FileInfo indexDir)
{
FSDirectory fs1 = FSDirectory.Open(new System.IO.DirectoryInfo(indexDir.FullName), lockFactory);
// First create a 1 doc index:
IndexWriter w = new IndexWriter(fs1, new WhitespaceAnalyzer(), true, IndexWriter.MaxFieldLength.LIMITED);
AddDoc(w);
w.Close();
WriterThread writer = new WriterThread(this, 100, fs1);
SearcherThread searcher = new SearcherThread(this, 100, fs1);
writer.Start();
searcher.Start();
while (writer.IsAlive || searcher.IsAlive)
{
System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 1000));
}
Assert.IsTrue(!writer.hitException, "IndexWriter hit unexpected exceptions");
Assert.IsTrue(!searcher.hitException, "IndexSearcher hit unexpected exceptions");
// Cleanup
_TestUtil.RmDir(indexDir);
}
示例15: VerifyingLockFactory
/// <param name="lf"> the LockFactory that we are testing </param>
/// <param name="in"> the socket's input to <seealso cref="LockVerifyServer"/> </param>
/// <param name="out"> the socket's output to <seealso cref="LockVerifyServer"/> </param>
public VerifyingLockFactory(LockFactory lf, Stream @in, Stream @out)
{
this.Lf = lf;
[email protected] = @in;
[email protected] = @out;
}