Search in sources :

Example 1 with OdbcConnectionContext

use of org.apache.ignite.internal.processors.odbc.odbc.OdbcConnectionContext in project ignite by apache.

the class ClientListenerProcessor method clientConnectionDescription.

/**
 * Compose connection description string.
 * @param ses Client's NIO session.
 * @param ctx Client's connection context.
 * @return connection description.
 */
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
private static String clientConnectionDescription(GridNioSession ses, ClientListenerConnectionContext ctx) {
    StringBuilder sb = new StringBuilder();
    if (ctx instanceof JdbcConnectionContext)
        sb.append("JdbcClient [");
    else if (ctx instanceof OdbcConnectionContext)
        sb.append("OdbcClient [");
    else
        sb.append("ThinClient [");
    InetSocketAddress rmtAddr = ses.remoteAddress();
    InetSocketAddress locAddr = ses.localAddress();
    assert rmtAddr != null;
    assert locAddr != null;
    String rmtAddrStr = rmtAddr.getHostString() + ":" + rmtAddr.getPort();
    String locAddrStr = locAddr.getHostString() + ":" + locAddr.getPort();
    String login = ctx.securityContext() == null ? "<anonymous>" : "@" + ctx.securityContext().subject().login();
    sb.append("id=" + ctx.connectionId());
    sb.append(", user=").append(login);
    sb.append(", rmtAddr=" + rmtAddrStr);
    sb.append(", locAddr=" + locAddrStr);
    return sb.append(']').toString();
}
Also used : OdbcConnectionContext(org.apache.ignite.internal.processors.odbc.odbc.OdbcConnectionContext) InetSocketAddress(java.net.InetSocketAddress) JdbcConnectionContext(org.apache.ignite.internal.processors.odbc.jdbc.JdbcConnectionContext)

Aggregations

InetSocketAddress (java.net.InetSocketAddress)1 JdbcConnectionContext (org.apache.ignite.internal.processors.odbc.jdbc.JdbcConnectionContext)1 OdbcConnectionContext (org.apache.ignite.internal.processors.odbc.odbc.OdbcConnectionContext)1