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 {
21
21
22
22
private let windowSize : Int
23
23
private let maxConnectionsPerEndpoint : Int
24
+ private let sharedDefaultIO : SDKDefaultIO = SDKDefaultIO . shared
24
25
25
26
init ( config: CRTClientEngineConfig = CRTClientEngineConfig ( ) ) {
26
27
self . maxConnectionsPerEndpoint = config. maxConnectionsPerEndpoint
@@ -147,8 +148,4 @@ public class CRTClientEngine: HttpClientEngine {
147
148
148
149
return ( requestOptions, future)
149
150
}
150
-
151
- deinit {
152
- AwsCommonRuntimeKit . cleanUp ( )
153
- }
154
151
}
Original file line number Diff line number Diff line change @@ -9,12 +9,23 @@ import AwsCommonRuntimeKit
9
9
import class Foundation. ProcessInfo
10
10
11
11
public final class SDKDefaultIO {
12
- public static let shared = SDKDefaultIO ( )
12
+ static weak var privateShared : SDKDefaultIO ? = nil
13
13
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
18
29
19
30
private init ( ) {
20
31
AwsCommonRuntimeKit . initialize ( )
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import AwsCommonRuntimeKit
8
8
9
9
public class SDKRetryer : Retryer {
10
10
let crtRetryStrategy : CRTAWSRetryStrategy
11
+ private let sharedDefaultIO : SDKDefaultIO = SDKDefaultIO . shared
11
12
12
13
public init ( options: RetryOptions ) throws {
13
14
self . crtRetryStrategy = try CRTAWSRetryStrategy ( options: options. toCRTType ( ) )
You can’t perform that action at this time.
0 commit comments