use of org.apache.ignite.internal.processors.odbc.ClientListenerResponseSender in project ignite by apache.
the class JdbcConnectionContext method initializeFromHandshake.
/**
* {@inheritDoc}
*/
@Override
public void initializeFromHandshake(GridNioSession ses, ClientListenerProtocolVersion ver, BinaryReaderExImpl reader) throws IgniteCheckedException {
assert SUPPORTED_VERS.contains(ver) : "Unsupported JDBC protocol version.";
boolean distributedJoins = reader.readBoolean();
boolean enforceJoinOrder = reader.readBoolean();
boolean collocated = reader.readBoolean();
boolean replicatedOnly = reader.readBoolean();
boolean autoCloseCursors = reader.readBoolean();
boolean lazyExec = false;
boolean skipReducerOnUpdate = false;
NestedTxMode nestedTxMode = NestedTxMode.DEFAULT;
if (ver.compareTo(VER_2_1_5) >= 0)
lazyExec = reader.readBoolean();
if (ver.compareTo(VER_2_3_0) >= 0)
skipReducerOnUpdate = reader.readBoolean();
if (ver.compareTo(VER_2_7_0) >= 0) {
String nestedTxModeName = reader.readString();
if (!F.isEmpty(nestedTxModeName)) {
try {
nestedTxMode = NestedTxMode.valueOf(nestedTxModeName);
} catch (IllegalArgumentException e) {
throw new IgniteCheckedException("Invalid nested transactions handling mode: " + nestedTxModeName);
}
}
}
Boolean dataPageScanEnabled = null;
Integer updateBatchSize = null;
EnumSet<JdbcThinFeature> features = EnumSet.noneOf(JdbcThinFeature.class);
if (ver.compareTo(VER_2_8_0) >= 0) {
dataPageScanEnabled = nullableBooleanFromByte(reader.readByte());
updateBatchSize = JdbcUtils.readNullableInteger(reader);
}
if (ver.compareTo(VER_2_9_0) >= 0) {
userAttrs = reader.readMap();
byte[] cliFeatures = reader.readByteArray();
features = JdbcThinFeature.enumSet(cliFeatures);
}
if (ver.compareTo(VER_2_5_0) >= 0) {
String user = null;
String passwd = null;
try {
if (reader.available() > 0) {
user = reader.readString();
passwd = reader.readString();
}
} catch (Exception e) {
throw new IgniteCheckedException("Handshake error: " + e.getMessage(), e);
}
authenticate(ses, user, passwd);
}
protoCtx = new JdbcProtocolContext(ver, features, true);
initClientDescriptor("jdbc-thin");
parser = new JdbcMessageParser(ctx, protoCtx);
ClientListenerResponseSender sender = new ClientListenerResponseSender() {
@Override
public void send(ClientListenerResponse resp) {
if (resp != null) {
if (log.isDebugEnabled())
log.debug("Async response: [resp=" + resp.status() + ']');
ses.send(parser.encode(resp));
}
}
};
handler = new JdbcRequestHandler(busyLock, sender, maxCursors, distributedJoins, enforceJoinOrder, collocated, replicatedOnly, autoCloseCursors, lazyExec, skipReducerOnUpdate, nestedTxMode, dataPageScanEnabled, updateBatchSize, ver, this);
handler.start();
}
use of org.apache.ignite.internal.processors.odbc.ClientListenerResponseSender in project ignite by apache.
the class OdbcConnectionContext method initializeFromHandshake.
/**
* {@inheritDoc}
*/
@Override
public void initializeFromHandshake(GridNioSession ses, ClientListenerProtocolVersion ver, BinaryReaderExImpl reader) throws IgniteCheckedException {
assert SUPPORTED_VERS.contains(ver) : "Unsupported ODBC protocol version.";
boolean distributedJoins = reader.readBoolean();
boolean enforceJoinOrder = reader.readBoolean();
boolean replicatedOnly = reader.readBoolean();
boolean collocated = reader.readBoolean();
boolean lazy = false;
if (ver.compareTo(VER_2_1_5) >= 0)
lazy = reader.readBoolean();
boolean skipReducerOnUpdate = false;
if (ver.compareTo(VER_2_3_0) >= 0)
skipReducerOnUpdate = reader.readBoolean();
String user = null;
String passwd = null;
NestedTxMode nestedTxMode = NestedTxMode.DEFAULT;
if (ver.compareTo(VER_2_5_0) >= 0) {
user = reader.readString();
passwd = reader.readString();
}
if (ver.compareTo(VER_2_7_0) >= 0) {
byte nestedTxModeVal = reader.readByte();
nestedTxMode = NestedTxMode.fromByte(nestedTxModeVal);
}
authenticate(ses, user, passwd);
ClientListenerResponseSender sender = new ClientListenerResponseSender() {
@Override
public void send(ClientListenerResponse resp) {
if (resp != null) {
if (log.isDebugEnabled())
log.debug("Async response: [resp=" + resp.status() + ']');
ses.send(parser.encode(resp));
}
}
};
initClientDescriptor("odbc");
handler = new OdbcRequestHandler(ctx, busyLock, sender, maxCursors, distributedJoins, enforceJoinOrder, replicatedOnly, collocated, lazy, skipReducerOnUpdate, nestedTxMode, ver, this);
parser = new OdbcMessageParser(ctx, ver);
handler.start();
}
Aggregations