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)); }
internal CoreTopology GetCoreTopology(SharedDiscoveryCoreClient client) { //Extract config from client string dbName = client.LocalDBName(); bool canBeBootstrapped = canBeBootstrapped(client); return(GetCoreTopology(dbName, canBeBootstrapped)); }
internal void UnRegisterCoreMember(SharedDiscoveryCoreClient client) { lock (this) { _listeningClients.Remove(client); _coreMembers.remove(client.MemberId); } NotifyCoreClients(); }
internal void RegisterCoreMember(SharedDiscoveryCoreClient client) { CoreServerInfo previousMember = _coreMembers.putIfAbsent(client.MemberId, client.CoreServerInfo); if (previousMember == null) { _listeningClients.Add(client); _enoughMembers.Signal(); NotifyCoreClients(); } }