internal static MemberAttributeConfig BuildMemberAttributesForCore(MemberId myself, Config config) { MemberAttributeConfig memberAttributeConfig = new MemberAttributeConfig(); memberAttributeConfig.setStringAttribute(MEMBER_UUID, myself.Uuid.ToString()); AdvertisedSocketAddress discoveryAddress = config.Get(CausalClusteringSettings.discovery_advertised_address); memberAttributeConfig.setStringAttribute(DISCOVERY_SERVER, discoveryAddress.ToString()); AdvertisedSocketAddress transactionSource = config.Get(CausalClusteringSettings.transaction_advertised_address); memberAttributeConfig.setStringAttribute(TRANSACTION_SERVER, transactionSource.ToString()); AdvertisedSocketAddress raftAddress = config.Get(CausalClusteringSettings.raft_advertised_address); memberAttributeConfig.setStringAttribute(RAFT_SERVER, raftAddress.ToString()); ClientConnectorAddresses clientConnectorAddresses = ClientConnectorAddresses.ExtractFromConfig(config); memberAttributeConfig.setStringAttribute(CLIENT_CONNECTOR_ADDRESSES, clientConnectorAddresses.ToString()); memberAttributeConfig.setBooleanAttribute(REFUSE_TO_BE_LEADER_KEY, config.Get(refuse_to_be_leader)); memberAttributeConfig.setStringAttribute(MEMBER_DB_NAME, config.Get(CausalClusteringSettings.database)); return(memberAttributeConfig); }
public virtual ClusterMember GetMemberByBoltAddress(AdvertisedSocketAddress advertisedSocketAddress) { foreach (CoreClusterMember member in _coreMembers.Values) { if (member.BoltAdvertisedAddress().Equals(advertisedSocketAddress.ToString())) { return(member); } } foreach (ReadReplica member in _readReplicas.Values) { if (member.BoltAdvertisedAddress().Equals(advertisedSocketAddress.ToString())) { return(member); } } throw new Exception("Could not find a member for bolt address " + advertisedSocketAddress); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldApplyTransform() public virtual void ShouldApplyTransform() { // given AdvertisedSocketAddress input1 = new AdvertisedSocketAddress("foo.bar", 123); AdvertisedSocketAddress output1 = new AdvertisedSocketAddress("a.b", 3); Config config = Config.builder().withSetting(initial_discovery_members, input1.ToString()).build(); when(_hostnameResolver.resolve(input1)).thenReturn(singletonList(output1)); InitialDiscoveryMembersResolver hostnameResolvingInitialDiscoveryMembersResolver = new InitialDiscoveryMembersResolver(_hostnameResolver, config); // when ICollection <string> result = hostnameResolvingInitialDiscoveryMembersResolver.Resolve(address => address.ToString().ToUpper()); // then assertThat(result, containsInAnyOrder(output1.ToString().ToUpper())); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void keepReadReplicaAlive() throws HazelcastInstanceNotActiveException private void KeepReadReplicaAlive() { _hzInstance.perform(hazelcastInstance => { string hzId = hazelcastInstance.LocalEndpoint.Uuid; string addresses = _connectorAddresses.ToString(); _log.debug("Adding read replica into cluster (%s -> %s)", hzId, addresses); hazelcastInstance.getMap(READ_REPLICAS_DB_NAME_MAP).put(hzId, _dbName, _timeToLive, MILLISECONDS); hazelcastInstance.getMap(READ_REPLICA_TRANSACTION_SERVER_ADDRESS_MAP).put(hzId, _transactionSource.ToString(), _timeToLive, MILLISECONDS); hazelcastInstance.getMap(READ_REPLICA_MEMBER_ID_MAP).put(hzId, _myself.Uuid.ToString(), _timeToLive, MILLISECONDS); refreshGroups(hazelcastInstance, hzId, _groups); // this needs to be last as when we read from it in HazelcastClusterTopology.readReplicas // we assume that all the other maps have been populated if an entry exists in this one hazelcastInstance.getMap(READ_REPLICA_BOLT_ADDRESS_MAP).put(hzId, addresses, _timeToLive, MILLISECONDS); }); }