Search in sources :

Example 1 with SqlListenerProtocolVersion

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

the class JdbcThinTcpIo method handshake.

/**
     * @throws IOException On error.
     * @throws IgniteCheckedException On error.
     */
public void handshake() throws IOException, IgniteCheckedException {
    BinaryWriterExImpl writer = new BinaryWriterExImpl(null, new BinaryHeapOutputStream(HANDSHAKE_MSG_SIZE), null, null);
    writer.writeByte((byte) SqlListenerRequest.HANDSHAKE);
    writer.writeShort(CURRENT_VER.major());
    writer.writeShort(CURRENT_VER.minor());
    writer.writeShort(CURRENT_VER.maintenance());
    writer.writeByte(SqlListenerNioListener.JDBC_CLIENT);
    writer.writeBoolean(distributedJoins);
    writer.writeBoolean(enforceJoinOrder);
    send(writer.array());
    BinaryReaderExImpl reader = new BinaryReaderExImpl(null, new BinaryHeapInputStream(read()), null, null, false);
    boolean accepted = reader.readBoolean();
    if (accepted)
        return;
    short maj = reader.readShort();
    short min = reader.readShort();
    short maintenance = reader.readShort();
    String err = reader.readString();
    SqlListenerProtocolVersion ver = SqlListenerProtocolVersion.create(maj, min, maintenance);
    throw new IgniteCheckedException("Handshake failed [driverProtocolVer=" + CURRENT_VER + ", remoteNodeProtocolVer=" + ver + ", err=" + err + ']');
}
Also used : SqlListenerProtocolVersion(org.apache.ignite.internal.processors.odbc.SqlListenerProtocolVersion) BinaryReaderExImpl(org.apache.ignite.internal.binary.BinaryReaderExImpl) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) BinaryHeapOutputStream(org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream) BinaryHeapInputStream(org.apache.ignite.internal.binary.streams.BinaryHeapInputStream) BinaryWriterExImpl(org.apache.ignite.internal.binary.BinaryWriterExImpl)

Aggregations

IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 BinaryReaderExImpl (org.apache.ignite.internal.binary.BinaryReaderExImpl)1 BinaryWriterExImpl (org.apache.ignite.internal.binary.BinaryWriterExImpl)1 BinaryHeapInputStream (org.apache.ignite.internal.binary.streams.BinaryHeapInputStream)1 BinaryHeapOutputStream (org.apache.ignite.internal.binary.streams.BinaryHeapOutputStream)1 SqlListenerProtocolVersion (org.apache.ignite.internal.processors.odbc.SqlListenerProtocolVersion)1