Exemple #1
0
 /// <summary>
 /// Invoke clients with parameters and callback.
 /// </summary>
 /// <param name="method">Method name.</param>
 /// <param name="arguments">Invocation parameters passed to the method.</param>
 /// <param name="callback">Callback used to handle return values.</param>
 /// <param name="ignoreSelf">Current client shoud be ignored.</param>
 /// <param name="targetScope">Invoke clients subscribed to the specified Scope.</param>
 protected void InvokeClients(string method, object[] arguments, IPendingServiceCallback callback, bool ignoreSelf, IScope targetScope)
 {
     try
     {
         if (log.IsDebugEnabled)
             log.Debug(string.Format("Invoke clients: {0}", method));
         IServiceCapableConnection connection = FluorineFx.Context.FluorineContext.Current.Connection as IServiceCapableConnection;
         IEnumerator collections = targetScope.GetConnections();
         while (collections.MoveNext())
         {
             IConnection connectionTmp = collections.Current as IConnection;
             if (!connectionTmp.Scope.Name.Equals(targetScope.Name))
                 continue;
             if ((connectionTmp is IServiceCapableConnection) && (!ignoreSelf || connectionTmp != connection))
                 (connectionTmp as IServiceCapableConnection).Invoke(method, arguments, callback);
         }
     }
     catch (Exception ex)
     {
         if (log.IsErrorEnabled)
             log.Error("InvokeClients failed", ex);
         throw;
     }
     finally
     {
         if (log.IsDebugEnabled)
             log.Debug(string.Format("Finished invoking clients ({0})", method));
     }
 }
Exemple #2
0
        protected void InvokeClients(string method, object[] arguments, IPendingServiceCallback callback, bool ignoreSelf, IScope targetScope)
        {
            IServiceCapableConnection connection = FluorineContext.Current.Connection as IServiceCapableConnection;
            IEnumerator connections = targetScope.GetConnections();

            while (connections.MoveNext())
            {
                IConnection current = connections.Current as IConnection;
                if (current.Scope.Name.Equals(targetScope.Name) && ((current is IServiceCapableConnection) && (!ignoreSelf || (current != connection))))
                {
                    (current as IServiceCapableConnection).Invoke(method, arguments, callback);
                }
            }
        }