@@ -16,7 +16,8 @@ internal class Worker : IDisposable
1616 /// <summary>
1717 /// Initializes a new instance of the <see cref="Worker"/> class.
1818 /// </summary>
19- /// <param name="client">Client for the worker.</param>
19+ /// <param name="runtime">Runtime for the worker.</param>
20+ /// <param name="clientHandle">Client handle for the worker.</param>
2021 /// <param name="namespace">Namespace for the worker.</param>
2122 /// <param name="options">Options for the worker.</param>
2223 /// <param name="loggerFactory">Logger factory, used instead of the one in options by
@@ -26,12 +27,13 @@ internal class Worker : IDisposable
2627 /// If any of the options are invalid including improperly defined workflows/activities.
2728 /// </exception>
2829 public Worker (
29- Client client ,
30+ Runtime runtime ,
31+ SafeClientHandle clientHandle ,
3032 string @namespace ,
3133 Temporalio . Worker . TemporalWorkerOptions options ,
3234 ILoggerFactory loggerFactory ,
3335 IReadOnlyCollection < Temporalio . Client . ITemporalClientPlugin > ? clientPlugins = null )
34- : this ( client . Runtime , CreateWorkerHandle ( client , @namespace , options , loggerFactory , clientPlugins ) )
36+ : this ( runtime , CreateWorkerHandle ( runtime , clientHandle , @namespace , options , loggerFactory , clientPlugins ) )
3537 {
3638 }
3739
@@ -98,16 +100,16 @@ public async Task ValidateAsync()
98100 /// <summary>
99101 /// Replace the client.
100102 /// </summary>
101- /// <param name="client ">New client.</param>
102- public void ReplaceClient ( Client client )
103+ /// <param name="clientHandle ">New client handle .</param>
104+ public void ReplaceClient ( SafeClientHandle clientHandle )
103105 {
104106 using ( var scope = new Scope ( ) )
105107 {
106108 unsafe
107109 {
108110 Interop . Methods . temporal_core_worker_replace_client (
109111 scope . Pointer ( Handle ) ,
110- scope . Pointer ( client . Handle ) ) ;
112+ scope . Pointer ( clientHandle ) ) ;
111113 }
112114 }
113115 }
@@ -434,7 +436,8 @@ public void Dispose()
434436 }
435437
436438 private static unsafe SafeHandleReference < SafeWorkerHandle > CreateWorkerHandle (
437- Client client ,
439+ Runtime runtime ,
440+ SafeClientHandle clientHandle ,
438441 string @namespace ,
439442 Temporalio . Worker . TemporalWorkerOptions options ,
440443 ILoggerFactory loggerFactory ,
@@ -443,13 +446,13 @@ private static unsafe SafeHandleReference<SafeWorkerHandle> CreateWorkerHandle(
443446 using Scope scope = new ( ) ;
444447
445448 var workerOrFail = Interop . Methods . temporal_core_worker_new (
446- scope . Pointer ( client . Handle ) ,
449+ scope . Pointer ( clientHandle ) ,
447450 scope . Pointer ( options . ToInteropOptions ( scope , @namespace , loggerFactory , clientPlugins ) ) ) ;
448451
449452 if ( workerOrFail . fail != null )
450453 {
451454 string failStr ;
452- using ( var byteArray = new ByteArray ( client . Runtime , workerOrFail . fail ) )
455+ using ( var byteArray = new ByteArray ( runtime , workerOrFail . fail ) )
453456 {
454457 failStr = byteArray . ToUTF8 ( ) ;
455458 }
0 commit comments