private bool CheckObjectLifetime(ObjectPoolMember poolObject) { var lifetimeSpan = DateTime.Now.Subtract(poolObject.WhenUpdated); if (objectLifetime < 1) { return(false); } return(lifetimeSpan.Seconds > objectLifetime); }
public void ReturnPoolObject(ObjectPoolMember poolObject, int recordCount) { if (poolObject != null) { if (poolObject.UsageCount > objectUsageLimit) { ManagerLog.WriteManagerMessage($"pool object ({poolObject.Identifier}) abandoned (usage > usage limit)", LogLevel.Info); return; } poolObject.UsageCount++; poolObject.RecordsCount += recordCount; poolObject.WhenUpdated = DateTime.Now; objectPoolContainer.PoolObject = poolObject; } else { ManagerLog.WriteManagerMessage("pool object is null", LogLevel.Error); } }