use of com.generallycloud.baseio.TimeoutException in project baseio by generallycloud.
the class HttpClient method request.
public synchronized HttpFuture request(HttpFuture future, long timeout) throws IOException {
Waiter waiter = ioEventHandle.newWaiter();
session.flush(future);
if (waiter.await(timeout)) {
throw new TimeoutException("timeout");
}
return (HttpFuture) waiter.getResponse();
}
use of com.generallycloud.baseio.TimeoutException in project baseio by generallycloud.
the class FixedSession method request.
public ParamedProtobaseFuture request(String serviceName, String content, byte[] binary) throws IOException {
ParamedProtobaseFuture future = new ParamedProtobaseFutureImpl(context, serviceName);
if (!StringUtil.isNullOrBlank(content)) {
future.write(content);
}
if (binary != null) {
future.writeBinary(binary);
}
WaiterOnFuture onReadFuture = new WaiterOnFuture();
waiterListen(serviceName, onReadFuture);
session.flush(future);
// FIXME 连接丢失时叫醒我
if (onReadFuture.await(timeout)) {
CloseUtil.close(session);
throw new TimeoutException("timeout");
}
return (ParamedProtobaseFuture) onReadFuture.getReadFuture();
}
use of com.generallycloud.baseio.TimeoutException in project baseio by generallycloud.
the class RedisClient method sendCommand.
private synchronized RedisNode sendCommand(byte[] command, byte[]... args) throws IOException {
RedisFuture future = new RedisCmdFuture(context);
future.writeCommand(command, args);
Waiter waiter = ioEventHandle.newWaiter();
session.flush(future);
if (waiter.await(timeout)) {
throw new TimeoutException("timeout");
}
return (RedisNode) waiter.getResponse();
}
Aggregations