From ebe31dfa89fda7767b688b88c229ae5903c079a1 Mon Sep 17 00:00:00 2001 From: Yury Pliner Date: Sun, 24 May 2020 23:01:23 +0500 Subject: [PATCH 1/2] Drop unused UseBackgroundThreadsForIO --- .../client/api/ConnectionFactory.cs | 5 -- .../client/api/IConnectionFactory.cs | 5 -- .../RabbitMQ.Client/client/impl/Connection.cs | 4 +- .../TestConnectionWithBackgroundThreads.cs | 69 ------------------- 4 files changed, 2 insertions(+), 81 deletions(-) delete mode 100644 projects/Unit/TestConnectionWithBackgroundThreads.cs diff --git a/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs b/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs index 84e33c44f6..5690207582 100644 --- a/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs +++ b/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs @@ -298,11 +298,6 @@ public AmqpTcpEndpoint Endpoint /// public TimeSpan RequestedHeartbeat { get; set; } = DefaultHeartbeat; - /// - /// When set to true, background thread will be used for the I/O loop. - /// - public bool UseBackgroundThreadsForIO { get; set; } - /// /// Username to use when authenticating to the server. /// diff --git a/projects/RabbitMQ.Client/client/api/IConnectionFactory.cs b/projects/RabbitMQ.Client/client/api/IConnectionFactory.cs index be61afe396..3d0dc0bac1 100644 --- a/projects/RabbitMQ.Client/client/api/IConnectionFactory.cs +++ b/projects/RabbitMQ.Client/client/api/IConnectionFactory.cs @@ -72,11 +72,6 @@ public interface IConnectionFactory /// TimeSpan RequestedHeartbeat { get; set; } - /// - /// When set to true, background threads will be used for I/O and heartbeats. - /// - bool UseBackgroundThreadsForIO { get; set; } - /// /// Username to use when authenticating to the server. /// diff --git a/projects/RabbitMQ.Client/client/impl/Connection.cs b/projects/RabbitMQ.Client/client/impl/Connection.cs index 5ee703bbef..5c980f2eb9 100644 --- a/projects/RabbitMQ.Client/client/impl/Connection.cs +++ b/projects/RabbitMQ.Client/client/impl/Connection.cs @@ -124,7 +124,7 @@ public Connection(IConnectionFactory factory, bool insist, IFrameHandler frameHa _session0 = new MainSession(this) { Handler = NotifyReceivedCloseOk }; _model0 = (ModelBase)Protocol.CreateModel(_session0); - StartMainLoop(factory.UseBackgroundThreadsForIO); + StartMainLoop(); Open(insist); } @@ -830,7 +830,7 @@ public void MaybeStartHeartbeatTimers() } } - public void StartMainLoop(bool useBackgroundThread) + public void StartMainLoop() { _mainLoopTask = Task.Run((Action)MainLoop); } diff --git a/projects/Unit/TestConnectionWithBackgroundThreads.cs b/projects/Unit/TestConnectionWithBackgroundThreads.cs deleted file mode 100644 index 25039d3749..0000000000 --- a/projects/Unit/TestConnectionWithBackgroundThreads.cs +++ /dev/null @@ -1,69 +0,0 @@ -// This source code is dual-licensed under the Apache License, version -// 2.0, and the Mozilla Public License, version 1.1. -// -// The APL v2.0: -// -//--------------------------------------------------------------------------- -// Copyright (c) 2007-2020 VMware, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//--------------------------------------------------------------------------- -// -// The MPL v1.1: -// -//--------------------------------------------------------------------------- -// The contents of this file are subject to the Mozilla Public License -// Version 1.1 (the "License"); you may not use this file except in -// compliance with the License. You may obtain a copy of the License -// at https://www.mozilla.org/MPL/ -// -// Software distributed under the License is distributed on an "AS IS" -// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See -// the License for the specific language governing rights and -// limitations under the License. -// -// The Original Code is RabbitMQ. -// -// The Initial Developer of the Original Code is Pivotal Software, Inc. -// Copyright (c) 2007-2020 VMware, Inc. All rights reserved. -//--------------------------------------------------------------------------- - -using NUnit.Framework; - -namespace RabbitMQ.Client.Unit -{ - [TestFixture] - public class TestConnectionWithBackgroundThreads - { - - [Test] - public void TestWithBackgroundThreadsEnabled() - { - ConnectionFactory connFactory = new ConnectionFactory - { - UseBackgroundThreadsForIO = true - }; - - IConnection conn = connFactory.CreateConnection(); - IModel ch = conn.CreateModel(); - - // sanity check - string q = ch.QueueDeclare(); - ch.QueueDelete(q); - - ch.Close(); - conn.Close(); - } - } -} - From be24c059fa0e2bd9cde9c15cbc2677d69fb33b4f Mon Sep 17 00:00:00 2001 From: Yury Pliner Date: Sun, 24 May 2020 23:22:19 +0500 Subject: [PATCH 2/2] Try to fix approval tests --- projects/Unit/APIApproval.Approve.verified.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/projects/Unit/APIApproval.Approve.verified.txt b/projects/Unit/APIApproval.Approve.verified.txt index 211a00da10..79af7ec8de 100644 --- a/projects/Unit/APIApproval.Approve.verified.txt +++ b/projects/Unit/APIApproval.Approve.verified.txt @@ -90,7 +90,6 @@ namespace RabbitMQ.Client public RabbitMQ.Client.SslOption Ssl { get; set; } public bool TopologyRecoveryEnabled { get; set; } public System.Uri Uri { get; set; } - public bool UseBackgroundThreadsForIO { get; set; } public string UserName { get; set; } public string VirtualHost { get; set; } public static System.Net.Sockets.AddressFamily DefaultAddressFamily { get; set; } @@ -330,7 +329,6 @@ namespace RabbitMQ.Client uint RequestedFrameMax { get; set; } System.TimeSpan RequestedHeartbeat { get; set; } System.Uri Uri { get; set; } - bool UseBackgroundThreadsForIO { get; set; } string UserName { get; set; } string VirtualHost { get; set; } RabbitMQ.Client.IAuthMechanismFactory AuthMechanismFactory(System.Collections.Generic.IList mechanismNames);