Package org.apache.ignite.internal.processors.odbc.jdbc

## Class JdbcConnectionContext

- java.lang.Object
- - org.apache.ignite.internal.processors.odbc.ClientListenerAbstractConnectionContext
  - - org.apache.ignite.internal.processors.odbc.jdbc.JdbcConnectionContext

All Implemented Interfaces:
  `ClientListenerConnectionContext`

    public class JdbcConnectionContext
    extends ClientListenerAbstractConnectionContext

JDBC Connection Context.

### Field Summary

Fields
`static ClientListenerProtocolVersion` `CURRENT_VER` Current version.
`static String` `DEFAULT_NESTED_TX_MODE` Default nested tx mode for compatibility.

### Fields inherited from class org.apache.ignite.internal.processors.odbc.ClientListenerAbstractConnectionContext

`ctx, NONE_TX, ses, userAttrs`

### Constructor Summary

Constructors
`JdbcConnectionContext​(GridKernalContext ctx, GridNioSession ses, GridSpinBusyLock busyLock, long connId, int maxCursors)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addTxContext​(ClientTxContext txCtx)` Add new transaction context to connection.
`protected void` `cleanupTxs()`
`byte` `clientType()`
`ClientListenerProtocolVersion` `defaultVersion()`
`AffinityTopologyVersion` `getAffinityTopologyVersionIfChanged()`
`ClientListenerRequestHandler` `handler()` Handler getter.
`void` `initializeFromHandshake​(GridNioSession ses, ClientListenerProtocolVersion ver, BinaryReaderExImpl reader)` Initialize from handshake message.
`boolean` `isVersionSupported​(ClientListenerProtocolVersion ver)`
`void` `onDisconnected()` Called whenever client is disconnected due to correct connection close or due to `IOException` during network operations.
`ClientListenerMessageParser` `parser()` Parser getter
`JdbcProtocolContext` `protocolContext()`
`void` `removeTxContext​(int txId)` Remove transaction context from connection.
`@Nullable ClientTxContext` `txContext​(int txId)` Transaction context by transaction id.

### Methods inherited from class org.apache.ignite.internal.processors.odbc.ClientListenerAbstractConnectionContext

`attributes, authenticate, clientDescriptor, connectionId, initClientDescriptor, kernalContext, nextTxId, securityContext`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### CURRENT_VER

    public static final ClientListenerProtocolVersion CURRENT_VER

Current version.

#### DEFAULT_NESTED_TX_MODE

    public static final String DEFAULT_NESTED_TX_MODE

Default nested tx mode for compatibility.

See Also:
  Constant Field Values

### Constructor Detail

#### JdbcConnectionContext

    public JdbcConnectionContext​(GridKernalContext ctx,
                                 GridNioSession ses,
                                 GridSpinBusyLock busyLock,
                                 long connId,
                                 int maxCursors)

Constructor.

Parameters:
  `ctx` - Kernal Context.
  `ses` - Client's NIO session.
  `busyLock` - Shutdown busy lock.
  `connId` - Connection ID.
  `maxCursors` - Maximum allowed cursors.

### Method Detail

#### clientType

    public byte clientType()

Returns:
  Client type.

#### isVersionSupported

    public boolean isVersionSupported​(ClientListenerProtocolVersion ver)

Parameters:
  `ver` - Version to check.
Returns:
  `true` if version is supported.

#### defaultVersion

    public ClientListenerProtocolVersion defaultVersion()

Returns:
  Current context version.

#### initializeFromHandshake

    public void initializeFromHandshake​(GridNioSession ses,
                                        ClientListenerProtocolVersion ver,
                                        BinaryReaderExImpl reader)
                                 throws IgniteCheckedException

Initialize from handshake message.

Parameters:
  `ses` - NIO session.
  `ver` - Protocol version.
  `reader` - Reader set to the configuration part of the handshake message.
Throws:
  `IgniteCheckedException` - On error.

#### handler

    public ClientListenerRequestHandler handler()

Handler getter.

Returns:
  Request handler for the connection.

#### parser

    public ClientListenerMessageParser parser()

Parser getter

Returns:
  Message parser for the connection.

#### onDisconnected

    public void onDisconnected()

Called whenever client is disconnected due to correct connection close or due to `IOException` during network operations.

Specified by:
  `onDisconnected` in interface `ClientListenerConnectionContext`
Overrides:
  `onDisconnected` in class `ClientListenerAbstractConnectionContext`

#### txContext

    @Nullable
    public @Nullable ClientTxContext txContext​(int txId)

Transaction context by transaction id.

Specified by:
  `txContext` in class `ClientListenerAbstractConnectionContext`
Parameters:
  `txId` - Tx ID.

#### addTxContext

    public void addTxContext​(ClientTxContext txCtx)

Add new transaction context to connection.

Specified by:
  `addTxContext` in class `ClientListenerAbstractConnectionContext`
Parameters:
  `txCtx` - Tx context.

#### removeTxContext

    public void removeTxContext​(int txId)

Remove transaction context from connection.

Specified by:
  `removeTxContext` in class `ClientListenerAbstractConnectionContext`
Parameters:
  `txId` - Tx ID.

#### cleanupTxs

    protected void cleanupTxs()

Specified by:
  `cleanupTxs` in class `ClientListenerAbstractConnectionContext`

#### getAffinityTopologyVersionIfChanged

    public AffinityTopologyVersion getAffinityTopologyVersionIfChanged()

Returns:
  Retrieves current affinity topology version and sets it as a last if it was changed, false otherwise.

#### protocolContext

    public JdbcProtocolContext protocolContext()

Returns:
  Binary context.