log.debug("Merge optimieze:merge " + mergeCount + " get commands"); return (Command) commandCollector.getResult();
log.debug("Merge optimieze:merge " + mergeCount + " get commands"); return (Command) commandCollector.getResult();
private Command newMergedCommand(final Map<Object, Command> mergeCommands, int mergeCount, final CommandCollector commandCollector, final CommandType commandType) { if (this.protocol == Protocol.Text) { String resultKey = (String) commandCollector.getResult(); byte[] keyBytes = ByteUtils.getBytes(resultKey); byte[] cmdBytes = commandType == CommandType.GET_ONE ? Constants.GET : Constants.GETS; final byte[] buf = new byte[cmdBytes.length + 3 + keyBytes.length]; ByteUtils.setArguments(buf, 0, cmdBytes, keyBytes); TextGetOneCommand cmd = new TextGetOneCommand(resultKey, keyBytes, commandType, null); cmd.setMergeCommands(mergeCommands); cmd.setWriteFuture(new FutureImpl<Boolean>()); cmd.setMergeCount(mergeCount); cmd.setIoBuffer(IoBuffer.wrap(buf)); return cmd; } else { BinaryGetMultiCommand result = (BinaryGetMultiCommand) commandCollector.getResult(); result.setMergeCount(mergeCount); result.setMergeCommands(mergeCommands); return result; } } }
private Command newMergedCommand(final Map<Object, Command> mergeCommands, int mergeCount, final CommandCollector commandCollector, final CommandType commandType) { if (this.protocol == Protocol.Text) { String resultKey = (String) commandCollector.getResult(); byte[] keyBytes = ByteUtils.getBytes(resultKey); byte[] cmdBytes = commandType == CommandType.GET_ONE ? Constants.GET : Constants.GETS; final byte[] buf = new byte[cmdBytes.length + 3 + keyBytes.length]; ByteUtils.setArguments(buf, 0, cmdBytes, keyBytes); TextGetOneCommand cmd = new TextGetOneCommand(resultKey, keyBytes, commandType, null); cmd.setMergeCommands(mergeCommands); cmd.setWriteFuture(new FutureImpl<Boolean>()); cmd.setMergeCount(mergeCount); cmd.setIoBuffer(IoBuffer.wrap(buf)); return cmd; } else { BinaryGetMultiCommand result = (BinaryGetMultiCommand) commandCollector.getResult(); result.setMergeCount(mergeCount); result.setMergeCommands(mergeCommands); return result; } } }