private Guid AddMembershipListenerWithoutInit(IMembershipListener listener) { var id = Guid.NewGuid(); _listeners.TryAdd(id, listener); return(id); }
private string AddMembershipListenerWithoutInit(IMembershipListener listener) { var id = Guid.NewGuid().ToString(); _listeners[id] = listener; return(id); }
public string AddMembershipListener(IMembershipListener listener) { if (listener == null) { throw new ArgumentNullException("listener"); } lock (_initialMembershipListenerMutex) { var id = AddMembershipListenerWithoutInit(listener); InitMembershipListener(listener); return(id); } }
public string AddMembershipListener(IMembershipListener listener) { if (listener == null) { throw new ArgumentNullException("listener"); } var id = Guid.NewGuid().ToString(); _listeners[id] = listener; if (listener is IInitialMembershipListener) { // TODO: needs sync with membership events... var cluster = _client.GetCluster(); ((IInitialMembershipListener)listener).Init(new InitialMembershipEvent(cluster, cluster.GetMembers())); } return(id); }
private void InitMembershipListener(IMembershipListener listener) { if (listener is IInitialMembershipListener) { var cluster = _client.GetCluster(); var memberCollection = _membersRef.Get().Values; if (memberCollection.Count == 0) { //if members are empty,it means initial event did not arrive yet //it will be redirected to listeners when it arrives see #handleInitialMembershipEvent return; } var members = new HashSet <IMember>(memberCollection); var @event = new InitialMembershipEvent(cluster, members); ((IInitialMembershipListener)listener).Init(@event); } }
public Guid AddMembershipListener(IMembershipListener listener) { CheckNotNull(listener, NullListenerIsNotAllowed); lock (_clusterViewLock) { var id = AddMembershipListenerWithoutInit(listener); if (listener is IInitialMembershipListener) { var cluster = ((IHazelcastInstance)_client).Cluster; var members = Members; //if members are empty,it means initial event did not arrive yet //it will be redirected to listeners when it arrives see #handleInitialMembershipEvent if (members.Count != 0) { var @event = new InitialMembershipEvent(cluster, members); ((IInitialMembershipListener)listener).Init(@event); } } return(id); } }
public virtual string AddMembershipListener(IMembershipListener listener) { return(_clusterService.AddMembershipListener(listener)); }
Guid ICluster.AddMembershipListener(IMembershipListener listener) { return(AddMembershipListener(listener)); }
private void AddMembershipListenerWithoutInit(IMembershipListener listener) { var id = Guid.NewGuid().ToString(); _listeners[id] = listener; }
public virtual string AddMembershipListener(IMembershipListener listener) { return _clusterService.AddMembershipListener(listener); }
private string AddMembershipListenerWithoutInit(IMembershipListener listener) { var id = Guid.NewGuid().ToString(); _listeners[id] = listener; return id; }
public string AddMembershipListener(IMembershipListener listener) { if (listener == null) { throw new ArgumentNullException("listener can't be null"); } var id = Guid.NewGuid().ToString(); _listeners[id] = listener; if (listener is IInitialMembershipListener) { // TODO: needs sync with membership events... var cluster = _client.GetCluster(); ((IInitialMembershipListener) listener).Init(new InitialMembershipEvent(cluster, cluster.GetMembers())); } return id; }