Basic locking strategy for Console/Winform applications
コード例 #1
0
ファイル: LockingIndex.cs プロジェクト: ilya-g/TextIndexing
        public LockingIndex(StringComparison wordComparison, [NotNull] LockingStrategy locking)
        {
            if (locking == null)
            {
                throw new ArgumentNullException("locking");
            }

            this.wordComparer = new StringComparisonComparer(wordComparison);
            this.wordIndex    = new SortedList <string, ISet <DocumentInfo> >(wordComparer);
            this.allDocuments = new HashSet <DocumentInfo>();
            this.locking      = locking;
        }
コード例 #2
0
        public static ILockStrategy Create(LockingStrategy strategy)
        {
            switch (strategy)
            {
                case LockingStrategy.ReaderWriter:

                    return new ReaderWriterLockStrategy();
                case LockingStrategy.Exclusive:

                    return new ExclusiveLockStrategy();
                default:

                    throw new ArgumentOutOfRangeException();
            }
        }
コード例 #3
0
        public static ILockStrategy Create(LockingStrategy strategy)
        {
            switch (strategy)
            {
            case LockingStrategy.ReaderWriter:

                return(new ReaderWriterLockStrategy());

            case LockingStrategy.Exclusive:

                return(new ExclusiveLockStrategy());

            default:

                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #4
0
 public SharedDictionary(LockingStrategy strategy) : this(LockingStrategyFactory.Create(strategy))
 {
 }
コード例 #5
0
 // Locking
 public static FrameworkConfigurator SetLockingStrategy(this FrameworkConfigurator configurator, LockingStrategy lockingStrategy)
 {
     throw new NotSupportedException("Not yet supported.");
     return(configurator);
 }
コード例 #6
0
ファイル: SharedList.cs プロジェクト: yog-it/Dnn.Platform
 /// <summary>
 /// Initializes a new instance of the <see cref="SharedList{T}"/> class.
 /// </summary>
 /// <param name="strategy">The locking strategy to use.</param>
 public SharedList(LockingStrategy strategy)
     : this(LockingStrategyFactory.Create(strategy))
 {
 }
コード例 #7
0
    /**
 * @param  strategy  Ticket cleanup locking strategy.  An exclusive locking
 * strategy is preferable if not required for some ticket backing stores,
 * such as JPA, in a clustered CAS environment.  Use {@link JdbcLockingStrategy}
 * for {@link org.jasig.cas.ticket.registry.JpaTicketRegistry} in a clustered
 * CAS environment.
 */
    public void setLock(LockingStrategy strategy)
    {
        this._lock = strategy;
    }
コード例 #8
0
 /**
  * @param  strategy  Ticket cleanup locking strategy.  An exclusive locking
  * strategy is preferable if not required for some ticket backing stores,
  * such as JPA, in a clustered CAS environment.  Use {@link JdbcLockingStrategy}
  * for {@link org.jasig.cas.ticket.registry.JpaTicketRegistry} in a clustered
  * CAS environment.
  */
 public void setLock(LockingStrategy strategy)
 {
     this._lock = strategy;
 }