@Override public void operationComplete(Future<RedissonLockEntry> future) throws Exception { if (subscribeFuture.isSuccess()) { unsubscribe(subscribeFuture, threadId); } } });
@Override public void operationComplete(Future<RedissonLockEntry> future) throws Exception { if (subscribeFuture.isSuccess()) { unsubscribe(subscribeFuture, threadId); } } });
@Override public void run(Timeout timeout) throws Exception { CommandData<?, ?> commandData = connection.getCurrentCommand(); if ((commandData == null || !commandData.isBlockingCommand()) && (future.cancel(false) || !future.isSuccess())) { ctx.channel().close(); log.debug("channel: {} closed due to PING response timeout set in {} ms", ctx.channel(), config.getPingConnectionInterval()); } else { sendPing(ctx); } } }, config.getPingConnectionInterval(), TimeUnit.MILLISECONDS);
@Override public void run(Timeout timeout) throws Exception { CommandData<?, ?> commandData = connection.getCurrentCommand(); if ((commandData == null || !commandData.isBlockingCommand()) && (future.cancel(false) || !future.isSuccess())) { ctx.channel().close(); log.debug("channel: {} closed due to PING response timeout set in {} ms", ctx.channel(), config.getPingConnectionInterval()); } else { sendPing(ctx); } } }, config.getPingConnectionInterval(), TimeUnit.MILLISECONDS);
@Override public <V> V get(RFuture<V> future) { if (!future.isDone()) { final CountDownLatch l = new CountDownLatch(1); future.addListener(new FutureListener<V>() { @Override public void operationComplete(Future<V> future) throws Exception { l.countDown(); } }); boolean interrupted = false; while (!future.isDone()) { try { l.await(); } catch (InterruptedException e) { interrupted = true; break; } } if (interrupted) { Thread.currentThread().interrupt(); } } // commented out due to blocking issues up to 200 ms per minute for each thread // future.awaitUninterruptibly(); if (future.isSuccess()) { return future.getNow(); } throw convertException(future); }
@Override public <V> V get(RFuture<V> future) { if (!future.isDone()) { final CountDownLatch l = new CountDownLatch(1); future.addListener(new FutureListener<V>() { @Override public void operationComplete(Future<V> future) throws Exception { l.countDown(); } }); boolean interrupted = false; while (!future.isDone()) { try { l.await(); } catch (InterruptedException e) { interrupted = true; break; } } if (interrupted) { Thread.currentThread().interrupt(); } } // commented out due to blocking issues up to 200 ms per minute for each thread // future.awaitUninterruptibly(); if (future.isSuccess()) { return future.getNow(); } throw convertException(future); }
if (!rFuture.isSuccess()) { throw (Exception) rFuture.cause();
if (!rFuture.isSuccess()) { throw (Exception) rFuture.cause();
public <R> R await(RFuture<R> future) { final CountDownLatch l = new CountDownLatch(1); future.addListener(new FutureListener<R>() { @Override public void operationComplete(Future<R> future) throws Exception { l.countDown(); } }); try { if (!l.await(redisClient.getCommandTimeout(), TimeUnit.MILLISECONDS)) { RPromise<R> promise = (RPromise<R>)future; RedisTimeoutException ex = new RedisTimeoutException("Command execution timeout for " + redisClient.getAddr()); promise.tryFailure(ex); throw ex; } if (!future.isSuccess()) { if (future.cause() instanceof RedisException) { throw (RedisException) future.cause(); } throw new RedisException("Unexpected exception while processing command", future.cause()); } return future.getNow(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } }
public <R> R await(RFuture<R> future) { final CountDownLatch l = new CountDownLatch(1); future.addListener(new FutureListener<R>() { @Override public void operationComplete(Future<R> future) throws Exception { l.countDown(); } }); try { if (!l.await(redisClient.getCommandTimeout(), TimeUnit.MILLISECONDS)) { RPromise<R> promise = (RPromise<R>)future; RedisTimeoutException ex = new RedisTimeoutException("Command execution timeout for " + redisClient.getAddr()); promise.tryFailure(ex); throw ex; } if (!future.isSuccess()) { if (future.cause() instanceof RedisException) { throw (RedisException) future.cause(); } throw new RedisException("Unexpected exception while processing command", future.cause()); } return future.getNow(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return null; } }
@Override public void operationComplete(Future<R> future) throws Exception { if (!connectionFuture.isSuccess()) { return; } RedisConnection connection = connectionFuture.getNow(); connectionManager.getShutdownLatch().release(); if (isReadOnly) { connectionManager.releaseRead(source, connection); } else { connectionManager.releaseWrite(source, connection); } if (log.isDebugEnabled()) { log.debug("connection released for command {} and params {} from slot {} using connection {}", details.getCommand(), LogHelper.toString(details.getParams()), details.getSource(), connection); } } });
@Override public void operationComplete(Future<R> future) throws Exception { if (!connectionFuture.isSuccess()) { return; } RedisConnection connection = connectionFuture.getNow(); connectionManager.getShutdownLatch().release(); if (isReadOnly) { connectionManager.releaseRead(source, connection); } else { connectionManager.releaseWrite(source, connection); } if (log.isDebugEnabled()) { log.debug("connection released for command {} and params {} from slot {} using connection {}", details.getCommand(), LogHelper.toString(details.getParams()), details.getSource(), connection); } } });
private void retrieveAddresses() { ConnectionManager connectionManager = ((Redisson)redisson).getConnectionManager(); for (MasterSlaveEntry entry : connectionManager.getEntrySet()) { RFuture<RedisConnection> readFuture = entry.connectionReadOp(null); if (readFuture.awaitUninterruptibly((long)connectionManager.getConfig().getConnectTimeout()) && readFuture.isSuccess()) { RedisConnection connection = readFuture.getNow(); entry.releaseRead(connection); remoteAddress = (InetSocketAddress) connection.getChannel().remoteAddress(); localAddress = (InetSocketAddress) connection.getChannel().localAddress(); return; } RFuture<RedisConnection> writeFuture = entry.connectionWriteOp(null); if (writeFuture.awaitUninterruptibly((long)connectionManager.getConfig().getConnectTimeout()) && writeFuture.isSuccess()) { RedisConnection connection = writeFuture.getNow(); entry.releaseWrite(connection); remoteAddress = (InetSocketAddress) connection.getChannel().remoteAddress(); localAddress = (InetSocketAddress) connection.getChannel().localAddress(); return; } } }
private void retrieveAddresses() { ConnectionManager connectionManager = ((Redisson)redisson).getConnectionManager(); for (MasterSlaveEntry entry : connectionManager.getEntrySet()) { RFuture<RedisConnection> readFuture = entry.connectionReadOp(null); if (readFuture.awaitUninterruptibly((long)connectionManager.getConfig().getConnectTimeout()) && readFuture.isSuccess()) { RedisConnection connection = readFuture.getNow(); entry.releaseRead(connection); remoteAddress = (InetSocketAddress) connection.getChannel().remoteAddress(); localAddress = (InetSocketAddress) connection.getChannel().localAddress(); return; } RFuture<RedisConnection> writeFuture = entry.connectionWriteOp(null); if (writeFuture.awaitUninterruptibly((long)connectionManager.getConfig().getConnectTimeout()) && writeFuture.isSuccess()) { RedisConnection connection = writeFuture.getNow(); entry.releaseWrite(connection); remoteAddress = (InetSocketAddress) connection.getChannel().remoteAddress(); localAddress = (InetSocketAddress) connection.getChannel().localAddress(); return; } } }
if (!connFuture.isSuccess()) { connectionManager.getShutdownLatch().release(); details.setException(convertException(connFuture));
if (!connFuture.isSuccess()) { connectionManager.getShutdownLatch().release(); details.setException(convertException(connFuture));
if (connectionFuture.isSuccess()) { if (details.getWriteFuture() == null || !details.getWriteFuture().isDone()) { if (details.getAttempt() == attempts) {
if (connectionFuture.isSuccess()) { if (details.getWriteFuture() == null || !details.getWriteFuture().isDone()) { if (details.getAttempt() == attempts) {
if (details.getConnectionFuture().isSuccess()) { if (details.getWriteFuture() == null || !details.getWriteFuture().isDone()) { if (details.getAttempt() == connectionManager.getConfig().getRetryAttempts()) {