예제 #1
0
        public ThreadSafeInterceptor(ILock theLock, Predicate <MethodInfo> methodIncluder, ILockController lockController)
        {
            if (theLock == null)
            {
                throw new ArgumentNullException("theLock");
            }

            if (methodIncluder == null)
            {
                throw new ArgumentNullException("methodIncluder");
            }

            if (lockController == null)
            {
                throw new ArgumentNullException("lockController");
            }

            if (!lockController.CanControl(theLock))
            {
                throw new ArgumentException(ExceptionMessages.LockNotSupportedByLockController, "lockController");
            }

            _lock           = theLock;
            _lockController = lockController;
            _methodIncluder = methodIncluder;
        }
        public ThreadSafeInterceptor(ILock theLock, Predicate<MethodInfo> methodIncluder, ILockController lockController)
        {
            if (theLock == null)
            {
                throw new ArgumentNullException("theLock");
            }

            if (methodIncluder == null)
            {
                throw new ArgumentNullException("methodIncluder");
            }

            if (lockController == null)
            {
                throw new ArgumentNullException("lockController");
            }

            if (!lockController.CanControl(theLock))
            {
                throw new ArgumentException(ExceptionMessages.LockNotSupportedByLockController, "lockController");
            }

            _lock = theLock;
            _lockController = lockController;
            _methodIncluder = methodIncluder;
        }
예제 #3
0
 public bool CanControl(ILock theLock)
 {
     return(CanControlWithoutChaining(theLock) || (_next != null && _next.CanControl(theLock)));
 }