Esempio n. 1
0
        public CommunityLockClient(LockManagerImpl manager)
        {
            this._manager = manager;

            _readReleaser      = (key, lockResource) => manager.releaseReadLock(lockResource, _lockTransaction);
            _writeReleaser     = (key, lockResource) => manager.releaseWriteLock(lockResource, _lockTransaction);
            _typeReadReleaser  = value => value.forEachKeyValue(_readReleaser);
            _typeWriteReleaser = value => value.forEachKeyValue(_writeReleaser);
        }
Esempio n. 2
0
        public override void ReleaseShared(ResourceType resourceType, params long[] resourceIds)
        {
            _stateHolder.incrementActiveClients(this);
            try
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.map.primitive.MutableLongObjectMap<LockResource> localLocks = localShared(resourceType);
                MutableLongObjectMap <LockResource> localLocks = LocalShared(resourceType);
                foreach (long resourceId in resourceIds)
                {
                    LockResource resource = localLocks.get(resourceId);
                    if (resource.ReleaseReference() == 0)
                    {
                        localLocks.remove(resourceId);
                        _manager.releaseReadLock(new LockResource(resourceType, resourceId), _lockTransaction);
                    }
                }
            }
            finally
            {
                _stateHolder.decrementActiveClients();
            }
        }