public MQCommsBufferPool() { base.TrConstructor("%Z% %W% %I% %E% %U%"); lock (this) { this.random = new Random(this.GetHashCode()); MQCommsBufferImpl impl = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl2 = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl2.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl3 = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl3.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl4 = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl4.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl5 = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl5.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl6 = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl6.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl7 = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl7.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl8 = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl8.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl9 = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl9.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl10 = new MQCommsBufferImpl(this, 0x400, this.random.Next()); impl10.Reset(false); this.currentAllocation += 0x400; MQCommsBufferImpl impl11 = new MQCommsBufferImpl(this, 0x800, this.random.Next()); impl11.Reset(false); this.currentAllocation += 0x800; MQCommsBufferImpl impl12 = new MQCommsBufferImpl(this, 0x1400, this.random.Next()); impl12.Reset(false); this.currentAllocation += 0x1400; MQCommsBufferImpl impl13 = new MQCommsBufferImpl(this, 0x8000, this.random.Next()); impl13.Reset(false); this.currentAllocation += 0x8000; MQCommsBufferImpl impl14 = new MQCommsBufferImpl(this, 0x8000, this.random.Next()); impl14.Reset(false); this.currentAllocation += 0x8000; MQCommsBufferImpl impl15 = new MQCommsBufferImpl(this, 0x8000, this.random.Next()); impl15.Reset(false); this.currentAllocation += 0x8000; MQCommsBufferImpl impl16 = new MQCommsBufferImpl(this, 0x8000, this.random.Next()); impl16.Reset(false); this.currentAllocation += 0x8000; this.bufferPool_1k.Add(impl.HashCode, impl); this.bufferPool_1k.Add(impl2.HashCode, impl2); this.bufferPool_1k.Add(impl3.HashCode, impl3); this.bufferPool_1k.Add(impl4.HashCode, impl4); this.bufferPool_1k.Add(impl5.HashCode, impl5); this.bufferPool_1k.Add(impl6.HashCode, impl6); this.bufferPool_1k.Add(impl7.HashCode, impl7); this.bufferPool_1k.Add(impl8.HashCode, impl8); this.bufferPool_1k.Add(impl9.HashCode, impl9); this.bufferPool_1k.Add(impl10.HashCode, impl10); this.bufferPool_2k.Add(impl11.HashCode, impl11); this.bufferPool_5k.Add(impl12.HashCode, impl12); this.bufferPool_32k.Add(impl13.HashCode, impl13); this.bufferPool_32k.Add(impl14.HashCode, impl14); this.bufferPool_32k.Add(impl15.HashCode, impl15); this.bufferPool_32k.Add(impl16.HashCode, impl16); } }
internal void FreeBuffer(IMQCommsBuffer iBuffer) { uint method = 0x6c; this.TrEntry(method, new object[] { iBuffer }); try { MQCommsBufferImpl impl = (MQCommsBufferImpl)iBuffer; IDictionary <int, MQCommsBufferImpl> dictionary = null; impl.CheckPool(this); impl.IsValid(); switch (iBuffer.Capacity) { case 0x1400: if (this.bufferPool_5k.ContainsKey(impl.HashCode)) { dictionary = this.bufferPool_5k; } break; case 0x5000: if (this.bufferPool_20k.ContainsKey(impl.HashCode)) { dictionary = this.bufferPool_20k; } break; case 0x8000: if (this.bufferPool_32k.ContainsKey(impl.HashCode)) { dictionary = this.bufferPool_32k; } break; case 0x400: if (this.bufferPool_1k.ContainsKey(impl.HashCode)) { dictionary = this.bufferPool_1k; } break; case 0x800: if (this.bufferPool_2k.ContainsKey(impl.HashCode)) { dictionary = this.bufferPool_2k; } break; default: { MQManagedClientException ex = new MQManagedClientException("BufferId=" + impl.HashCode, 2, 0x893); base.TrException(method, ex); base.throwNewMQException(2, 0x893); break; } } if (dictionary != null) { lock (dictionary) { impl.UseCount--; if (impl.UseCount == 0) { base.TrText(method, "UseCount on this buffer is found to be 0,Reseting this buffer of capacity " + impl.Capacity); impl.Reset(false); } return; } } lock (this) { impl.UseCount--; if (impl.UseCount == 0) { impl.Dispose(false); impl = null; } } } finally { base.TrExit(method); } }