本文整理汇总了Java中com.lambdaworks.redis.RedisCommandInterruptedException类的典型用法代码示例。如果您正苦于以下问题:Java RedisCommandInterruptedException类的具体用法?Java RedisCommandInterruptedException怎么用?Java RedisCommandInterruptedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RedisCommandInterruptedException类属于com.lambdaworks.redis包,在下文中一共展示了RedisCommandInterruptedException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNodes
import com.lambdaworks.redis.RedisCommandInterruptedException; //导入依赖的package包/类
/**
* Load master slave nodes. Result contains an ordered list of {@link RedisNodeDescription}s. The sort key is the latency.
* Nodes with lower latency come first.
*
* @param seed collection of {@link RedisURI}s
* @return mapping between {@link RedisURI} and {@link Partitions}
*/
public List<RedisNodeDescription> getNodes(RedisURI seed) {
List<RedisNodeDescription> nodes = topologyProvider.getNodes();
addPasswordIfNeeded(nodes, seed);
AsyncConnections asyncConnections = getConnections(nodes);
Connections connections = null;
try {
connections = asyncConnections.get(seed.getTimeout(), seed.getUnit());
Requests requestedPing = connections.requestPing();
return getNodeSpecificViews(requestedPing, nodes, seed);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RedisCommandInterruptedException(e);
} finally {
if (connections != null) {
connections.close();
}
}
}
示例2: get
import com.lambdaworks.redis.RedisCommandInterruptedException; //导入依赖的package包/类
/**
* Get the command output and if the command hasn't completed
* yet, wait until it does.
*
* @return The command output.
*/
@Override
public T get() {
try {
latch.await();
return output.get();
} catch (InterruptedException e) {
throw new RedisCommandInterruptedException(e);
}
}
示例3: await
import com.lambdaworks.redis.RedisCommandInterruptedException; //导入依赖的package包/类
/**
* Wait up to the specified time for the command output to become
* available.
*
* @param timeout Maximum time to wait for a result.
* @param unit Unit of time for the timeout.
*
* @return true if the output became available.
*/
public boolean await(long timeout, TimeUnit unit) {
try {
return latch.await(timeout, unit);
} catch (InterruptedException e) {
throw new RedisCommandInterruptedException(e);
}
}