From 8201c0809b1f402117b28a2473f4c4d4691754b4 Mon Sep 17 00:00:00 2001 From: luzhan <513964121@qq.com> Date: Sun, 7 Jul 2024 23:16:02 +0800 Subject: [PATCH] fix:change TException to Exception --- samples/Apache.IoTDB.Samples/SessionPoolTest.cs | 17 +++++++++++++++++ src/Apache.IoTDB/SessionPool.cs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/samples/Apache.IoTDB.Samples/SessionPoolTest.cs b/samples/Apache.IoTDB.Samples/SessionPoolTest.cs index 0883496..cfdc9be 100644 --- a/samples/Apache.IoTDB.Samples/SessionPoolTest.cs +++ b/samples/Apache.IoTDB.Samples/SessionPoolTest.cs @@ -45,6 +45,8 @@ public async Task Test() { await TestOpenWithNodeUrls(); + await TestOpenWith2NodeUrls(); + await TestOpenWithNodeUrlsAndInsertOneRecord(); await TestInsertOneRecord(); @@ -128,6 +130,21 @@ public async Task TestOpenWithNodeUrls() await session_pool.Close(); Console.WriteLine("TestOpenWithNodeUrls Passed!"); } + public async Task TestOpenWith2NodeUrls() + { + var session_pool = new SessionPool(new List() { host + ":" + port, host + ":" + (port + 1) }, 8); + await session_pool.Open(false); + Debug.Assert(session_pool.IsOpen()); + if (debug) session_pool.OpenDebugMode(); + await session_pool.Close(); + + session_pool = new SessionPool(new List() { host + ":" + (port + 1), host + ":" + port }, 8); + await session_pool.Open(false); + Debug.Assert(session_pool.IsOpen()); + if (debug) session_pool.OpenDebugMode(); + await session_pool.Close(); + Console.WriteLine("TestOpenWith2NodeUrls Passed!"); + } public async Task TestOpenWithNodeUrlsAndInsertOneRecord() { var session_pool = new SessionPool(node_urls, 8); diff --git a/src/Apache.IoTDB/SessionPool.cs b/src/Apache.IoTDB/SessionPool.cs index e079a82..44c3d7b 100644 --- a/src/Apache.IoTDB/SessionPool.cs +++ b/src/Apache.IoTDB/SessionPool.cs @@ -195,7 +195,7 @@ public async Task Open(CancellationToken cancellationToken = default) } break; } - catch (TException e) + catch (Exception e) // CreateAndOpen will not throw TException { #if NET461_OR_GREATER || NETSTANDARD2_0 #else