Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frameworks/Java/vertx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<maven.compiler.target>17</maven.compiler.target>
<!-- the main class -->
<main.class>vertx.App</main.class>
<vertx.version>5.0.0.CR6</vertx.version>
<netty.version>4.2.0.Final</netty.version>
<vertx.version>5.0.0.CR8</vertx.version>
<netty.version>4.2.1.Final</netty.version>
<jackson.version>2.16.1</jackson.version>
</properties>

Expand Down
18 changes: 8 additions & 10 deletions frameworks/Java/vertx/src/main/java/vertx/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class App extends AbstractVerticle implements Handler<HttpServerRequest> {
public class App extends VerticleBase implements Handler<HttpServerRequest> {

private static final int NUM_PROCESSORS = Runtime.getRuntime().availableProcessors();
private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(App.class);
Expand Down Expand Up @@ -147,7 +147,7 @@ private MultiMap jsonHeaders() {
}

@Override
public void start(Promise<Void> startPromise) throws Exception {
public Future<?> start() throws Exception {
int port = 8080;
server = vertx
.createHttpServer(new HttpServerOptions()
Expand All @@ -173,13 +173,11 @@ public void start(Promise<Void> startPromise) throws Exception {
options.setPreparedStatementCacheMaxSize(1024);
options.setPipeliningLimit(256); // Large pipelining means less flushing and we use a single connection anyway
Future<?> clientsInit = initClients(options);
clientsInit
return clientsInit
.transform(ar -> {
databaseErr = ar.cause();
return server.listen(port);
})
.<Void>mapEmpty()
.onComplete(startPromise);
});
}

private Future<?> initClients(PgConnectOptions options) {
Expand Down Expand Up @@ -275,8 +273,8 @@ public void handle(HttpServerRequest request) {
}

@Override
public void stop() {
if (server != null) server.close();
public Future<?> stop() throws Exception {
return server != null ? server.close() : super.stop();
}

private void sendError(HttpServerRequest req, Throwable cause) {
Expand Down Expand Up @@ -338,7 +336,7 @@ public Queries(HttpServerRequest req) {
}

private void handle() {
client.group(c -> {
client.group(/*queries, */c -> {
for (int i = 0; i < queries; i++) {
c.preparedQuery(SELECT_WORLD)
.execute(Tuple.of(boxedRandomWorldNumber()))
Expand Down Expand Up @@ -385,7 +383,7 @@ public Update(HttpServerRequest request) {
}

public void handle() {
client.group(c -> {
client.group(/*worldsToUpdate.length, */c -> {
final PreparedQuery<RowSet<Row>> preparedQuery = c.preparedQuery(App.SELECT_WORLD);
for (int i = 0; i < worldsToUpdate.length; i++) {
final Integer id = boxedRandomWorldNumber();
Expand Down
Loading