Exception newExceptionForNodeFailure(HostConnection expectedSource,
String op, int isolationLevel, Throwable cause, boolean snappyException) {
final HostConnection source = this.currentHostConnection;
String opNode = op + " {current node = " + source + '}';
if (isolationLevel == Connection.TRANSACTION_NONE) {
String err = expectedSource
+ (cause instanceof TException ? " {caused by: "
+ ThriftExceptionUtil.getExceptionString(cause) + '}' : "");
return snappyException ? ThriftExceptionUtil.newSnappyException(
SQLState.GFXD_NODE_SHUTDOWN, cause,
source != null ? source.hostAddr.toString() : null, err, op)
: ThriftExceptionUtil.newSQLException(SQLState.GFXD_NODE_SHUTDOWN,
cause, err, opNode);
} else {
String err = " operation=" + opNode
+ (cause instanceof TException ? " caused by: "
+ ThriftExceptionUtil.getExceptionString(cause) : "");
return snappyException ? ThriftExceptionUtil.newSnappyException(
SQLState.DATA_CONTAINER_CLOSED, cause, source != null
? source.hostAddr.toString() : null, expectedSource, err)
: ThriftExceptionUtil.newSQLException(SQLState.DATA_CONTAINER_CLOSED,
cause, expectedSource, err);
}
}