コード例 #1
0
 /// <summary>
 /// Dispatch the specified <see cref="CacheEvent"/> to all
 /// <see cref="Support.CacheListenerSupport.ISynchronousListener"/>
 /// objects and add to the specified <see cref="Queue"/> for deferred
 /// execution for standard ones.
 /// </summary>
 /// <param name="evt">
 /// <b>CacheEvent</b> to dispatch.
 /// </param>
 /// <param name="listeners">
 /// <b>Listeners</b> to which the event is dispatched.
 /// </param>
 /// <param name="queue">
 /// <b>Queue</b> to which event will be added.
 /// </param>
 public static void DispatchSafe(CacheEventArgs evt, Listeners listeners, Queue queue)
 {
     if (listeners != null)
     {
         object[] listenersArray = listeners.ListenersArray;
         for (int i = 0, c = listenersArray.Length; i < c; i++)
         {
             ICacheListener listener = (ICacheListener)listenersArray[i];
             if (listener is CacheListenerSupport.ISynchronousListener)
             {
                 try
                 {
                     CacheListenerSupport.Dispatch(evt, listener);
                 }
                 catch (Exception e)
                 {
                     CacheFactory.Log("An exception occured while dispatching synchronous event:" + evt,
                                      CacheFactory.LogLevel.Error);
                     CacheFactory.Log(e, CacheFactory.LogLevel.Error);
                     CacheFactory.Log("(The exception has been logged and execution is continuing.)",
                                      CacheFactory.LogLevel.Error);
                 }
             }
             else
             {
                 queue.Add(Instantiate(evt, listener));
             }
         }
     }
 }
コード例 #2
0
        /// <summary>
        /// Dispatch event.
        /// </summary>
        public void Run()
        {
            CacheEventArgs evt   = CacheEvent;
            INamedCache    cache = (INamedCache)evt.Cache;

            if (cache.IsActive)
            {
                CacheListenerSupport support = CacheListenerSupport;
                if (support == null)
                {
                    Listeners listeners = Listeners;
                    if (listeners == null)
                    {
                        CacheListenerSupport.Dispatch(evt, CacheListener);
                    }
                    else
                    {
                        CacheListenerSupport.Dispatch(evt, listeners, true);
                    }
                }
                else
                {
                    support.FireEvent(evt, true);
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// Execute the action specific to the Message implementation.
        /// </summary>
        public override void Run()
        {
            IChannel channel = Channel;

            Debug.Assert(channel != null);

            RemoteNamedCache cache = (RemoteNamedCache)channel.Receiver;

            Debug.Assert(cache != null);

            if (IsTruncate)
            {
                Listeners listeners = cache.DeactivationListeners;
                if (!listeners.IsEmpty)
                {
                    CacheEventArgs evt = new CacheEventArgs(cache, CacheEventType.Updated, null, null, null, false);
                    CacheListenerSupport.Dispatch(evt, listeners, false);
                }
            }
            else
            {
                cache.BinaryCache.Dispatch(EventType, FilterIds, Key, ValueOld, ValueNew,
                                           IsSynthetic, (int)TransformState, IsPriming);
            }
        }