public object ExecuteOnKey(TKey key, IEntryProcessor entryProcessor) { ValidationUtil.ThrowExceptionIfNull(key); var keyData = ToData(key); return(ExecuteOnKeyInternal(keyData, entryProcessor)); }
public Task <object> SubmitToKey(TKey key, IEntryProcessor entryProcessor) { ValidationUtil.ThrowExceptionIfNull(key); var keyData = ToData(key); return(SubmitToKeyInternal(keyData, entryProcessor)); }
public Task <long> AddAsync(T item, OverflowPolicy overflowPolicy) { ValidationUtil.ThrowExceptionIfNull(item, "Item cannot be null"); var request = RingbufferAddCodec.EncodeRequest(GetName(), (int)OverflowPolicy.Overwrite, ToData(item)); return(InvokeAsync(request, GetPartitionKey(), m => RingbufferAddCodec.DecodeResponse(m).response)); }
public long Add(T item) { ValidationUtil.ThrowExceptionIfNull(item, "Item cannot be null"); var request = RingbufferAddCodec.EncodeRequest(GetName(), (int)OverflowPolicy.Overwrite, ToData(item)); return(Invoke(request, m => RingbufferAddCodec.DecodeResponse(m).response)); }
public void Add(int index, T element) { ValidationUtil.ThrowExceptionIfNull(element); var value = ToData(element); var request = ListAddWithIndexCodec.EncodeRequest(GetName(), index, value); Invoke(request); }
public override bool Add(T item) { ValidationUtil.ThrowExceptionIfNull(item); var value = ToData(item); var request = SetAddCodec.EncodeRequest(GetName(), value); return(Invoke(request, m => SetAddCodec.DecodeResponse(m).response)); }
public int LastIndexOf(T item) { ValidationUtil.ThrowExceptionIfNull(item); var value = ToData(item); var request = ListLastIndexOfCodec.EncodeRequest(GetName(), value); var response = Invoke(request); return(ListLastIndexOfCodec.DecodeResponse(response).response); }
public T Set(int index, T element) { ValidationUtil.ThrowExceptionIfNull(element); var value = ToData(element); var request = ListSetCodec.EncodeRequest(GetName(), index, value); var response = Invoke(request); return(ToObject <T>(ListSetCodec.DecodeResponse(response).response)); }
public virtual void ForceUnlock(TKey key) { ValidationUtil.ThrowExceptionIfNull(key); var keyData = ToData(key); var request = MultiMapForceUnlockCodec.EncodeRequest(GetName(), keyData, _lockReferenceIdGenerator.GetNextReferenceId()); Invoke(request, keyData); }
public virtual bool IsLocked(TKey key) { ValidationUtil.ThrowExceptionIfNull(key); var keyData = ToData(key); var request = MultiMapIsLockedCodec.EncodeRequest(GetName(), keyData); return(Invoke(request, keyData, m => MultiMapIsLockedCodec.DecodeResponse(m).response)); }
public virtual void Lock(TKey key, long leaseTime, TimeUnit timeUnit) { ValidationUtil.ThrowExceptionIfNull(key); var keyData = ToData(key); var request = MultiMapLockCodec.EncodeRequest(GetName(), keyData, ThreadUtil.GetThreadId(), timeUnit.ToMillis(leaseTime), _lockReferenceIdGenerator.GetNextReferenceId()); Invoke(request, keyData); }
/// <exception cref="System.Exception"></exception> public virtual bool TryLock(TKey key, long timeout, TimeUnit timeunit, long leaseTime, TimeUnit leaseUnit) { ValidationUtil.ThrowExceptionIfNull(key); var keyData = ToData(key); var request = MultiMapTryLockCodec.EncodeRequest(GetName(), keyData, ThreadUtil.GetThreadId(), leaseUnit.ToMillis(leaseTime), timeunit.ToMillis(timeout), _lockReferenceIdGenerator.GetNextReferenceId()); return(Invoke(request, keyData, m => MultiMapTryLockCodec.DecodeResponse(m).response)); }
protected ISet <IData> ToDataSet <T>(ICollection <T> c) { ValidationUtil.ThrowExceptionIfNull(c); var valueSet = new HashSet <IData>(); foreach (var o in c) { ValidationUtil.ThrowExceptionIfNull(o); valueSet.Add(ToData(o)); } return(valueSet); }
protected IList <IData> ToDataList <T>(ICollection <T> c) { ValidationUtil.ThrowExceptionIfNull(c, "Collection cannot be null."); var values = new List <IData>(c.Count); foreach (var o in c) { ValidationUtil.ThrowExceptionIfNull(o, "Collection cannot contain null items."); values.Add(ToData(o)); } return(values); }
public virtual void CopyTo(T[] array, int index) { ValidationUtil.ThrowExceptionIfNull(array); if (index < 0) { throw new IndexOutOfRangeException("Index cannot be negative."); } var all = GetAll(); if ((array.Length - index) < all.Count) { throw new ArgumentException("The number of source elements is greater" + " than the available space from index to the end of the destination array."); } var i = index; foreach (var item in all) { array[i++] = item; } }
public virtual void Lock(TKey key) { ValidationUtil.ThrowExceptionIfNull(key); Lock(key, long.MaxValue, TimeUnit.Milliseconds); }