• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Store.LockFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Lucene.Net.Store.LockFactory的典型用法代码示例。如果您正苦于以下问题:C# LockFactory类的具体用法?C# LockFactory怎么用?C# LockFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LockFactory类属于Lucene.Net.Store命名空间,在下文中一共展示了LockFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
 }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:17,代码来源:VerifyingLockFactory.cs


示例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;
        }
开发者ID:drpeck,项目名称:Merchello,代码行数:13,代码来源:LocalTempStorageDirectory.cs


示例3: SimpleFSDirectory

		public SimpleFSDirectory(System.IO.FileInfo path, LockFactory lockFactory):base(new System.IO.DirectoryInfo(path.FullName), lockFactory)
		{
		}
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:3,代码来源:SimpleFSDirectory.cs


示例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();
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:12,代码来源:MMapDirectory.cs


示例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();
		}
开发者ID:modulexcite,项目名称:Xamarin-Lucene.Net,代码行数:15,代码来源:Directory.cs


示例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);
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:29,代码来源:MMapDirectory.cs


示例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);
            }
        }
开发者ID:kipropesque,项目名称:RuralCafe,代码行数:22,代码来源:FSDirectory.cs


示例8: GetDirectory

 public static FSDirectory GetDirectory(System.IO.FileInfo file, LockFactory lockFactory)
 {
     return GetDirectory(new System.IO.DirectoryInfo(file.FullName), lockFactory);
 }
开发者ID:kipropesque,项目名称:RuralCafe,代码行数:4,代码来源:FSDirectory.cs


示例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;
 }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:19,代码来源:FSDirectory.cs


示例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)
 {
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:11,代码来源:SimpleFSDirectory.cs


示例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)");
 }
开发者ID:kstenson,项目名称:NHibernate.Search,代码行数:12,代码来源:MMapDirectory.cs


示例12: NIOFSDirectory

 public NIOFSDirectory(System.IO.DirectoryInfo dir, LockFactory lockFactory)
     : base(dir, lockFactory)
 {
     throw new System.NotImplementedException("Waiting for volunteers to implement this class");
 }
开发者ID:Nangal,项目名称:lucene.net,代码行数:5,代码来源:NIOFSDirectory.cs


示例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;
        }
开发者ID:paulirwin,项目名称:lucene.net,代码行数:22,代码来源:FSDirectory.cs


示例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);
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:25,代码来源:TestLockFactory.cs


示例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;
 }
开发者ID:Cefa68000,项目名称:lucenenet,代码行数:9,代码来源:VerifyingLockFactory.cs


示例16: 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.DirectoryInfo path, LockFactory lockFactory)
 {
     // new ctors use always NativeFSLockFactory as default:
     if (lockFactory == null)
     {
         lockFactory = new NativeFSLockFactory();
     }
     Init(path, lockFactory);
     refCount = 1;
 }
开发者ID:kipropesque,项目名称:RuralCafe,代码行数:18,代码来源:FSDirectory.cs


示例17: Open

        /// <summary>Just like {@link #Open(File)}, but allows you to
        /// also specify a custom {@link LockFactory}. 
        /// </summary>
        public static FSDirectory Open(System.IO.FileInfo 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
            {
                return new NIOFSDirectory(path, lockFactory);
            }
        }
开发者ID:BackupTheBerlios,项目名称:lyra2-svn,代码行数:20,代码来源:FSDirectory.cs


示例18: _testStressLocks

        public virtual void _testStressLocks(LockFactory lockFactory, DirectoryInfo indexDir)
        {
            Directory dir = NewFSDirectory(indexDir, lockFactory);

            // First create a 1 doc index:
            IndexWriter w = new IndexWriter(dir, (new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))).SetOpenMode(IndexWriterConfig.OpenMode_e.CREATE));
            AddDoc(w);
            w.Dispose();

            WriterThread writer = new WriterThread(this, 100, dir);
            SearcherThread searcher = new SearcherThread(this, 100, dir);
            writer.Start();
            searcher.Start();

            while (writer.IsAlive || searcher.IsAlive)
            {
                Thread.Sleep(1000);
            }

            Assert.IsTrue(!writer.HitException, "IndexWriter hit unexpected exceptions");
            Assert.IsTrue(!searcher.HitException, "IndexSearcher hit unexpected exceptions");

            dir.Dispose();
            // Cleanup
            System.IO.Directory.Delete(indexDir.FullName, true);
        }
开发者ID:joyanta,项目名称:lucene.net,代码行数:26,代码来源:TestLockFactory.cs


