/// <summary> /// Dispose of the NetworkService's resources /// </summary> public void Dispose() { NamingClient.Dispose(); _remoteManager.Dispose(); Logger.Log(Level.Verbose, "Disposed of network service"); }
/// <summary> /// Register the identifier for the NetworkService with the NameService. /// </summary> /// <param name="id">The identifier to register</param> public void Register(IIdentifier id) { Logger.Log(Level.Verbose, "Registering id {0} with network service.", id); _localIdentifier = id; NamingClient.Register(id.ToString(), _remoteManager.LocalEndpoint); Logger.Log(Level.Verbose, "End of Registering id {0} with network service.", id); }
/// <summary> /// Dispose of the NetworkService's resources /// </summary> public void Dispose() { if (Interlocked.Exchange(ref _disposed, 1) == 0) { NamingClient.Dispose(); _remoteManager.Dispose(); LOGGER.Log(Level.Verbose, "Disposed of network service"); } }
/// <summary> /// Unregister the identifier for the NetworkService with the NameService. /// </summary> public void Unregister() { if (_localIdentifier == null) { throw new IllegalStateException("Cannot unregister a non existant identifier"); } NamingClient.Unregister(_localIdentifier.ToString()); _localIdentifier = null; _messageHandlerDisposable.Dispose(); }
/// <summary> /// Register the identifier for the NetworkService with the NameService. /// </summary> /// <param name="id">The identifier to register</param> public void Register(IIdentifier id) { LOGGER.Log(Level.Verbose, "Registering id {0} with network service.", id); _localIdentifier = id; NamingClient.Register(id.ToString(), _remoteManager.LocalEndpoint); // Create and register incoming message handler var anyEndpoint = new IPEndPoint(IPAddress.Any, 0); _messageHandlerDisposable = _remoteManager.RegisterObserver(anyEndpoint, _messageHandler); LOGGER.Log(Level.Verbose, "End of Registering id {0} with network service.", id); }
/// <summary> /// Unregister the identifier for the NetworkService with the NameService. /// </summary> public void Unregister() { if (_localIdentifier == null) { throw new IllegalStateException("Cannot unregister a non existant identifier"); } NamingClient.Unregister(_localIdentifier.ToString()); _localIdentifier = null; if (_universalObserverDisposable != null) { _universalObserverDisposable.Dispose(); } if (_remoteMessageUniversalObserver != null) { _remoteMessageUniversalObserver.Dispose(); } }