File tree Expand file tree Collapse file tree 3 files changed +18
-9
lines changed
Packages/ClientRuntime/Sources Expand file tree Collapse file tree 3 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ public class CRTClientEngine: HttpClientEngine {
2121
2222 private let windowSize : Int
2323 private let maxConnectionsPerEndpoint : Int
24+ private let sharedDefaultIO : SDKDefaultIO = SDKDefaultIO . shared
2425
2526 init ( config: CRTClientEngineConfig = CRTClientEngineConfig ( ) ) {
2627 self . maxConnectionsPerEndpoint = config. maxConnectionsPerEndpoint
@@ -147,8 +148,4 @@ public class CRTClientEngine: HttpClientEngine {
147148
148149 return ( requestOptions, future)
149150 }
150-
151- deinit {
152- AwsCommonRuntimeKit . cleanUp ( )
153- }
154151}
Original file line number Diff line number Diff line change @@ -9,12 +9,23 @@ import AwsCommonRuntimeKit
99import class Foundation. ProcessInfo
1010
1111public final class SDKDefaultIO {
12- public static let shared = SDKDefaultIO ( )
12+ static weak var privateShared : SDKDefaultIO ? = nil
1313
14- public let eventLoopGroup : EventLoopGroup
15- public let hostResolver : DefaultHostResolver
16- public let clientBootstrap : ClientBootstrap
17- public let tlsContext : TlsContext
14+ // TODO: revisit this and verify that it is thread safe.
15+ public static var shared : SDKDefaultIO {
16+ if let shared = privateShared {
17+ return shared
18+ } else {
19+ let shared = SDKDefaultIO ( )
20+ privateShared = shared
21+ return shared
22+ }
23+ }
24+
25+ public var eventLoopGroup : EventLoopGroup
26+ public var hostResolver : DefaultHostResolver
27+ public var clientBootstrap : ClientBootstrap
28+ public var tlsContext : TlsContext
1829
1930 private init ( ) {
2031 AwsCommonRuntimeKit . initialize ( )
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import AwsCommonRuntimeKit
88
99public class SDKRetryer : Retryer {
1010 let crtRetryStrategy : CRTAWSRetryStrategy
11+ private let sharedDefaultIO : SDKDefaultIO = SDKDefaultIO . shared
1112
1213 public init ( options: RetryOptions ) throws {
1314 self . crtRetryStrategy = try CRTAWSRetryStrategy ( options: options. toCRTType ( ) )
You can’t perform that action at this time.
0 commit comments