public void setOutputMapping(final int contextThreadLocalId, final int logicalId, final int threadLocalId) {
        if (queueIdMapping.length <= contextThreadLocalId) {
            queueIdMapping = Arrays.copyOf(queueIdMapping, contextThreadLocalId + 1);
        }
        if (queueIdMapping[contextThreadLocalId] == null) {
            queueIdMapping[contextThreadLocalId] = new int[logicalId + 1];
        } else if (queueIdMapping[contextThreadLocalId].length <= logicalId) {
            queueIdMapping[contextThreadLocalId] = Arrays.copyOf(queueIdMapping[contextThreadLocalId], logicalId + 1);
        }

        queueIdMapping[contextThreadLocalId][logicalId] = threadLocalId;
    }