Basic locking strategy for Console/Winform applications
Esempio n. 1
0
        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;
        }
        public static ILockStrategy Create(LockingStrategy strategy)
        {
            switch (strategy)
            {
                case LockingStrategy.ReaderWriter:

                    return new ReaderWriterLockStrategy();
                case LockingStrategy.Exclusive:

                    return new ExclusiveLockStrategy();
                default:

                    throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 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();
            }
        }
Esempio n. 4
0
 public SharedDictionary(LockingStrategy strategy) : this(LockingStrategyFactory.Create(strategy))
 {
 }
Esempio n. 5
0
 // Locking
 public static FrameworkConfigurator SetLockingStrategy(this FrameworkConfigurator configurator, LockingStrategy lockingStrategy)
 {
     throw new NotSupportedException("Not yet supported.");
     return(configurator);
 }
Esempio n. 6
0
 /// <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))
 {
 }
    /**
 * @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;
    }
 /**
  * @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;
 }