示例19: Init

        /* will move to ctor, when reflection is removed in 3.0 */
        private void Init(System.IO.DirectoryInfo path, LockFactory lockFactory)
        {
            // Set up lockFactory with cascaded defaults: if an instance was passed in,
            // use that; else if locks are disabled, use NoLockFactory; else if the
            // system property Lucene.Net.Store.FSDirectoryLockFactoryClass is set,
            // instantiate that; else, use SimpleFSLockFactory:

            directory = path;

            // due to differences in how Java & .NET refer to files, the checks are a bit different
            if (!directory.Exists && System.IO.File.Exists(directory.FullName))
            {
                throw new NoSuchDirectoryException("file '" + directory.FullName + "' exists but is not a directory");
            }

            if (lockFactory == null)
            {

                if (disableLocks)
                {
                    // Locks are disabled:
                    lockFactory = NoLockFactory.GetNoLockFactory();
                }
                else
                {
                    System.String lockClassName = SupportClass.AppSettings.Get("Lucene.Net.Store.FSDirectoryLockFactoryClass", "");

                    if (lockClassName != null && !lockClassName.Equals(""))
                    {
                        System.Type c;

                        try
                        {
                            c = System.Type.GetType(lockClassName);
                        }
                        catch (System.Exception e)
                        {
                            throw new System.IO.IOException("unable to find LockClass " + lockClassName);
                        }

                        try
                        {
                            lockFactory = (LockFactory) System.Activator.CreateInstance(c, true);
                        }
                        catch (System.UnauthorizedAccessException e)
                        {
                            throw new System.IO.IOException("IllegalAccessException when instantiating LockClass " + lockClassName);
                        }
                        catch (System.InvalidCastException e)
                        {
                            throw new System.IO.IOException("unable to cast LockClass " + lockClassName + " instance to a LockFactory");
                        }
                        catch (System.Exception e)
                        {
                            throw new System.IO.IOException("InstantiationException when instantiating LockClass " + lockClassName);
                        }
                    }
                    else
                    {
                        // Our default lock is SimpleFSLockFactory;
                        // default lockDir is our index directory:
                        lockFactory = new SimpleFSLockFactory();
                    }
                }
            }

            SetLockFactory(lockFactory);

            // for filesystem based LockFactory, delete the lockPrefix, if the locks are placed
            // in index dir. If no index dir is given, set ourselves
            if (lockFactory is FSLockFactory)
            {
                FSLockFactory lf = (FSLockFactory) lockFactory;
                System.IO.DirectoryInfo dir = lf.GetLockDir();
                // if the lock factory has no lockDir set, use the this directory as lockDir
                if (dir == null)
                {
                    lf.SetLockDir(this.directory);
                    lf.SetLockPrefix(null);
                }
                else if (dir.FullName.Equals(this.directory.FullName))
                {
                    lf.SetLockPrefix(null);
                }
            }
        }
开发者ID:kipropesque,项目名称:RuralCafe,代码行数:87,代码来源:FSDirectory.cs


示例20: 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
        /// (<see cref="NativeFSLockFactory" />);
        /// </param>
        /// <throws>  IOException </throws>
        protected internal FSDirectory(System.IO.DirectoryInfo path, LockFactory lockFactory)
        {
            // new ctors use always NativeFSLockFactory as default:
            if (lockFactory == null)
            {
                lockFactory = new NativeFSLockFactory();
            }
            // Set up lockFactory with cascaded defaults: if an instance was passed in,
            // use that; else if locks are disabled, use NoLockFactory; else if the
            // system property Lucene.Net.Store.FSDirectoryLockFactoryClass is set,
            // instantiate that; else, use SimpleFSLockFactory:

            internalDirectory = path;

            // due to differences in how Java & .NET refer to files, the checks are a bit different
            if (!internalDirectory.Exists && System.IO.File.Exists(internalDirectory.FullName))
            {
                throw new NoSuchDirectoryException("file '" + internalDirectory.FullName + "' exists but is not a directory");
            }
            SetLockFactory(lockFactory);
            
            // for filesystem based LockFactory, delete the lockPrefix, if the locks are placed
            // in index dir. If no index dir is given, set ourselves
            if (lockFactory is FSLockFactory)
            {
                FSLockFactory lf = (FSLockFactory)lockFactory;
                System.IO.DirectoryInfo dir = lf.LockDir;
                // if the lock factory has no lockDir set, use the this directory as lockDir
                if (dir == null)
                {
                    lf.LockDir = this.internalDirectory;
                    lf.LockPrefix = null;
                }
                else if (dir.FullName.Equals(this.internalDirectory.FullName))
                {
                    lf.LockPrefix = null;
                }
            }
        }
开发者ID:Nangal,项目名称:lucene.net,代码行数:46,代码来源:FSDirectory.cs



注:本文中的Lucene.Net.Store.LockFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Store.RAMDirectory类代码示例发布时间:2022-05-26
下一篇:
C# Store.IndexInput类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap