-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a WorkerOptions to plug in a worker executor service in Deplo…
…ymentOptions. The current worker pool settings are retrofitted in a WorkerPoolOptions implementing WorkerOptions.
- Loading branch information
Showing
12 changed files
with
409 additions
and
77 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
src/main/generated/io/vertx/core/WorkerPoolOptionsConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package io.vertx.core; | ||
|
||
import io.vertx.core.json.JsonObject; | ||
import io.vertx.core.json.JsonArray; | ||
import io.vertx.core.json.impl.JsonUtil; | ||
import java.time.Instant; | ||
import java.time.format.DateTimeFormatter; | ||
import java.util.Base64; | ||
|
||
/** | ||
* Converter and mapper for {@link io.vertx.core.WorkerPoolOptions}. | ||
* NOTE: This class has been automatically generated from the {@link io.vertx.core.WorkerPoolOptions} original class using Vert.x codegen. | ||
*/ | ||
public class WorkerPoolOptionsConverter { | ||
|
||
|
||
private static final Base64.Decoder BASE64_DECODER = JsonUtil.BASE64_DECODER; | ||
private static final Base64.Encoder BASE64_ENCODER = JsonUtil.BASE64_ENCODER; | ||
|
||
static void fromJson(Iterable<java.util.Map.Entry<String, Object>> json, WorkerPoolOptions obj) { | ||
for (java.util.Map.Entry<String, Object> member : json) { | ||
switch (member.getKey()) { | ||
case "maxExecuteTime": | ||
if (member.getValue() instanceof Number) { | ||
obj.setMaxExecuteTime(((Number)member.getValue()).longValue()); | ||
} | ||
break; | ||
case "maxExecuteTimeUnit": | ||
if (member.getValue() instanceof String) { | ||
obj.setMaxExecuteTimeUnit(java.util.concurrent.TimeUnit.valueOf((String)member.getValue())); | ||
} | ||
break; | ||
case "name": | ||
if (member.getValue() instanceof String) { | ||
obj.setName((String)member.getValue()); | ||
} | ||
break; | ||
case "size": | ||
if (member.getValue() instanceof Number) { | ||
obj.setSize(((Number)member.getValue()).intValue()); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
|
||
static void toJson(WorkerPoolOptions obj, JsonObject json) { | ||
toJson(obj, json.getMap()); | ||
} | ||
|
||
static void toJson(WorkerPoolOptions obj, java.util.Map<String, Object> json) { | ||
json.put("maxExecuteTime", obj.getMaxExecuteTime()); | ||
if (obj.getMaxExecuteTimeUnit() != null) { | ||
json.put("maxExecuteTimeUnit", obj.getMaxExecuteTimeUnit().name()); | ||
} | ||
if (obj.getName() != null) { | ||
json.put("name", obj.getName()); | ||
} | ||
json.put("size", obj.getSize()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2011-2023 Contributors to the Eclipse Foundation | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
*/ | ||
package io.vertx.core; | ||
|
||
import io.vertx.codegen.annotations.DataObject; | ||
import io.vertx.codegen.annotations.Unstable; | ||
|
||
import java.util.concurrent.ExecutorService; | ||
|
||
/** | ||
* Generic worker options defining the characteristics of a worker service. | ||
*/ | ||
@Unstable | ||
@DataObject | ||
public interface WorkerOptions { | ||
|
||
/** | ||
* Create the executor service that implements this worker options. | ||
* | ||
* @param vertx the vertx instance | ||
* @return the executor service implementing these worker options | ||
*/ | ||
ExecutorService createExecutor(Vertx vertx); | ||
|
||
/** | ||
* @return a copy of this object | ||
*/ | ||
WorkerOptions copy(); | ||
|
||
} |
Oops, something went wrong.