コード例 #1
0
ファイル: List.cs プロジェクト: javithalion/NCache
			internal Element(List enclosingInstance, object o)
			{
				InitBlock(enclosingInstance);
				obj = o;
			}
コード例 #2
0
ファイル: List.cs プロジェクト: javithalion/NCache
			private void  InitBlock(List enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
コード例 #3
0
ファイル: List.cs プロジェクト: javithalion/NCache
		public List copy()
		{
			List retval = new List();
			
			lock (mutex)
			{
				for (Element el = head; el != null; el = el.next)
					retval.add(el.obj);
			}
			return retval;
		}
コード例 #4
0
ファイル: List.cs プロジェクト: javithalion/NCache
			internal ListEnumerator(List enclosingInstance, Element start)
			{
				InitBlock(enclosingInstance);
				curr = start;
			}
コード例 #5
0
        public override object RemoveSync(object[] keys, ItemRemoveReason reason, bool notify,
            OperationContext operationContext)
        {
            try
            {
                Hashtable totalRemovedItems = new Hashtable();
                CacheEntry entry = null;
                IDictionaryEnumerator ide = null;

                if (NCacheLog.IsInfoEnabled)
                    NCacheLog.Info("PartitionedCache.RemoveSync", "Keys = " + keys.Length.ToString());

                for (int i = 0; i < keys.Length; i++)
                {
                    try
                    {
                        if (keys[i] != null)
                            entry = Local_Remove(keys[i], reason, null, null, false, null, LockAccessType.IGNORE_LOCK, operationContext);

                        if (entry != null)
                        {
                            totalRemovedItems.Add(keys[i], entry);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw;
                    }
                }

                ArrayList keysOfRemoveNotification = new ArrayList();
                ArrayList entriesOfRemoveNotification = new ArrayList();
                List<EventContext> eventContexts = new List<EventContext>();
                int sizeThreshhold = 30*1024;
                int countThreshhold = 50;
                int size = 0;

                ide = totalRemovedItems.GetEnumerator();

                while (ide.MoveNext())
                {
                    try
                    {
                        entry = ide.Value as CacheEntry;
                        if (entry != null)
                        {
                            if (entry.Value is CallbackEntry)
                            {
                                EventId eventId = null;
                                OperationID opId = operationContext.OperatoinID;
                                CallbackEntry cbEtnry = (CallbackEntry) entry.Value;
                                EventContext eventContext = null;

                                if (cbEtnry != null && cbEtnry.ItemRemoveCallbackListener != null &&
                                    cbEtnry.ItemRemoveCallbackListener.Count > 0)
                                {
                                    //generate event id
                                    if (!operationContext.Contains(OperationContextFieldName.EventContext))
                                        //for atomic operations
                                    {
                                        eventId = EventId.CreateEventId(opId);
                                    }
                                    else //for bulk
                                    {
                                        eventId =
                                            ((EventContext)
                                                operationContext.GetValueByField(OperationContextFieldName.EventContext))
                                                .EventID;
                                    }

                                    eventId.EventType = Alachisoft.NCache.Persistence.EventType.ITEM_REMOVED_CALLBACK;
                                    eventContext = new EventContext();
                                    eventContext.Add(EventContextFieldName.EventID, eventId);
                                    EventCacheEntry eventCacheEntry =
                                        CacheHelper.CreateCacheEventEntry(cbEtnry.ItemRemoveCallbackListener, entry);
                                    eventContext.Item = eventCacheEntry;
                                    eventContext.Add(EventContextFieldName.ItemRemoveCallbackList,
                                        cbEtnry.ItemRemoveCallbackListener.Clone());

                                    RaiseAsyncCustomRemoveCalbackNotifier(ide.Key, entry, reason, operationContext,
                                        eventContext);
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            catch (Exception)
            {
            }
            return null;
        }