use of com.robo4j.socket.http.request.RoboRequestCallable in project robo4j by Robo4J.
the class ReadSelectionKeyHandler method handle.
@Override
public SelectionKey handle() {
SocketChannel channel = (SocketChannel) key.channel();
lock.lock();
try {
final HttpDecoratedRequest decoratedRequest = channelRequestBuffer.getHttpDecoratedRequestByChannel(channel);
final RoboRequestFactory factory = new RoboRequestFactory(codecRegistry);
final RoboRequestCallable callable = new RoboRequestCallable(context, serverContext, decoratedRequest, factory);
final Future<HttpResponseProcess> futureResult = context.getScheduler().submit(callable);
final HttpResponseProcess result = extractRoboResponseProcess(futureResult);
outBuffers.put(key, result);
registerSelectionKey(channel);
return key;
} catch (IOException e) {
throw new SocketException(e.getMessage());
} finally {
lock.unlock();
}
}
Aggregations