//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public T acquire() public override T Acquire() { // Try and get it from the thread local LocalSlot <T> localSlot = _puddle.get(); T obj = localSlot.LocalSlotObject; if (obj != default(T)) { localSlot.Set(default(T)); return(obj); } // Try the reference queue, containing objects from dead threads LocalSlotReference <T> slotReference = (LocalSlotReference <T>)_objectsFromDeadThreads.poll(); if (slotReference != null && slotReference.LocalSlotReferenceObject != default(T)) { _slotReferences.remove(slotReference); // remove from old threads return(slotReference.LocalSlotReferenceObject); } // Fall back to the delegate pool return(@delegate.Acquire()); }
internal LocalSlot(ReferenceQueue <LocalSlot <T> > referenceQueue) { SlotWeakReference = new LocalSlotReference <T>(this, referenceQueue); }