public PoolItem(string sessionId, string keyId, ref Basics.Dss.IDss reservation) { this.SessionId = sessionId; this.KeyId = keyId; this._Reservation = reservation; }
private bool Get(string uniqueId, out Basics.Dss.IDss reservationObject) { reservationObject = null; if (string.IsNullOrEmpty(uniqueId)) { return(false); } if (!this._ReservationTable.TryGetValue(uniqueId, out reservationObject)) { return(false); } if (((IService)reservationObject).IsExpired) { this._ReservationTable.TryRemove(uniqueId, out _); reservationObject = null; return(false); } ((IService)reservationObject).Extend(); return(true); }
private void Create(string uniqueId, short reservationTimeout, out Basics.Dss.IDss reservationObject) { if (string.IsNullOrEmpty(uniqueId)) { throw new Exceptions.ReservationCreationException(); } reservationObject = new Service(uniqueId, reservationTimeout); this._ReservationTable.TryAdd(uniqueId, reservationObject); }
public bool Reserve(string uniqueId, short reservationTimeout, out Basics.Dss.IDss reservationObject) { lock (this._ReservationLock) { if (this.Get(uniqueId, out reservationObject)) { return(true); } this.Create(uniqueId, reservationTimeout, out reservationObject); } return(false); }
private bool GetReservationObject(ref BinaryReader responseReader, out Basics.Dss.IDss reservationObject) { reservationObject = null; byte uniqueIdLength = responseReader.ReadByte(); if (uniqueIdLength == 0) { return(false); } string uniqueId = new string(responseReader.ReadChars(uniqueIdLength)); return(this._Manager.Reserve(uniqueId, 0, out reservationObject)); }
public ReservationEnclosure(string sessionId, ref Basics.Dss.IDss reservation) { this.SessionId = sessionId; this._Reservation = reservation; }