use of io.vertx.core.impl.ContextImpl in project vert.x by eclipse.
the class VertxHandler method channelRead.
@Override
public void channelRead(ChannelHandlerContext chctx, Object msg) throws Exception {
Object message = safeObject(msg, chctx.alloc());
C connection = getConnection();
ContextImpl context;
if (connection != null) {
context = getContext(connection);
context.executeFromIO(connection::startRead);
} else {
context = null;
}
channelRead(connection, context, chctx, message);
}
use of io.vertx.core.impl.ContextImpl in project vert.x by eclipse.
the class AsyncFileImpl method doClose.
private void doClose(Handler<AsyncResult<Void>> handler) {
ContextImpl handlerContext = vertx.getOrCreateContext();
handlerContext.executeBlocking(res -> {
try {
ch.close();
res.complete(null);
} catch (IOException e) {
res.fail(e);
}
}, handler);
}
use of io.vertx.core.impl.ContextImpl in project vert.x by eclipse.
the class HttpServerImpl method actualClose.
private void actualClose(final ContextImpl closeContext, final Handler<AsyncResult<Void>> done) {
if (id != null) {
vertx.sharedHttpServers().remove(id);
}
ContextImpl currCon = vertx.getContext();
for (ServerConnection conn : connectionMap.values()) {
conn.close();
}
for (Http2ServerConnection conn : connectionMap2.values()) {
conn.close();
}
// Sanity check
if (vertx.getContext() != currCon) {
throw new IllegalStateException("Context was changed");
}
if (metrics != null) {
metrics.close();
}
ChannelGroupFuture fut = serverChannelGroup.close();
fut.addListener(cgf -> executeCloseDone(closeContext, done, fut.cause()));
}
use of io.vertx.core.impl.ContextImpl in project vert.x by eclipse.
the class Http1xPool method requestEnded.
void requestEnded(ClientConnection conn) {
ContextImpl context = conn.getContext();
context.runOnContext(v -> {
if (pipelining && conn.getOutstandingRequestCount() < pipeliningLimit) {
recycle(conn);
}
});
}
use of io.vertx.core.impl.ContextImpl in project vert.x by eclipse.
the class Http1xPool method responseEnded.
void responseEnded(ClientConnection conn, boolean close) {
if (!keepAlive || close) {
conn.close();
} else {
ContextImpl ctx = conn.getContext();
ctx.runOnContext(v -> {
if (conn.getCurrentRequest() == null) {
recycle(conn);
}
});
}
}
Aggregations