Entry entry = commands.get(nodeSource.getEntry()); if (entry == null) { entry = new Entry(); Entry oldEntry = commands.putIfAbsent(nodeSource.getEntry(), entry); if (oldEntry != null) { entry.setReadOnlyMode(false); entry.getCommands().add(commandData);
entry.clearErrors(); NodeSource nodeSource = new NodeSource(ex.getSlot(), ex.getUrl(), Redirect.MOVED); execute(entry, nodeSource, mainPromise, slots, attempt, options); entry.clearErrors(); NodeSource nodeSource = new NodeSource(ex.getSlot(), ex.getUrl(), Redirect.ASK); execute(entry, nodeSource, mainPromise, slots, attempt, options); entry.clearErrors(); execute(entry, source, mainPromise, slots, attempt, options); return; entry.clearErrors(); connectionManager.newTimeout(new TimerTask() { @Override
@Override public void run() { for (Entry entry : commands.values()) { for (BatchCommandData<?, ?> command : entry.getCommands()) { if (command.getPromise().isDone() && !command.getPromise().isSuccess()) { resultPromise.tryFailure(command.getPromise().cause()); for (final Map.Entry<MasterSlaveEntry, Entry> entry : commands.entrySet()) { final RPromise<List<Object>> execPromise = new RedissonPromise<List<Object>>(); async(entry.getValue().isReadOnlyMode(), new NodeSource(entry.getKey()), connectionManager.getCodec(), RedisCommands.EXEC, new Object[] {}, execPromise, 0, false); execPromise.addListener(new FutureListener<List<Object>>() {
int permits = 0; for (Entry entry : commands.values()) { permits += entry.getCommands().size(); }; for (Entry entry : commands.values()) { BatchCommandData<?, ?> multiCommand = new BatchCommandData(RedisCommands.MULTI, new Object[] {}, index.incrementAndGet()); entry.getCommands().addFirst(multiCommand); BatchCommandData<?, ?> execCommand = new BatchCommandData(RedisCommands.EXEC, new Object[] {}, index.incrementAndGet()); entry.getCommands().add(execCommand); for (Entry entry : commands.values()) { BatchCommandData<?, ?> offCommand = new BatchCommandData(RedisCommands.CLIENT_REPLY, new Object[] { "OFF" }, index.incrementAndGet()); entry.getCommands().addFirst(offCommand); BatchCommandData<?, ?> onCommand = new BatchCommandData(RedisCommands.CLIENT_REPLY, new Object[] { "ON" }, index.incrementAndGet()); entry.getCommands().add(onCommand); BatchCommandData<?, ?> waitCommand = new BatchCommandData(RedisCommands.WAIT, new Object[] { this.options.getSyncSlaves(), this.options.getSyncTimeout() }, index.incrementAndGet()); entry.getCommands().add(waitCommand);
entry.isReadOnlyMode(), source, null, null, null, mainPromise, attempt); if (entry.isReadOnlyMode()) { connectionFuture = connectionManager.connectionReadOp(source, null); } else {
@Override public void run() { for (Entry entry : commands.values()) { for (BatchCommandData<?, ?> command : entry.getCommands()) { if (command.getPromise().isDone() && !command.getPromise().isSuccess()) { resultPromise.tryFailure(command.getPromise().cause()); for (final Map.Entry<MasterSlaveEntry, Entry> entry : commands.entrySet()) { final RPromise<List<Object>> execPromise = new RedissonPromise<List<Object>>(); async(entry.getValue().isReadOnlyMode(), new NodeSource(entry.getKey()), connectionManager.getCodec(), RedisCommands.EXEC, new Object[] {}, execPromise, 0, false); execPromise.addListener(new FutureListener<List<Object>>() {
new Object[] { this.options.getSyncSlaves(), this.options.getSyncTimeout() }, index.incrementAndGet()); list.add(waitCommand); entry.getCommands().add(waitCommand); ChannelFuture future = connection.send(new CommandsData(main, list, new ArrayList(entry.getCommands()))); details.setWriteFuture(future); } else {
list.add(new CommandData<Void, Void>(promise, StringCodec.INSTANCE, RedisCommands.ASKING, new Object[] {})); for (BatchCommandData<?, ?> c : entry.getCommands()) { if (c.getPromise().isSuccess() && !isWaitCommand(c) && !isAtomic) { releaseConnection(source, connFuture, entry.isReadOnlyMode(), attemptPromise, details);
entry.clearErrors(); NodeSource nodeSource = new NodeSource(ex.getSlot(), ex.getUrl(), Redirect.MOVED); execute(entry, nodeSource, mainPromise, slots, attempt, options); entry.clearErrors(); NodeSource nodeSource = new NodeSource(ex.getSlot(), ex.getUrl(), Redirect.ASK); execute(entry, nodeSource, mainPromise, slots, attempt, options); || future.cause() instanceof RedisTryAgainException) { if (details.getAttempt() < connectionManager.getConfig().getRetryAttempts()) { entry.clearErrors(); connectionManager.newTimeout(new TimerTask() { @Override
entries.addAll(e.getCommands());
Entry entry = commands.get(nodeSource.getEntry()); if (entry == null) { entry = new Entry(); Entry oldEntry = commands.putIfAbsent(nodeSource.getEntry(), entry); if (oldEntry != null) { entry.setReadOnlyMode(false); entry.getCommands().add(commandData);
protected void free(final Entry entry) { for (BatchCommandData<?, ?> command : entry.getCommands()) { free(command.getParams()); } }
int permits = 0; for (Entry entry : commands.values()) { permits += entry.getCommands().size(); }; for (Entry entry : commands.values()) { BatchCommandData<?, ?> multiCommand = new BatchCommandData(RedisCommands.MULTI, new Object[] {}, index.incrementAndGet()); entry.getCommands().addFirst(multiCommand); BatchCommandData<?, ?> execCommand = new BatchCommandData(RedisCommands.EXEC, new Object[] {}, index.incrementAndGet()); entry.getCommands().add(execCommand); for (Entry entry : commands.values()) { BatchCommandData<?, ?> offCommand = new BatchCommandData(RedisCommands.CLIENT_REPLY, new Object[] { "OFF" }, index.incrementAndGet()); entry.getCommands().addFirst(offCommand); BatchCommandData<?, ?> onCommand = new BatchCommandData(RedisCommands.CLIENT_REPLY, new Object[] { "ON" }, index.incrementAndGet()); entry.getCommands().add(onCommand); BatchCommandData<?, ?> waitCommand = new BatchCommandData(RedisCommands.WAIT, new Object[] { this.options.getSyncSlaves(), this.options.getSyncTimeout() }, index.incrementAndGet()); entry.getCommands().add(waitCommand);
entry.isReadOnlyMode(), source, null, null, null, mainPromise, attempt); if (entry.isReadOnlyMode()) { connectionFuture = connectionManager.connectionReadOp(source, null); } else {
entry.isReadOnlyMode(), source, null, null, null, mainPromise, attempt); if (entry.isReadOnlyMode()) { connectionFuture = connectionManager.connectionReadOp(source, null); } else {
int permits = 0; for (Entry entry : commands.values()) { permits += entry.getCommands().size(); }; for (Entry entry : commands.values()) { BatchCommandData<?, ?> multiCommand = new BatchCommandData(RedisCommands.MULTI, new Object[] {}, index.incrementAndGet()); entry.getCommands().addFirst(multiCommand); BatchCommandData<?, ?> execCommand = new BatchCommandData(RedisCommands.EXEC, new Object[] {}, index.incrementAndGet()); entry.getCommands().add(execCommand); for (Entry entry : commands.values()) { BatchCommandData<?, ?> offCommand = new BatchCommandData(RedisCommands.CLIENT_REPLY, new Object[] { "OFF" }, index.incrementAndGet()); entry.getCommands().addFirst(offCommand); BatchCommandData<?, ?> onCommand = new BatchCommandData(RedisCommands.CLIENT_REPLY, new Object[] { "ON" }, index.incrementAndGet()); entry.getCommands().add(onCommand); BatchCommandData<?, ?> waitCommand = new BatchCommandData(RedisCommands.WAIT, new Object[] { this.options.getSyncSlaves(), this.options.getSyncTimeout() }, index.incrementAndGet()); entry.getCommands().add(waitCommand);
new Object[] { this.options.getSyncSlaves(), this.options.getSyncTimeout() }, index.incrementAndGet()); list.add(waitCommand); entry.getCommands().add(waitCommand); ChannelFuture future = connection.send(new CommandsData(main, list, new ArrayList(entry.getCommands()))); details.setWriteFuture(future); } else {
@Override public void run() { for (Entry entry : commands.values()) { for (BatchCommandData<?, ?> command : entry.getCommands()) { if (command.getPromise().isDone() && !command.getPromise().isSuccess()) { resultPromise.tryFailure(command.getPromise().cause()); for (final Map.Entry<MasterSlaveEntry, Entry> entry : commands.entrySet()) { final RPromise<List<Object>> execPromise = new RedissonPromise<List<Object>>(); async(entry.getValue().isReadOnlyMode(), new NodeSource(entry.getKey()), connectionManager.getCodec(), RedisCommands.EXEC, new Object[] {}, execPromise, 0, false); execPromise.addListener(new FutureListener<List<Object>>() {
new Object[] { this.options.getSyncSlaves(), this.options.getSyncTimeout() }, index.incrementAndGet()); list.add(waitCommand); entry.getCommands().add(waitCommand); ChannelFuture future = connection.send(new CommandsData(main, list, new ArrayList(entry.getCommands()))); details.setWriteFuture(future); } else {
list.add(new CommandData<Void, Void>(promise, StringCodec.INSTANCE, RedisCommands.ASKING, new Object[] {})); for (BatchCommandData<?, ?> c : entry.getCommands()) { if (c.getPromise().isSuccess() && !isWaitCommand(c) && !isAtomic) { releaseConnection(source, connFuture, entry.isReadOnlyMode(), attemptPromise, details);