Ejemplo n.º 1
0
 internal virtual void OnCoreTopologyChange(CoreTopology coreTopology)
 {
     Log.info("Notified of core topology change " + coreTopology);
     this._coreTopology      = coreTopology;
     this._localCoreTopology = coreTopology.FilterTopologyByDb(_localDBName);
     ListenerService.notifyListeners(coreTopology);
 }
Ejemplo n.º 2
0
 public override void OnCoreTopologyChange(CoreTopology coreTopology)
 {
     lock (this)
     {
         ISet <MemberId> targetMembers = coreTopology.Members().Keys;
         _raftMachine.TargetMembershipSet = targetMembers;
     }
 }
Ejemplo n.º 3
0
        public virtual void NotifyListeners(CoreTopology coreTopology)
        {
            foreach (CoreTopologyService_Listener listener in _listeners)
            {
                string dbName = listener.DbName();

                listener.OnCoreTopologyChange(coreTopology.FilterTopologyByDb(dbName));
            }
        }
Ejemplo n.º 4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void start0() throws InterruptedException
        public override void Start0()
        {
            _coreTopology             = _sharedDiscoveryService.getCoreTopology(this);
            _localCoreTopology        = _coreTopology.filterTopologyByDb(_localDBName);
            _readReplicaTopology      = _sharedDiscoveryService.ReadReplicaTopology;
            _localReadReplicaTopology = _readReplicaTopology.filterTopologyByDb(_localDBName);

            _sharedDiscoveryService.registerCoreMember(this);
            Log.info("Registered core server %s", MyselfConflict);

            _sharedDiscoveryService.waitForClusterFormation();
            Log.info("Cluster formed");
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Caches the topology so that the lookups are fast.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void refreshTopology() throws HazelcastInstanceNotActiveException
        private void RefreshTopology()
        {
            CoreTopology newCoreTopology = _hzInstance.apply(hz => getCoreTopology(hz, _config, _log));

            _coreTopology      = newCoreTopology;
            _localCoreTopology = newCoreTopology.FilterTopologyByDb(_dbName);

            ReadReplicaTopology newReadReplicaTopology = _hzInstance.apply(hz => getReadReplicaTopology(hz, _log));

            _readReplicaTopology      = newReadReplicaTopology;
            _localReadReplicaTopology = newReadReplicaTopology.FilterTopologyByDb(_dbName);

            _catchupAddressMap = extractCatchupAddressesMap(LocalCoreServers(), LocalReadReplicas());
        }
Ejemplo n.º 6
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }
            CoreTopology that = ( CoreTopology )o;

            return(Objects.Equals(_coreMembers, that._coreMembers));
        }
Ejemplo n.º 7
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void refreshCoreTopology() throws InterruptedException
        private void RefreshCoreTopology()
        {
            WaitOnHazelcastInstanceCreation();

            CoreTopology       newCoreTopology = getCoreTopology(_hazelcastInstance, Config, Log);
            TopologyDifference difference      = _coreTopology.difference(newCoreTopology);

            _coreTopology      = newCoreTopology;
            _localCoreTopology = newCoreTopology.FilterTopologyByDb(_localDBName);

            if (difference.HasChanges())
            {
                Log.info("Core topology changed %s", difference);
                ListenerService.notifyListeners(_coreTopology);
            }
        }
Ejemplo n.º 8
0
 public ClusterTopology(CoreTopology coreTopology, ReadReplicaTopology readReplicaTopology)
 {
     this._coreTopology        = coreTopology;
     this._readReplicaTopology = readReplicaTopology;
 }
Ejemplo n.º 9
0
        public static IDictionary <MemberId, AdvertisedSocketAddress> ExtractCatchupAddressesMap(CoreTopology coreTopology, ReadReplicaTopology rrTopology)
        {
            IDictionary <MemberId, AdvertisedSocketAddress> catchupAddressMap = new Dictionary <MemberId, AdvertisedSocketAddress>();

            foreach (KeyValuePair <MemberId, CoreServerInfo> entry in coreTopology.Members().SetOfKeyValuePairs())
            {
                catchupAddressMap[entry.Key] = entry.Value.CatchupServer;
            }

            foreach (KeyValuePair <MemberId, ReadReplicaInfo> entry in rrTopology.Members().SetOfKeyValuePairs())
            {
                catchupAddressMap[entry.Key] = entry.Value.CatchupServer;
            }

            return(catchupAddressMap);
        }