本文整理匯總了Java中com.aerospike.client.ResultCode.KEY_NOT_FOUND_ERROR屬性的典型用法代碼示例。如果您正苦於以下問題:Java ResultCode.KEY_NOT_FOUND_ERROR屬性的具體用法?Java ResultCode.KEY_NOT_FOUND_ERROR怎麽用?Java ResultCode.KEY_NOT_FOUND_ERROR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.aerospike.client.ResultCode
的用法示例。
在下文中一共展示了ResultCode.KEY_NOT_FOUND_ERROR屬性的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseResult
protected void parseResult(Connection conn) throws AerospikeException, IOException {
// Read header.
conn.readFully(dataBuffer, MSG_TOTAL_HEADER_SIZE);
int resultCode = dataBuffer[13] & 0xFF;
if (resultCode == 0) {
int generation = Buffer.bytesToInt(dataBuffer, 14);
int expiration = Buffer.bytesToInt(dataBuffer, 18);
record = new Record(null, null, generation, expiration);
}
else {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
record = null;
}
else {
throw new AerospikeException(resultCode);
}
}
emptySocket(conn);
}
示例2: parseResult
protected final void parseResult(ByteBuffer byteBuffer) throws AerospikeException {
int resultCode = byteBuffer.get(5) & 0xFF;
if (resultCode == 0) {
int generation = byteBuffer.getInt(6);
int expiration = byteBuffer.getInt(10);
record = new Record(null, null, generation, expiration);
}
else {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
record = null;
}
else {
throw new AerospikeException(resultCode);
}
}
}
示例3: parseResult
protected void parseResult(Connection conn) throws AerospikeException, IOException {
// Read header.
conn.readFully(dataBuffer, MSG_TOTAL_HEADER_SIZE);
int resultCode = dataBuffer[13] & 0xFF;
if (resultCode != 0 && resultCode != ResultCode.KEY_NOT_FOUND_ERROR) {
throw new AerospikeException(resultCode);
}
exists = resultCode == 0;
emptySocket(conn);
}
示例4: parseResult
protected void parseResult(Connection conn) throws AerospikeException, IOException {
// Read header.
conn.readFully(dataBuffer, MSG_TOTAL_HEADER_SIZE);
int resultCode = dataBuffer[13] & 0xFF;
if (resultCode != 0 && resultCode != ResultCode.KEY_NOT_FOUND_ERROR) {
throw new AerospikeException(resultCode);
}
existed = resultCode == 0;
emptySocket(conn);
}
示例5: parseResult
protected void parseResult(ByteBuffer byteBuffer) throws AerospikeException {
int resultCode = byteBuffer.get(5) & 0xFF;
if (resultCode == 0) {
existed = true;
}
else {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
existed = false;
}
else {
throw new AerospikeException(resultCode);
}
}
}
示例6: parseResult
protected void parseResult(ByteBuffer byteBuffer) throws AerospikeException {
int resultCode = byteBuffer.get(5) & 0xFF;
if (resultCode == 0) {
exists = true;
}
else {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
exists = false;
}
else {
throw new AerospikeException(resultCode);
}
}
}
示例7: parseResult
protected final void parseResult(ByteBuffer byteBuffer) throws AerospikeException {
dataBuffer = ThreadLocalData.getBuffer();
if (receiveSize > dataBuffer.length) {
dataBuffer = ThreadLocalData.resizeBuffer(receiveSize);
}
// Copy entire message to dataBuffer.
byteBuffer.position(0);
byteBuffer.get(dataBuffer, 0, receiveSize);
int resultCode = dataBuffer[5] & 0xFF;
int generation = Buffer.bytesToInt(dataBuffer, 6);
int expiration = Buffer.bytesToInt(dataBuffer, 10);
int fieldCount = Buffer.bytesToShort(dataBuffer, 18);
int opCount = Buffer.bytesToShort(dataBuffer, 20);
dataOffset = Command.MSG_REMAINING_HEADER_SIZE;
if (resultCode == 0) {
if (opCount == 0) {
// Bin data was not returned.
record = new Record(null, null, generation, expiration);
}
else {
record = parseRecord(opCount, fieldCount, generation, expiration);
}
}
else {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
record = null;
}
else {
throw new AerospikeException(resultCode);
}
}
}
示例8: parseGroup
private final boolean parseGroup() throws AerospikeException {
// Parse each message response and add it to the result array
receiveOffset = 0;
while (receiveOffset < receiveSize) {
resultCode = receiveBuffer[receiveOffset + 5] & 0xFF;
if (resultCode != 0) {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
if (stopOnNotFound) {
return true;
}
}
else {
throw new AerospikeException(resultCode);
}
}
// If this is the end marker of the response, do not proceed further
if ((receiveBuffer[receiveOffset + 3] & Command.INFO3_LAST) != 0) {
return true;
}
generation = Buffer.bytesToInt(receiveBuffer, receiveOffset + 6);
expiration = Buffer.bytesToInt(receiveBuffer, receiveOffset + 10);
fieldCount = Buffer.bytesToShort(receiveBuffer, receiveOffset + 18);
opCount = Buffer.bytesToShort(receiveBuffer, receiveOffset + 20);
receiveOffset += Command.MSG_REMAINING_HEADER_SIZE;
Key key = parseKey();
parseRow(key);
}
return false;
}
示例9: parseRecordResults
@Override
protected boolean parseRecordResults(int receiveSize)
throws AerospikeException, IOException {
// Server commands (Query/Execute UDF) should only send back a return code.
// Keep parsing logic to empty socket buffer just in case server does
// send records back.
dataOffset = 0;
while (dataOffset < receiveSize) {
readBytes(MSG_REMAINING_HEADER_SIZE);
int resultCode = dataBuffer[5] & 0xFF;
if (resultCode != 0) {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
return false;
}
throw new AerospikeException(resultCode);
}
byte info3 = dataBuffer[3];
// If this is the end marker of the response, do not proceed further
if ((info3 & Command.INFO3_LAST) == Command.INFO3_LAST) {
return false;
}
int fieldCount = Buffer.bytesToShort(dataBuffer, 18);
int opCount = Buffer.bytesToShort(dataBuffer, 20);
parseKey(fieldCount);
for (int i = 0 ; i < opCount; i++) {
readBytes(8);
int opSize = Buffer.bytesToInt(dataBuffer, 0);
byte nameSize = dataBuffer[7];
readBytes(nameSize);
int particleBytesSize = (int) (opSize - (4 + nameSize));
readBytes(particleBytesSize);
}
if (! valid) {
throw new AerospikeException.QueryTerminated();
}
}
return true;
}
示例10: parseRecordResults
@Override
protected boolean parseRecordResults(int receiveSize)
throws AerospikeException, IOException {
// Read/parse remaining message bytes one record at a time.
dataOffset = 0;
while (dataOffset < receiveSize) {
readBytes(MSG_REMAINING_HEADER_SIZE);
int resultCode = dataBuffer[5] & 0xFF;
if (resultCode != 0) {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
return false;
}
throw new AerospikeException(resultCode);
}
byte info3 = dataBuffer[3];
// If this is the end marker of the response, do not proceed further
if ((info3 & Command.INFO3_LAST) == Command.INFO3_LAST) {
return false;
}
int fieldCount = Buffer.bytesToShort(dataBuffer, 18);
int opCount = Buffer.bytesToShort(dataBuffer, 20);
parseKey(fieldCount);
if (opCount != 1) {
throw new AerospikeException("Query aggregate expected exactly one bin. Received " + opCount);
}
// Parse aggregateValue.
readBytes(8);
int opSize = Buffer.bytesToInt(dataBuffer, 0);
byte particleType = dataBuffer[5];
byte nameSize = dataBuffer[7];
readBytes(nameSize);
String name = Buffer.utf8ToString(dataBuffer, 0, nameSize);
int particleBytesSize = (int) (opSize - (4 + nameSize));
readBytes(particleBytesSize);
if (! name.equals("SUCCESS")) {
if (name.equals("FAILURE")) {
Object value = Buffer.bytesToParticle(particleType, dataBuffer, 0, particleBytesSize);
throw new AerospikeException(ResultCode.QUERY_GENERIC, value.toString());
}
else {
throw new AerospikeException(ResultCode.QUERY_GENERIC, "Query aggregate expected bin name SUCCESS. Received " + name);
}
}
LuaValue aggregateValue = instance.getLuaValue(particleType, dataBuffer, 0, particleBytesSize);
if (! valid) {
throw new AerospikeException.QueryTerminated();
}
if (aggregateValue != null) {
try {
inputQueue.put(aggregateValue);
}
catch (InterruptedException ie) {
}
}
}
return true;
}
示例11: parseRecordResults
protected boolean parseRecordResults(int receiveSize)
throws AerospikeException, IOException {
// Read/parse remaining message bytes one record at a time.
dataOffset = 0;
while (dataOffset < receiveSize) {
readBytes(MSG_REMAINING_HEADER_SIZE);
int resultCode = dataBuffer[5] & 0xFF;
if (resultCode != 0) {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
return false;
}
throw new AerospikeException(resultCode);
}
byte info3 = dataBuffer[3];
// If this is the end marker of the response, do not proceed further
if ((info3 & Command.INFO3_LAST) == Command.INFO3_LAST) {
return false;
}
int generation = Buffer.bytesToInt(dataBuffer, 6);
int expiration = Buffer.bytesToInt(dataBuffer, 10);
int fieldCount = Buffer.bytesToShort(dataBuffer, 18);
int opCount = Buffer.bytesToShort(dataBuffer, 20);
Key key = parseKey(fieldCount);
// Parse bins.
Map<String,Object> bins = null;
for (int i = 0 ; i < opCount; i++) {
readBytes(8);
int opSize = Buffer.bytesToInt(dataBuffer, 0);
byte particleType = dataBuffer[5];
byte nameSize = dataBuffer[7];
readBytes(nameSize);
String name = Buffer.utf8ToString(dataBuffer, 0, nameSize);
int particleBytesSize = (int) (opSize - (4 + nameSize));
readBytes(particleBytesSize);
Object value = Buffer.bytesToParticle(particleType, dataBuffer, 0, particleBytesSize);
if (bins == null) {
bins = new HashMap<String,Object>();
}
bins.put(name, value);
}
Record record = new Record(bins, null, generation, expiration);
if (! valid) {
throw new AerospikeException.QueryTerminated();
}
if (! recordSet.put(new KeyRecord(key, record))) {
stop();
throw new AerospikeException.QueryTerminated();
}
}
return true;
}
示例12: parseRecordResults
protected boolean parseRecordResults(int receiveSize)
throws AerospikeException, IOException {
// Read/parse remaining message bytes one record at a time.
dataOffset = 0;
while (dataOffset < receiveSize) {
readBytes(MSG_REMAINING_HEADER_SIZE);
int resultCode = dataBuffer[5] & 0xFF;
if (resultCode != 0) {
if (resultCode == ResultCode.KEY_NOT_FOUND_ERROR) {
return false;
}
throw new AerospikeException(resultCode);
}
byte info3 = dataBuffer[3];
// If this is the end marker of the response, do not proceed further
if ((info3 & Command.INFO3_LAST) == Command.INFO3_LAST) {
return false;
}
int generation = Buffer.bytesToInt(dataBuffer, 6);
int expiration = Buffer.bytesToInt(dataBuffer, 10);
int fieldCount = Buffer.bytesToShort(dataBuffer, 18);
int opCount = Buffer.bytesToShort(dataBuffer, 20);
Key key = parseKey(fieldCount);
// Parse bins.
Map<String,Object> bins = null;
for (int i = 0 ; i < opCount; i++) {
readBytes(8);
int opSize = Buffer.bytesToInt(dataBuffer, 0);
byte particleType = dataBuffer[5];
byte nameSize = dataBuffer[7];
readBytes(nameSize);
String name = Buffer.utf8ToString(dataBuffer, 0, nameSize);
int particleBytesSize = (int) (opSize - (4 + nameSize));
readBytes(particleBytesSize);
Object value = Buffer.bytesToParticle(particleType, dataBuffer, 0, particleBytesSize);
if (bins == null) {
bins = new HashMap<String,Object>();
}
bins.put(name, value);
}
if (! valid) {
throw new AerospikeException.ScanTerminated();
}
// Call the callback function.
callback.scanCallback(key, new Record(bins, null, generation, expiration));
}
return true;
}
示例13: parseRecordResults
/**
* Parse all results in the batch. Add records to shared list.
* If the record was not found, the bins will be null.
*/
protected boolean parseRecordResults(int receiveSize) throws AerospikeException, IOException {
//Parse each message response and add it to the result array
dataOffset = 0;
while (dataOffset < receiveSize) {
readBytes(MSG_REMAINING_HEADER_SIZE);
int resultCode = dataBuffer[5] & 0xFF;
// The only valid server return codes are "ok" and "not found".
// If other return codes are received, then abort the batch.
if (resultCode != 0 && resultCode != ResultCode.KEY_NOT_FOUND_ERROR) {
throw new AerospikeException(resultCode);
}
byte info3 = dataBuffer[3];
// If this is the end marker of the response, do not proceed further
if ((info3 & Command.INFO3_LAST) == Command.INFO3_LAST) {
return false;
}
int generation = Buffer.bytesToInt(dataBuffer, 6);
int expiration = Buffer.bytesToInt(dataBuffer, 10);
int fieldCount = Buffer.bytesToShort(dataBuffer, 18);
int opCount = Buffer.bytesToShort(dataBuffer, 20);
Key key = parseKey(fieldCount);
BatchItem item = keyMap.get(key);
if (item != null) {
if (resultCode == 0) {
int index = item.getIndex();
records[index] = parseRecord(opCount, generation, expiration);
}
}
else {
if (Log.debugEnabled()) {
Log.debug("Unexpected batch key returned: " + key.namespace + ',' + Buffer.bytesToHexString(key.digest));
}
}
}
return true;
}
示例14: parseRecordResults
/**
* Parse all results in the batch. Add records to shared list.
* If the record was not found, the bins will be null.
*/
protected boolean parseRecordResults(int receiveSize) throws AerospikeException, IOException {
//Parse each message response and add it to the result array
dataOffset = 0;
while (dataOffset < receiveSize) {
if (! valid) {
throw new AerospikeException.QueryTerminated();
}
readBytes(MSG_REMAINING_HEADER_SIZE);
int resultCode = dataBuffer[5] & 0xFF;
// The only valid server return codes are "ok" and "not found".
// If other return codes are received, then abort the batch.
if (resultCode != 0 && resultCode != ResultCode.KEY_NOT_FOUND_ERROR) {
throw new AerospikeException(resultCode);
}
byte info3 = dataBuffer[3];
// If this is the end marker of the response, do not proceed further
if ((info3 & Command.INFO3_LAST) == Command.INFO3_LAST) {
return false;
}
int fieldCount = Buffer.bytesToShort(dataBuffer, 18);
int opCount = Buffer.bytesToShort(dataBuffer, 20);
if (opCount > 0) {
throw new AerospikeException.Parse("Received bins that were not requested!");
}
Key key = parseKey(fieldCount);
BatchItem item = keyMap.get(key);
if (item != null) {
int index = item.getIndex();
existsArray[index] = resultCode == 0;
}
else {
if (Log.debugEnabled()) {
Log.debug("Unexpected batch key returned: " + key.namespace + ',' + Buffer.bytesToHexString(key.digest));
}
}
}
return true;
}