refactoring

pull/5708/head^2
Nikita Koksharov 12 months ago
parent 92ac6c5a17
commit 8aa38c5dc3

@ -474,15 +474,12 @@ public class CommandAsyncService implements CommandAsyncExecutor {
return connectionManager.getServiceManager().getCfg().isUseScriptCache(); return connectionManager.getServiceManager().getCfg().isUseScriptCache();
} }
protected Object[] copy(Object[] params) { protected final Object[] copy(Object[] params) {
List<Object> result = new ArrayList<>(); List<Object> result = new ArrayList<>(params.length);
for (Object object : params) { for (Object object : params) {
if (object instanceof ByteBuf) { if (object instanceof ByteBuf) {
ByteBuf b = (ByteBuf) object; ByteBuf b = (ByteBuf) object;
ByteBuf nb = ByteBufAllocator.DEFAULT.buffer(b.readableBytes()); ByteBuf nb = b.copy();
int ri = b.readerIndex();
nb.writeBytes(b);
b.readerIndex(ri);
result.add(nb); result.add(nb);
} else { } else {
result.add(object); result.add(object);

Loading…
Cancel
Save