/// <summary> /// Removes all entries from the cluster. /// </summary> /// <remarks> /// This method invokes <see cref="handleClear"/> on every server node in the cluster. /// </remarks> protected void Clustered_Clear(Caching.Notifications notification, string taskId, bool excludeSelf, OperationContext operationContext) { try { Function func = new Function((int)OpCodes.Clear, new object[] { notification, taskId, operationContext }, excludeSelf); Cluster.BroadcastToServers(func, GroupRequest.GET_ALL, false); } catch (Exception e) { throw new GeneralFailureException(e.Message, e); } }
/// <summary> /// Remove the objects from the cluster. /// </summary> /// <param name="keys">keys of the entries.</param> /// <returns>list of failed keys</returns> /// <remarks> /// This method invokes <see cref="handleRemove"/> on every server node in the cluster. /// </remarks> protected Hashtable Clustered_Remove(Address dest, object[] keys, ItemRemoveReason ir, Caching.Notifications notification, string taskId, string providerName, bool notify, OperationContext operationContext) { if (ServerMonitor.MonitorActivity) { ServerMonitor.LogClientActivity("PartCacheBase.RemoveBlk", ""); } Hashtable removedEntries = new Hashtable(); ArrayList dests = new ArrayList(); dests.Add(dest); try { Function func = new Function((int)OpCodes.Remove, new object[] { keys, ir, notify, notification, taskId, providerName, operationContext }, false); func.Cancellable = true; RspList results = Cluster.Multicast(dests, func, GetFirstResponse, false); if (results == null) { return(removedEntries); } if (results.SuspectedMembers.Count == dests.Count) { //All the members of this group has gone down. //we must try this operation on some other group. throw new Runtime.Exceptions.SuspectedException("operation failed because the group member was suspected"); } ClusterHelper.ValidateResponses(results, typeof(Hashtable), Name); IList rspList = ClusterHelper.GetAllNonNullRsp(results, typeof(Hashtable)); if (rspList.Count <= 0) { return(removedEntries); } IEnumerator ia = rspList.GetEnumerator(); while (ia.MoveNext()) { if (operationContext.CancellationToken != null && operationContext.CancellationToken.IsCancellationRequested) { throw new OperationCanceledException(ExceptionsResource.OperationFailed); } Rsp rsp = (Rsp)ia.Current; Hashtable removed = (Hashtable)rsp.Value; IDictionaryEnumerator ide = removed.GetEnumerator(); while (ide.MoveNext()) { if (!removedEntries.ContainsKey(ide.Key)) { removedEntries.Add(ide.Key, ide.Value); } } } } catch (CacheException e) { throw; } catch (Exception e) { throw new GeneralFailureException(e.Message, e); } return(removedEntries); }
/// <summary> /// Remove the object from the cluster. /// </summary> /// <param name="key">key of the entry.</param> /// <returns>cache entry.</returns> /// <remarks> /// This method invokes <see cref="handleRemove"/> on every server node in the cluster. /// </remarks> protected CacheEntry Clustered_Remove(Address dest, object key, ItemRemoveReason ir, Caching.Notifications notification, string taskId, string providerName, bool notify, object lockId, ulong version, LockAccessType accessType, OperationContext operationContext) { CacheEntry retVal = null; try { operationContext?.MarkInUse(NCModulesConstants.Topology); Function func = new Function((int)OpCodes.Remove, new object[] { key, ir, notify, notification, taskId, lockId, accessType, version, providerName, operationContext }, false); func.ResponseExpected = true; object result = Cluster.SendMessage(dest, func, GroupRequest.GET_FIRST, false); if (result != null) { retVal = ((OperationResponse)result).SerializablePayload as CacheEntry; if (retVal != null && ((OperationResponse)result).UserPayload != null) { retVal.Value = ((OperationResponse)result).UserPayload; } } } catch (Runtime.Exceptions.SuspectedException se) { throw; } catch (Runtime.Exceptions.TimeoutException te) { throw; } catch (CacheException e) { throw; } catch (Exception e) { throw new GeneralFailureException(e.Message, e); } finally { operationContext?.MarkFree(NCModulesConstants.Topology); } return(retVal); }
/// <summary> /// /// </summary> /// <param name="operationCode"></param> /// <param name="result"></param> /// <param name="notification"></param> void ICacheEventsListener.OnWriteBehindOperationCompletedCallback(OpCode operationCode, object result, Caching.Notifications notification) { }