Basic locking strategy for Console/Winform applications
Ejemplo 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;
        }
Ejemplo n.º 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();
            }
        }
Ejemplo 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();
            }
        }
Ejemplo n.º 4
0
 public SharedDictionary(LockingStrategy strategy) : this(LockingStrategyFactory.Create(strategy))
 {
 }
Ejemplo n.º 5
0
 // Locking
 public static FrameworkConfigurator SetLockingStrategy(this FrameworkConfigurator configurator, LockingStrategy lockingStrategy)
 {
     throw new NotSupportedException("Not yet supported.");
     return(configurator);
 }
Ejemplo 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;
 }