Skip to content

Commit

Permalink
Deprecate DeploymentOptions worker property
Browse files Browse the repository at this point in the history
  • Loading branch information
vietj committed Oct 25, 2023
1 parent f150fb1 commit 604bc9b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/asciidoc/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ Worker verticles are designed for calling blocking code, as they won't block any
If you don't want to use a worker verticle to run blocking code, you can also run <<blocking_code, inline blocking code>>
directly while on an event loop.

If you want to deploy a verticle as a worker verticle you do that with {@link io.vertx.core.DeploymentOptions#setWorker}.
If you want to deploy a verticle as a worker verticle you do that with {@link io.vertx.core.DeploymentOptions#setThreadingModel}.

[source,$lang]
----
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/examples/CoreExamples.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ public void exampleFutureJoin2(Future<?> future1, Future<?> future2, Future<?> f
}

public void example7_1(Vertx vertx) {
DeploymentOptions options = new DeploymentOptions().setWorker(true);
DeploymentOptions options = new DeploymentOptions().setThreadingModel(ThreadingModel.WORKER);
vertx.deployVerticle("com.mycompany.MyOrderProcessorVerticle", options);
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/vertx/core/DeploymentOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public DeploymentOptions setThreadingModel(ThreadingModel threadingModel) {
* Should the verticle(s) be deployed as a worker verticle?
*
* @return {@code true} if will be deployed as worker, {@code false} otherwise
* @deprecated instead use {@link #getThreadingModel()}
*/
@Deprecated
public boolean isWorker() {
return threadingModel == ThreadingModel.WORKER;
}
Expand All @@ -154,7 +156,9 @@ public boolean isWorker() {
*
* @param worker {@code true} for worker, {@code false} force event-loop
* @return a reference to this, so the API can be used fluently
* @deprecated instead use {@link #setThreadingModel(ThreadingModel)}
*/
@Deprecated
public DeploymentOptions setWorker(boolean worker) {
this.threadingModel = worker ? ThreadingModel.WORKER : ThreadingModel.EVENT_LOOP;
return this;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java11/io/vertx/core/DeploymentOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ public DeploymentOptions setConfig(JsonObject config) {
* Which threading model the verticle(s) should use?
*
* @return the verticle threading model
* @deprecated instead use {@link #getThreadingModel()}
*/
@Deprecated
public ThreadingModel getThreadingModel() {
return threadingModel;
}
Expand All @@ -129,7 +131,9 @@ public ThreadingModel getThreadingModel() {
*
* @param threadingModel the threading model
* @return a reference to this, so the API can be used fluently
* @deprecated instead use {@link #setThreadingModel(ThreadingModel)}
*/
@Deprecated
public DeploymentOptions setThreadingModel(ThreadingModel threadingModel) {
this.threadingModel = threadingModel;
return this;
Expand Down

0 comments on commit 604bc9b

Please sign in to comment.