use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.
the class JdbcBinaryTypePutRequest method readBinary.
/**
* {@inheritDoc}
*/
@Override
public void readBinary(BinaryReaderExImpl reader, JdbcProtocolContext protoCtx) throws BinaryObjectException {
super.readBinary(reader, protoCtx);
meta = new BinaryMetadata();
try {
meta.readFrom(reader);
} catch (IOException e) {
throw new BinaryObjectException(e);
}
}
use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.
the class JdbcQueryExecuteRequest method readBinary.
/**
* {@inheritDoc}
*/
@Override
public void readBinary(BinaryReaderExImpl reader, JdbcProtocolContext protoCtx) throws BinaryObjectException {
super.readBinary(reader, protoCtx);
schemaName = reader.readString();
pageSize = reader.readInt();
maxRows = reader.readInt();
sqlQry = reader.readString();
int argsNum = reader.readInt();
args = new Object[argsNum];
for (int i = 0; i < argsNum; ++i) args[i] = JdbcUtils.readObject(reader, protoCtx);
if (protoCtx.isAutoCommitSupported())
autoCommit = reader.readBoolean();
try {
if (reader.available() > 0)
stmtType = JdbcStatementType.fromOrdinal(reader.readByte());
else
stmtType = JdbcStatementType.ANY_STATEMENT_TYPE;
} catch (IOException e) {
throw new BinaryObjectException(e);
}
if (protoCtx.isAffinityAwarenessSupported())
partResReq = reader.readBoolean();
if (protoCtx.features().contains(JdbcThinFeature.QUERY_TIMEOUT))
explicitTimeout = reader.readBoolean();
}
use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.
the class JdbcBulkLoadAckResult method readBinary.
/**
* {@inheritDoc}
*/
@Override
public void readBinary(BinaryReaderExImpl reader, JdbcProtocolContext protoCtx) throws BinaryObjectException {
super.readBinary(reader, protoCtx);
cursorId = reader.readLong();
String locFileName = reader.readString();
int batchSize = reader.readInt();
if (!BulkLoadAckClientParameters.isValidPacketSize(batchSize))
throw new BinaryObjectException(BulkLoadAckClientParameters.packetSizeErrorMesssage(batchSize));
params = new BulkLoadAckClientParameters(locFileName, batchSize);
}
use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.
the class ClientBinary method buildEnum.
/**
* {@inheritDoc}
*/
@Override
public BinaryObject buildEnum(String typeName, String name) {
if (typeName == null || typeName.isEmpty())
throw new IllegalArgumentException("typeName");
if (name == null || name.isEmpty())
throw new IllegalArgumentException("name");
BinaryContext ctx = marsh.context();
int typeId = ctx.typeId(typeName);
BinaryMetadata metadata = ctx.metadata0(typeId);
if (metadata == null)
throw new BinaryObjectException(String.format("Failed to get metadata for type [typeId=%s, typeName='%s']", typeId, typeName));
Integer ordinal = metadata.getEnumOrdinalByName(name);
if (ordinal == null)
throw new BinaryObjectException(String.format("Failed to resolve enum ordinal by name [typeId=%s, typeName='%s', name='%s']", typeId, typeName, name));
return new BinaryEnumObjectImpl(ctx, typeId, null, ordinal);
}
use of org.apache.ignite.binary.BinaryObjectException in project ignite by apache.
the class CacheObjectBinaryProcessorImpl method addMetaLocally.
/**
* {@inheritDoc}
*/
@Override
public void addMetaLocally(int typeId, BinaryType newMeta) throws BinaryObjectException {
assert newMeta != null;
assert newMeta instanceof BinaryTypeImpl;
BinaryMetadata newMeta0 = ((BinaryTypeImpl) newMeta).metadata();
BinaryMetadataHolder metaHolder = metadataLocCache.get(typeId);
BinaryMetadata oldMeta = metaHolder != null ? metaHolder.metadata() : null;
try {
BinaryMetadata mergedMeta = mergeMetadata(oldMeta, newMeta0);
if (!ctx.clientNode())
metadataFileStore.mergeAndWriteMetadata(mergedMeta);
metadataLocCache.put(typeId, new BinaryMetadataHolder(mergedMeta, 0, 0));
} catch (BinaryObjectException e) {
throw new BinaryObjectException("New binary metadata is incompatible with binary metadata" + " persisted locally." + " Consider cleaning up persisted metadata from <workDir>/db/binary_meta directory.", e);
}
}
Aggregations