Exemple #1
0
 /// <summary>
 /// Adiciona informações da callback para a instancia.
 /// </summary>
 /// <param name="updateCallback"></param>
 /// <param name="removeCallback"></param>
 internal void AddCallbackInfo(CallbackInfo updateCallback, CallbackInfo removeCallback)
 {
     lock (this)
     {
         CallbackEntry entry;
         if (this.Value is CallbackEntry)
         {
             entry = this.Value as CallbackEntry;
         }
         else
         {
             entry       = new CallbackEntry();
             entry.Value = this.Value;
             entry.Flag  = this.Flag;
             this.Value  = entry;
         }
         if (updateCallback != null)
         {
             entry.AddItemUpdateCallback(updateCallback);
         }
         if (removeCallback != null)
         {
             entry.AddItemRemoveCallback(removeCallback);
         }
     }
 }
        /// <summary>
        /// Clona os dados da instancia.
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            CallbackEntry entry = new CallbackEntry();

            entry._flag  = _flag;
            entry._value = _value;
            entry._itemRemovedListener = _itemRemovedListener.Clone() as ArrayList;
            entry._itemUpdateListener  = _itemUpdateListener.Clone() as ArrayList;
            entry._onAsyncOperationCompleteCallback        = _onAsyncOperationCompleteCallback;
            entry._onWriteBehindOperationCompletedCallback = _onWriteBehindOperationCompletedCallback;
            return(entry);
        }
 public override void Clear(CallbackEntry cbEntry, DataSourceUpdateOptions updateOptions, string taskId, OperationContext operationContext)
 {
     base.Sync.AcquireWriterLock(-1);
     try
     {
         this.Internal.Clear(cbEntry, updateOptions, operationContext);
     }
     finally
     {
         base.Sync.ReleaseWriterLock();
     }
 }
Exemple #4
0
 /// <summary>
 /// Remove as informações de callback.
 /// </summary>
 /// <param name="updateCallback"></param>
 /// <param name="removeCallback"></param>
 internal void RemoveCallbackInfo(CallbackInfo updateCallback, CallbackInfo removeCallback)
 {
     lock (this)
     {
         if ((updateCallback != null) || (removeCallback != null))
         {
             CallbackEntry entry = null;
             if (this.Value is CallbackEntry)
             {
                 entry = this.Value as CallbackEntry;
                 if (updateCallback != null)
                 {
                     entry.RemoveItemUpdateCallback(updateCallback);
                 }
                 if (removeCallback != null)
                 {
                     entry.RemoveItemRemoveCallback(removeCallback);
                 }
             }
         }
     }
 }
Exemple #5
0
        /// <summary>
        /// Recupera o valor da entrada.
        /// </summary>
        /// <param name="cacheContext"></param>
        /// <returns></returns>
        internal object DeflattedValue(string cacheContext)
        {
            object obj2 = this.Value;

            lock (this)
            {
                if (!IsFlattened)
                {
                    return(obj2);
                }
                UserBinaryObject obj3  = null;
                CallbackEntry    entry = obj2 as CallbackEntry;
                if (entry != null)
                {
                    obj3 = entry.Value as UserBinaryObject;
                }
                else
                {
                    obj3 = obj2 as UserBinaryObject;
                }
                byte[] fullObject = obj3.GetFullObject();
                if (IsCompressed)
                {
                    fullObject = CompressionUtil.Decompress(fullObject);
                    _flags.UnsetBit(2);
                }
                _size = fullObject.Length;
                obj2  = CompactBinaryFormatter.FromByteBuffer(fullObject, cacheContext);
                if (entry != null)
                {
                    entry.Value = obj2;
                    obj2        = entry;
                }
            }
            return(obj2);
        }
 public override void Clear(CallbackEntry cbEntry, DataSourceUpdateOptions updateOptions, OperationContext operationContext)
 {
     this.Clear(cbEntry, updateOptions, null, operationContext);
 }
Exemple #7
0
 public virtual void Clear(CallbackEntry cbEntry, DataSourceUpdateOptions updateOptions, string taskId, OperationContext operationContext)
 {
 }
Exemple #8
0
 public virtual void NotifyWriteBehindTaskStatus(OpCode operationCode, Hashtable result, CallbackEntry cbEntry, string taskId, string providerName, OperationContext operationContext)
 {
     if ((cbEntry != null) && (cbEntry.WriteBehindOperationCompletedCallback != null))
     {
         this.NotifyWriteBehindTaskCompleted(operationCode, result, cbEntry, operationContext);
     }
 }
Exemple #9
0
 protected virtual void NotifyWriteBehindTaskCompleted(OpCode operationCode, Hashtable result, CallbackEntry cbEntry, OperationContext operationContext)
 {
     if (this.Listener != null)
     {
         this.InternalCache.DoWrite("CacheBase.NotifyWriteBehindTaskCompleted", "", operationContext);
         this.Listener.OnWriteBehindOperationCompletedCallback(operationCode, result, cbEntry);
     }
 }