Exemple #1
0
		/// <summary>
		/// Initializes a new instance of the MessageBroker class.
		/// </summary>
		public MessageBroker(MessageServer messageServer) {
			_messageServer = messageServer;
			_services = new CopyOnWriteDictionary();
			_endpoints = new CopyOnWriteDictionary();
			_factories = new CopyOnWriteDictionary();
			_destinationServiceMap = new CopyOnWriteDictionary();
			_destinations = new CopyOnWriteDictionary();
			_clientManager = new ClientManager(this);
			_sessionManager = new SessionManager(this);
			_loginManager = new LoginManager();
		}
Exemple #2
0
		public SequenceManager(DataDestination dataDestination) {
			_dataDestination = dataDestination;
			_sequenceIdToSequenceHash = new CopyOnWriteDictionary();
#if (NET_1_1)
			_parametersToSequenceIdHash = new Hashtable(new ListHashCodeProvider(), new ListComparer());
#else
			_parametersToSequenceIdHash = new Hashtable(new ListHashCodeProvider());
#endif
			_itemIdToSequenceIdMapHash = new Hashtable();
			_clientIdToSequenceHash = new Hashtable();
			_itemIdToItemHash = new Hashtable();
		}
Exemple #3
0
		public void Deserialize(AMFReader reader) {
			_name = reader.ReadData() as string;
			_path = reader.ReadData() as string;
			_attributes.Clear();
#if !(NET_1_1)
			_attributes = new CopyOnWriteDictionary<string, object>(reader.ReadData() as IDictionary<string, object>);
#else
            _attributes = new CopyOnWriteDictionary(reader.ReadData() as IDictionary);
#endif
			_persistent = true;
			_persistentSO = true;
			_ownerMessage.SetName(_name);
			_ownerMessage.SetIsPersistent(true);

		}
Exemple #4
0
		/// <summary>
		/// Invalidates the client.
		/// </summary>
		public void Invalidate() {
			lock (this.SyncRoot) {
				if (!IsValid || IsInvalidating)
					return; // Already shutting down.

				SetIsInvalidating(true);
			}
			_clientManager.RemoveSubscriber(this);

			// Unregister from all Sessions.
			if (_sessions != null && _sessions.Count != 0) {
				foreach (ISession session in _sessions)
					UnregisterSession(session);
			}
			// Invalidate associated MessageClient subscriptions.
			if (_messageClients != null && _messageClients.Count != 0) {
				foreach (MessageClient messageClient in _messageClients) {
					messageClient.RemoveMessageClientDestroyedListener(this);
					messageClient.Invalidate();
				}
				_messageClients.Clear();
			}
			// Notify destroy listeners that we're shutting the FlexClient down.
			if (_destroyedListeners != null && _destroyedListeners.Count != 0) {
				foreach (IClientListener listener in _destroyedListeners) {
					listener.ClientDestroyed(this);
				}
				_destroyedListeners.Clear();
			}
			// Close any registered push handlers.
			if (_endpointPushHandlers != null && _endpointPushHandlers.Count != 0) {
				foreach (IEndpointPushHandler handler in _endpointPushHandlers.Values) {
					handler.Close();
				}
				_endpointPushHandlers = null;
			}
			lock (this.SyncRoot) {
				SetIsValid(false);
				SetIsInvalidating(false);
			}
			if (log.IsDebugEnabled)
				log.Debug(__Res.GetString(__Res.Client_Invalidated, _id));
		}
Exemple #5
0
		/// <summary>
		/// Registers an IEndpointPushHandler for the specified endpoint to handle pushing messages.
		/// </summary>
		/// <param name="handler">The IEndpointPushHandler to register.</param>
		/// <param name="endpointId">The endpoint identity to register for.</param>
		public void RegisterEndpointPushHandler(IEndpointPushHandler handler, string endpointId) {
			if (_endpointPushHandlers == null) {
				lock (this.SyncRoot) {
					if (_endpointPushHandlers == null)
						_endpointPushHandlers = new CopyOnWriteDictionary(1);
				}
			}
			if (_endpointPushHandlers.ContainsKey(endpointId)) {
				MessageException me = new MessageException();
				me.FaultCode = EndpointPushHandlerAlreadyRegistered.ToString();
				throw me;
			}
			_endpointPushHandlers.Add(endpointId, handler);
		}
Exemple #6
0
		/// <summary>
		/// Adds a MessageClient destroy listener.
		/// </summary>
		/// <param name="listener">The listener to add.</param>
		public void AddMessageClientDestroyedListener(IMessageClientListener listener) {
			if (_messageClientDestroyedListeners == null) {
				lock (this.SyncRoot) {
					if (_messageClientDestroyedListeners == null)
						_messageClientDestroyedListeners = new CopyOnWriteDictionary(1);
				}
			}
			_messageClientDestroyedListeners[listener] = null;
		}