Flaugh24 commented on code in PR #1918:
URL: https://github.com/apache/ignite-3/pull/1918#discussion_r1161700191


##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java:
##########
@@ -608,4 +637,46 @@ public void exceptionCaught(ChannelHandlerContext ctx, 
Throwable cause) {
 
         ctx.close();
     }
+
+    @Override
+    public CompletableFuture<?> 
onUpdate(ConfigurationNotificationEvent<AuthenticationView> ctx) {
+        return CompletableFuture.runAsync(() -> {

Review Comment:
   Done



##########
modules/client-handler/src/main/java/org/apache/ignite/client/handler/ClientInboundMessageHandler.java:
##########
@@ -608,4 +637,46 @@ public void exceptionCaught(ChannelHandlerContext ctx, 
Throwable cause) {
 
         ctx.close();
     }
+
+    @Override
+    public CompletableFuture<?> 
onUpdate(ConfigurationNotificationEvent<AuthenticationView> ctx) {
+        return CompletableFuture.runAsync(() -> {
+            if (clientContext != null && channelHandlerContext != null) {
+                onAuthenticationChange();
+            }
+        });
+    }
+
+    private void onAuthenticationChange() {
+        channelHandlerContext.close();
+    }
+
+    private Map<Extension, Object> extractExtensions(ClientMessageUnpacker 
unpacker) {
+        EnumMap<Extension, Object> extensions = new EnumMap<>(Extension.class);
+        int mapSize = unpacker.unpackMapHeader();
+        for (int i = 0; i < mapSize; i++) {
+            Extension extension = Extension.fromKey(unpacker.unpackString());
+            extensions.put(extension, unpackExtensionValue(extension, 
unpacker));
+        }
+        return extensions;
+    }
+
+    private Object unpackExtensionValue(Extension extension, 
ClientMessageUnpacker unpacker) {
+        Class<?> type = extension.valueType();
+        if (type == String.class) {
+            return unpacker.unpackString();
+        } else if (type == Integer.class) {
+            return unpacker.unpackInt();
+        } else if (type == Long.class) {
+            return unpacker.unpackLong();
+        } else if (type == Boolean.class) {
+            return unpacker.unpackBoolean();
+        } else if (type == Double.class) {
+            return unpacker.unpackDouble();
+        } else if (type == Float.class) {
+            return unpacker.unpackFloat();

Review Comment:
   Done



-- 
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