ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] nizhikov commented on a change in pull request #6898: IGNITE-12211: Client connections system view
Date Tue, 24 Sep 2019 16:25:35 GMT
nizhikov commented on a change in pull request #6898: IGNITE-12211: Client connections system
view
URL: https://github.com/apache/ignite/pull/6898#discussion_r327712795
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ClientConnectionView.java
 ##########
 @@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.spi.systemview.view;
+
+import java.net.InetSocketAddress;
+import org.apache.ignite.internal.processors.authentication.AuthorizationContext;
+import org.apache.ignite.internal.processors.odbc.ClientListenerConnectionContext;
+import org.apache.ignite.internal.processors.odbc.ClientListenerProtocolVersion;
+import org.apache.ignite.internal.util.nio.GridNioSession;
+import org.jetbrains.annotations.Nullable;
+
+import static org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.CONN_CTX_META_KEY;
+import static org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.JDBC_CLIENT;
+import static org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.ODBC_CLIENT;
+import static org.apache.ignite.internal.processors.odbc.ClientListenerNioListener.THIN_CLIENT;
+
+/**
+ * Client connection system view row.
+ */
+public class ClientConnectionView {
+    /** Nio session. */
+    private final GridNioSession ses;
+
+    /** Connection context. */
+    @Nullable private final ClientListenerConnectionContext ctx;
+
+    /** @param ses Nio session. */
+    public ClientConnectionView(GridNioSession ses) {
+        this.ses = ses;
+        this.ctx = ses.meta(CONN_CTX_META_KEY);
+    }
+
+    /** @return Connection id. */
+    public long connectionId() {
+        if (ctx == null)
+            return -1;
+
+        return ctx.connectionId();
+    }
+
+    /** @return Connection type. */
+    public String type() {
+        if (ctx == null)
+            return null;
+
+        switch (ctx.type()) {
 
 Review comment:
   I just want to reuse existing code here.
   No need to introduce new enum with the same values as byte constants.
   What do you think?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message