示例#1
0
        private bool CanBeBootstrapped(SharedDiscoveryCoreClient client)
        {
            Stream <SharedDiscoveryCoreClient> clientsWhoCanLeadForMyDb = _listeningClients.Where(c => !c.refusesToBeLeader() && c.localDBName().Equals(client.LocalDBName()));

            Optional <SharedDiscoveryCoreClient> firstAppropriateClient = clientsWhoCanLeadForMyDb.findFirst();

            return(firstAppropriateClient.map(c => c.Equals(client)).orElse(false));
        }
示例#2
0
        internal CoreTopology GetCoreTopology(SharedDiscoveryCoreClient client)
        {
            //Extract config from client
            string dbName            = client.LocalDBName();
            bool   canBeBootstrapped = canBeBootstrapped(client);

            return(GetCoreTopology(dbName, canBeBootstrapped));
        }
示例#3
0
 internal void UnRegisterCoreMember(SharedDiscoveryCoreClient client)
 {
     lock (this)
     {
         _listeningClients.Remove(client);
         _coreMembers.remove(client.MemberId);
     }
     NotifyCoreClients();
 }
示例#4
0
        internal void RegisterCoreMember(SharedDiscoveryCoreClient client)
        {
            CoreServerInfo previousMember = _coreMembers.putIfAbsent(client.MemberId, client.CoreServerInfo);

            if (previousMember == null)
            {
                _listeningClients.Add(client);
                _enoughMembers.Signal();
                NotifyCoreClients();
            }
        }