Beispiel #1
0
 /// <summary>
 /// Release a lock from the global pool. </summary>
 private void ReleaseGlobalLock(ConcurrentMap <long, ForsetiLockManager.Lock> lockMap, long resourceId)
 {
     ForsetiLockManager.Lock @lock = lockMap.get(resourceId);
     if (@lock is ExclusiveLock)
     {
         lockMap.remove(resourceId);
     }
     else if (@lock is SharedLock && (( SharedLock )@lock).Release(this))
     {
         // We were the last to hold this lock, it is now dead and we should remove it.
         // Also cleaning updater reference that can hold lock in memory
         (( SharedLock )@lock).CleanUpdateHolder();
         lockMap.remove(resourceId);
     }
 }
Beispiel #2
0
        public virtual void put(K key, V value)
        {
            if (key == default(K) || value == default(V))
            {
                throw new System.NullReferenceException();
            }

            V previousValue = cache.put(key, value);

            if (previousValue != default(V))
            {
                keys.remove(key);
            }
            keys.add(key);

            if (cache.size() > capacity)
            {
                K lruKey = keys.poll();
                if (lruKey != default(K))
                {
                    cache.remove(lruKey);

                    // remove duplicated keys
                    this.removeAll(lruKey);

                    // queue may not contain any key of a possibly concurrently added entry of the same key in the cache
                    if (cache.containsKey(lruKey))
                    {
                        keys.add(lruKey);
                    }
                }
            }
        }
Beispiel #3
0
 internal void UnRegisterCoreMember(SharedDiscoveryCoreClient client)
 {
     lock (this)
     {
         _listeningClients.Remove(client);
         _coreMembers.remove(client.MemberId);
     }
     NotifyCoreClients();
 }
Beispiel #4
0
 protected internal override void Dispose(ForsetiClient resource)
 {
     base.Dispose(resource);
     ClientsById.remove(resource.Id());
     if (resource.Id() < 1024)
     {
         // Re-use all ids < 1024
         UnusedIds.AddLast(resource.Id());
     }
 }
Beispiel #5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, Object evt) throws Exception
        public override void UserEventTriggered(ChannelHandlerContext ctx, object evt)
        {
            if (evt is Org.Neo4j.causalclustering.protocol.handshake.ServerHandshakeFinishedEvent_Created)
            {
                Org.Neo4j.causalclustering.protocol.handshake.ServerHandshakeFinishedEvent_Created created = (Org.Neo4j.causalclustering.protocol.handshake.ServerHandshakeFinishedEvent_Created)evt;
                _installedProtocols.put(created.AdvertisedSocketAddress, created.ProtocolStack);
            }
            else if (evt is Org.Neo4j.causalclustering.protocol.handshake.ServerHandshakeFinishedEvent_Closed)
            {
                Org.Neo4j.causalclustering.protocol.handshake.ServerHandshakeFinishedEvent_Closed closed = (Org.Neo4j.causalclustering.protocol.handshake.ServerHandshakeFinishedEvent_Closed)evt;
                _installedProtocols.remove(closed.AdvertisedSocketAddress);
            }
            else
            {
                base.UserEventTriggered(ctx, evt);
            }
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.kernel.api.index.IndexAccessor getOnlineAccessor(org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor, org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig samplingConfig) throws java.io.IOException
        public override IndexAccessor GetOnlineAccessor(StoreIndexDescriptor descriptor, IndexSamplingConfig samplingConfig)
        {
            PartitionedIndexStorage indexStorage = GetIndexStorage(descriptor.Id);

            FulltextIndexDescriptor fulltextIndexDescriptor = readOrInitialiseDescriptor(descriptor, _defaultAnalyzerName, _tokenHolders.propertyKeyTokens(), indexStorage.IndexFolder, _fileSystem);
            FulltextIndexBuilder    fulltextIndexBuilder    = FulltextIndexBuilder.Create(fulltextIndexDescriptor, _config, _tokenHolders.propertyKeyTokens()).withFileSystem(_fileSystem).withOperationalMode(_operationalMode).withIndexStorage(indexStorage).withPopulatingMode(false);

            if (fulltextIndexDescriptor.EventuallyConsistent)
            {
                fulltextIndexBuilder = fulltextIndexBuilder.WithIndexUpdateSink(_indexUpdateSink);
            }
            DatabaseFulltextIndex fulltextIndex = fulltextIndexBuilder.Build();

            fulltextIndex.open();

            ThreadStart           onClose  = () => _openOnlineAccessors.remove(descriptor);
            FulltextIndexAccessor accessor = new FulltextIndexAccessor(_indexUpdateSink, fulltextIndex, fulltextIndexDescriptor, onClose);

            _openOnlineAccessors.put(descriptor, accessor);
            _log.debug("Created online accessor for fulltext schema index %s: %s", descriptor, accessor);
            return(accessor);
        }
Beispiel #7
0
 private void End0(KEY key, VALUE value)
 {
     _repo.remove(key);
     _reaper.accept(value);
 }
Beispiel #8
0
 internal void UnRegisterReadReplica(SharedDiscoveryReadReplicaClient client)
 {
     _readReplicas.remove(client.MemberId);
     NotifyCoreClients();
 }