paulirwin commented on code in PR #1170:
URL: https://github.com/apache/lucenenet/pull/1170#discussion_r2301531579


##########
src/Lucene.Net.Replicator/SessionToken.cs:
##########
@@ -112,6 +114,33 @@ public void Serialize(DataOutputStream writer)
             }
         }
 
+        /// <summary>
+        /// Asynchronously serialize the token data for communication between 
server and client.
+        /// </summary>
+        /// <param name="output">The <see cref="Stream"/> to write the token 
data to.</param>
+        /// <param name="cancellationToken">A cancellation token to observe 
while waiting for the flush to complete.</param>
+        /// <returns>A task representing the asynchronous operation.</returns>
+        public async Task SerializeAsync(Stream output, CancellationToken 
cancellationToken = default)
+        {
+            using var writer = new DataOutputStream(output);
+            writer.WriteUTF(Id);

Review Comment:
   I forgot that DataOutputStream is part of J2N. That's unfortunate, as we'd 
need to cascade yet another PR and release to fix this. I'd like to get this 
fixed sooner than a J2N release so we can wrap up this GSoC work without having 
this async problem hanging over us. Since we only need WriteUTF and WriteInt32 
**(edit: and WriteInt64)**, I wonder if we can temporarily copy the logic into 
Lucene.NET from J2N as private methods in this type with a comment that they 
should be replaced with J2N methods later, and remove the use of 
DataOutputStream entirely. The locking provided by DataOutputStream is not 
needed since the type is only used within this method as a local variable.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to