Search in sources :

Example 1 with OperationType

use of org.apache.bookkeeper.proto.BookkeeperProtocol.OperationType in project bookkeeper by apache.

the class PerChannelBookieClient method readV2Response.

private void readV2Response(final BookieProtocol.Response response) {
    OperationType operationType = getOperationType(response.getOpCode());
    StatusCode status = getStatusCodeFromErrorCode(response.errorCode);
    CompletionKey key = acquireV2Key(response.ledgerId, response.entryId, operationType);
    CompletionValue completionValue = completionObjects.remove(key);
    key.release();
    if (completionValue == null) {
        // If there's no completion object here, try in the multimap
        synchronized (this) {
            if (completionObjectsV2Conflicts.containsKey(key)) {
                completionValue = completionObjectsV2Conflicts.get(key).get(0);
                completionObjectsV2Conflicts.remove(key, completionValue);
            }
        }
    }
    if (null == completionValue) {
        // Unexpected response, so log it. The txnId should have been present.
        if (LOG.isDebugEnabled()) {
            LOG.debug("Unexpected response received from bookie : " + addr + " for type : " + operationType + " and ledger:entry : " + response.ledgerId + ":" + response.entryId);
        }
        response.release();
    } else {
        long orderingKey = completionValue.ledgerId;
        executor.executeOrdered(orderingKey, ReadV2ResponseCallback.create(completionValue, response.ledgerId, response.entryId, status, response));
    }
}
Also used : OperationType(org.apache.bookkeeper.proto.BookkeeperProtocol.OperationType) StatusCode(org.apache.bookkeeper.proto.BookkeeperProtocol.StatusCode)

Aggregations

OperationType (org.apache.bookkeeper.proto.BookkeeperProtocol.OperationType)1 StatusCode (org.apache.bookkeeper.proto.BookkeeperProtocol.StatusCode)1