예제 #1
0
 public override void AcquireShared(LockTracer tracer, ResourceType resourceType, params long[] resourceIds)
 {
     _stateHolder.incrementActiveClients(this);
     try
     {
         MutableLongObjectMap <LockResource> localLocks = LocalShared(resourceType);
         foreach (long resourceId in resourceIds)
         {
             LockResource resource = localLocks.get(resourceId);
             if (resource != null)
             {
                 resource.AcquireReference();
             }
             else
             {
                 resource = new LockResource(resourceType, resourceId);
                 if (_manager.getReadLock(tracer, resource, _lockTransaction))
                 {
                     localLocks.put(resourceId, resource);
                 }
                 else
                 {
                     throw new LockClientStoppedException(this);
                 }
             }
         }
     }
     finally
     {
         _stateHolder.decrementActiveClients();
     }
 }
예제 #2
0
        public override bool TrySharedLock(ResourceType resourceType, long resourceId)
        {
            _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);
                LockResource resource = localLocks.get(resourceId);
                if (resource != null)
                {
                    resource.AcquireReference();
                    return(true);
                }
                else
                {
                    resource = new LockResource(resourceType, resourceId);
                    if (_manager.tryReadLock(resource, _lockTransaction))
                    {
                        localLocks.put(resourceId, resource);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            finally
            {
                _stateHolder.decrementActiveClients();
            }
        }
예제 #3
0
 public override Value PropertyValue(int propertyKey)
 {
     if (_removedProperties != null && _removedProperties.contains(propertyKey))
     {
         return(Values.NO_VALUE);
     }
     if (_addedProperties != null)
     {
         Value addedValue = _addedProperties.get(propertyKey);
         if (addedValue != null)
         {
             return(addedValue);
         }
     }
     if (_changedProperties != null)
     {
         return(_changedProperties.get(propertyKey));
     }
     return(null);
 }
예제 #4
0
        public override void ReleaseExclusive(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 = localExclusive(resourceType);
                MutableLongObjectMap <LockResource> localLocks = LocalExclusive(resourceType);
                foreach (long resourceId in resourceIds)
                {
                    LockResource resource = localLocks.get(resourceId);
                    if (resource.ReleaseReference() == 0)
                    {
                        localLocks.remove(resourceId);
                        _manager.releaseWriteLock(new LockResource(resourceType, resourceId), _lockTransaction);
                    }
                }
            }
            finally
            {
                _stateHolder.decrementActiveClients();
            }
        }
예제 #5
0
 private Document FindDocument(long id)
 {
     return(_cachedDocuments.get(id));
 }
예제 #6
0
파일: IndexMap.cs 프로젝트: Neo4Net/Neo4Net
 public IndexProxy GetIndexProxy(long indexId)
 {
     return(_indexesById.get(indexId));
 }
예제 #7
0
 public virtual IndexAccessor AccessorFor(StoreIndexDescriptor indexRule)
 {
     return(_accessors.get(indexRule.Id));
 }