All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.rxjava.core.Vertx Maven / Gradle / Ivy

There is a newer version: 5.0.0.CR1
Show newest version
/*
 * Copyright 2014 Red Hat, Inc.
 *
 * Red Hat licenses this file to you under the Apache License, version 2.0
 * (the "License"); you may not use this file except in compliance with the
 * License.  You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
 * License for the specific language governing permissions and limitations
 * under the License.
 */

package io.vertx.rxjava.core;

import rx.Observable;
import rx.Single;
import io.vertx.rx.java.RxHelper;
import io.vertx.rx.java.WriteStreamSubscriber;
import io.vertx.rx.java.SingleOnSubscribeAdapter;
import java.util.Map;
import java.util.Set;
import java.util.List;
import java.util.Iterator;
import java.util.function.Function;
import java.util.stream.Collectors;
import io.vertx.core.Handler;
import io.vertx.core.AsyncResult;
import io.vertx.core.json.JsonObject;
import io.vertx.core.json.JsonArray;
import io.vertx.lang.rx.RxGen;
import io.vertx.lang.rx.TypeArg;
import io.vertx.lang.rx.MappingIterator;

/**
 * The entry point into the Vert.x Core API.
 * 

* You use an instance of this class for functionality including: *

    *
  • Creating TCP clients and servers
  • *
  • Creating HTTP clients and servers
  • *
  • Creating DNS clients
  • *
  • Creating Datagram sockets
  • *
  • Setting and cancelling periodic and one-shot timers
  • *
  • Getting a reference to the event bus API
  • *
  • Getting a reference to the file system API
  • *
  • Getting a reference to the shared data API
  • *
  • Deploying and undeploying verticles
  • *
*

* Most functionality in Vert.x core is fairly low level. *

* To create an instance of this class you can use the static factory methods: {@link io.vertx.rxjava.core.Vertx#vertx}, * {@link io.vertx.rxjava.core.Vertx#vertx} and {@link io.vertx.rxjava.core.Vertx#clusteredVertx}. *

* Please see the user manual for more detailed usage information. * *

* NOTE: This class has been automatically generated from the {@link io.vertx.core.Vertx original} non RX-ified interface using Vert.x codegen. */ @RxGen(io.vertx.core.Vertx.class) public class Vertx implements io.vertx.rxjava.core.metrics.Measured { @Override public String toString() { return delegate.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Vertx that = (Vertx) o; return delegate.equals(that.delegate); } @Override public int hashCode() { return delegate.hashCode(); } public static final TypeArg __TYPE_ARG = new TypeArg<>( obj -> new Vertx((io.vertx.core.Vertx) obj), Vertx::getDelegate ); private final io.vertx.core.Vertx delegate; public Vertx(io.vertx.core.Vertx delegate) { this.delegate = delegate; } public Vertx(Object delegate) { this.delegate = (io.vertx.core.Vertx)delegate; } public io.vertx.core.Vertx getDelegate() { return delegate; } /** * Whether the metrics are enabled for this measured object * @return true if metrics are enabled */ public boolean isMetricsEnabled() { boolean ret = delegate.isMetricsEnabled(); return ret; } /** * Creates a non clustered instance using default options. * @return the instance */ public static io.vertx.rxjava.core.Vertx vertx() { io.vertx.rxjava.core.Vertx ret = io.vertx.rxjava.core.Vertx.newInstance((io.vertx.core.Vertx)io.vertx.core.Vertx.vertx()); return ret; } /** * Creates a non clustered instance using the specified options * @param options the options to use * @return the instance */ public static io.vertx.rxjava.core.Vertx vertx(io.vertx.core.VertxOptions options) { io.vertx.rxjava.core.Vertx ret = io.vertx.rxjava.core.Vertx.newInstance((io.vertx.core.Vertx)io.vertx.core.Vertx.vertx(options)); return ret; } /** * Creates a clustered instance using the specified options. *

* The instance is created asynchronously and the resultHandler is called with the result when it is ready. * @param options the options to use * @param resultHandler the result handler that will receive the result */ public static void clusteredVertx(io.vertx.core.VertxOptions options, Handler> resultHandler) { io.vertx.core.Vertx.clusteredVertx(options, new Handler>() { public void handle(AsyncResult ar) { if (ar.succeeded()) { resultHandler.handle(io.vertx.core.Future.succeededFuture(io.vertx.rxjava.core.Vertx.newInstance((io.vertx.core.Vertx)ar.result()))); } else { resultHandler.handle(io.vertx.core.Future.failedFuture(ar.cause())); } } }); } /** * Creates a clustered instance using the specified options. *

* The instance is created asynchronously and the resultHandler is called with the result when it is ready. * @param options the options to use */ public static void clusteredVertx(io.vertx.core.VertxOptions options) { clusteredVertx(options, ar -> { }); } /** * Creates a clustered instance using the specified options. *

* The instance is created asynchronously and the resultHandler is called with the result when it is ready. * @param options the options to use * @return */ public static Single rxClusteredVertx(io.vertx.core.VertxOptions options) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { clusteredVertx(options, fut); })); } /** * Gets the current context * @return The current context or null if there is no current context */ public static io.vertx.rxjava.core.Context currentContext() { io.vertx.rxjava.core.Context ret = io.vertx.rxjava.core.Context.newInstance((io.vertx.core.Context)io.vertx.core.Vertx.currentContext()); return ret; } /** * Gets the current context, or creates one if there isn't one * @return The current context (created if didn't exist) */ public io.vertx.rxjava.core.Context getOrCreateContext() { io.vertx.rxjava.core.Context ret = io.vertx.rxjava.core.Context.newInstance((io.vertx.core.Context)delegate.getOrCreateContext()); return ret; } /** * Create a TCP/SSL server using the specified options * @param options the options to use * @return the server */ public io.vertx.rxjava.core.net.NetServer createNetServer(io.vertx.core.net.NetServerOptions options) { io.vertx.rxjava.core.net.NetServer ret = io.vertx.rxjava.core.net.NetServer.newInstance((io.vertx.core.net.NetServer)delegate.createNetServer(options)); return ret; } /** * Create a TCP/SSL server using default options * @return the server */ public io.vertx.rxjava.core.net.NetServer createNetServer() { io.vertx.rxjava.core.net.NetServer ret = io.vertx.rxjava.core.net.NetServer.newInstance((io.vertx.core.net.NetServer)delegate.createNetServer()); return ret; } /** * Create a TCP/SSL client using the specified options * @param options the options to use * @return the client */ public io.vertx.rxjava.core.net.NetClient createNetClient(io.vertx.core.net.NetClientOptions options) { io.vertx.rxjava.core.net.NetClient ret = io.vertx.rxjava.core.net.NetClient.newInstance((io.vertx.core.net.NetClient)delegate.createNetClient(options)); return ret; } /** * Create a TCP/SSL client using default options * @return the client */ public io.vertx.rxjava.core.net.NetClient createNetClient() { io.vertx.rxjava.core.net.NetClient ret = io.vertx.rxjava.core.net.NetClient.newInstance((io.vertx.core.net.NetClient)delegate.createNetClient()); return ret; } /** * Create an HTTP/HTTPS server using the specified options * @param options the options to use * @return the server */ public io.vertx.rxjava.core.http.HttpServer createHttpServer(io.vertx.core.http.HttpServerOptions options) { io.vertx.rxjava.core.http.HttpServer ret = io.vertx.rxjava.core.http.HttpServer.newInstance((io.vertx.core.http.HttpServer)delegate.createHttpServer(options)); return ret; } /** * Create an HTTP/HTTPS server using default options * @return the server */ public io.vertx.rxjava.core.http.HttpServer createHttpServer() { io.vertx.rxjava.core.http.HttpServer ret = io.vertx.rxjava.core.http.HttpServer.newInstance((io.vertx.core.http.HttpServer)delegate.createHttpServer()); return ret; } /** * Create a HTTP/HTTPS client using the specified options * @param options the options to use * @return the client */ public io.vertx.rxjava.core.http.HttpClient createHttpClient(io.vertx.core.http.HttpClientOptions options) { io.vertx.rxjava.core.http.HttpClient ret = io.vertx.rxjava.core.http.HttpClient.newInstance((io.vertx.core.http.HttpClient)delegate.createHttpClient(options)); return ret; } /** * Create a HTTP/HTTPS client using default options * @return the client */ public io.vertx.rxjava.core.http.HttpClient createHttpClient() { io.vertx.rxjava.core.http.HttpClient ret = io.vertx.rxjava.core.http.HttpClient.newInstance((io.vertx.core.http.HttpClient)delegate.createHttpClient()); return ret; } /** * Create a datagram socket using the specified options * @param options the options to use * @return the socket */ public io.vertx.rxjava.core.datagram.DatagramSocket createDatagramSocket(io.vertx.core.datagram.DatagramSocketOptions options) { io.vertx.rxjava.core.datagram.DatagramSocket ret = io.vertx.rxjava.core.datagram.DatagramSocket.newInstance((io.vertx.core.datagram.DatagramSocket)delegate.createDatagramSocket(options)); return ret; } /** * Create a datagram socket using default options * @return the socket */ public io.vertx.rxjava.core.datagram.DatagramSocket createDatagramSocket() { io.vertx.rxjava.core.datagram.DatagramSocket ret = io.vertx.rxjava.core.datagram.DatagramSocket.newInstance((io.vertx.core.datagram.DatagramSocket)delegate.createDatagramSocket()); return ret; } /** * Get the filesystem object. There is a single instance of FileSystem per Vertx instance. * @return the filesystem object */ public io.vertx.rxjava.core.file.FileSystem fileSystem() { if (cached_0 != null) { return cached_0; } io.vertx.rxjava.core.file.FileSystem ret = io.vertx.rxjava.core.file.FileSystem.newInstance((io.vertx.core.file.FileSystem)delegate.fileSystem()); cached_0 = ret; return ret; } /** * Get the event bus object. There is a single instance of EventBus per Vertx instance. * @return the event bus object */ public io.vertx.rxjava.core.eventbus.EventBus eventBus() { if (cached_1 != null) { return cached_1; } io.vertx.rxjava.core.eventbus.EventBus ret = io.vertx.rxjava.core.eventbus.EventBus.newInstance((io.vertx.core.eventbus.EventBus)delegate.eventBus()); cached_1 = ret; return ret; } /** * Create a DNS client to connect to a DNS server at the specified host and port, with the default query timeout (5 seconds) *

* @param port the port * @param host the host * @return the DNS client */ public io.vertx.rxjava.core.dns.DnsClient createDnsClient(int port, String host) { io.vertx.rxjava.core.dns.DnsClient ret = io.vertx.rxjava.core.dns.DnsClient.newInstance((io.vertx.core.dns.DnsClient)delegate.createDnsClient(port, host)); return ret; } /** * Create a DNS client to connect to the DNS server configured by {@link io.vertx.core.VertxOptions} *

* DNS client takes the first configured resolver address provided by } * @return the DNS client */ public io.vertx.rxjava.core.dns.DnsClient createDnsClient() { io.vertx.rxjava.core.dns.DnsClient ret = io.vertx.rxjava.core.dns.DnsClient.newInstance((io.vertx.core.dns.DnsClient)delegate.createDnsClient()); return ret; } /** * Create a DNS client to connect to a DNS server * @param options the client options * @return the DNS client */ public io.vertx.rxjava.core.dns.DnsClient createDnsClient(io.vertx.core.dns.DnsClientOptions options) { io.vertx.rxjava.core.dns.DnsClient ret = io.vertx.rxjava.core.dns.DnsClient.newInstance((io.vertx.core.dns.DnsClient)delegate.createDnsClient(options)); return ret; } /** * Get the shared data object. There is a single instance of SharedData per Vertx instance. * @return the shared data object */ public io.vertx.rxjava.core.shareddata.SharedData sharedData() { if (cached_2 != null) { return cached_2; } io.vertx.rxjava.core.shareddata.SharedData ret = io.vertx.rxjava.core.shareddata.SharedData.newInstance((io.vertx.core.shareddata.SharedData)delegate.sharedData()); cached_2 = ret; return ret; } /** * Set a one-shot timer to fire after delay milliseconds, at which point handler will be called with * the id of the timer. * @param delay the delay in milliseconds, after which the timer will fire * @param handler the handler that will be called with the timer ID when the timer fires * @return the unique ID of the timer */ public long setTimer(long delay, Handler handler) { long ret = delegate.setTimer(delay, handler); return ret; } /** * Returns a one-shot timer as a read stream. The timer will be fired after delay milliseconds after * the has been called. * @param delay the delay in milliseconds, after which the timer will fire * @return the timer stream */ public io.vertx.rxjava.core.TimeoutStream timerStream(long delay) { io.vertx.rxjava.core.TimeoutStream ret = io.vertx.rxjava.core.TimeoutStream.newInstance((io.vertx.core.TimeoutStream)delegate.timerStream(delay)); return ret; } /** * Set a periodic timer to fire every delay milliseconds, at which point handler will be called with * the id of the timer. * @param delay the delay in milliseconds, after which the timer will fire * @param handler the handler that will be called with the timer ID when the timer fires * @return the unique ID of the timer */ public long setPeriodic(long delay, Handler handler) { long ret = delegate.setPeriodic(delay, handler); return ret; } /** * Returns a periodic timer as a read stream. The timer will be fired every delay milliseconds after * the has been called. * @param delay the delay in milliseconds, after which the timer will fire * @return the periodic stream */ public io.vertx.rxjava.core.TimeoutStream periodicStream(long delay) { io.vertx.rxjava.core.TimeoutStream ret = io.vertx.rxjava.core.TimeoutStream.newInstance((io.vertx.core.TimeoutStream)delegate.periodicStream(delay)); return ret; } /** * Cancels the timer with the specified id. * @param id The id of the timer to cancel * @return true if the timer was successfully cancelled, or false if the timer does not exist. */ public boolean cancelTimer(long id) { boolean ret = delegate.cancelTimer(id); return ret; } /** * Puts the handler on the event queue for the current context so it will be run asynchronously ASAP after all * preceeding events have been handled. * @param action - a handler representing the action to execute */ public void runOnContext(Handler action) { delegate.runOnContext(action); } /** * Like {@link io.vertx.rxjava.core.Vertx#close} but the completionHandler will be called when the close is complete * @param completionHandler The handler will be notified when the close is complete. */ public void close(Handler> completionHandler) { delegate.close(completionHandler); } /** * Like {@link io.vertx.rxjava.core.Vertx#close} but the completionHandler will be called when the close is complete */ public void close() { close(ar -> { }); } /** * Like {@link io.vertx.rxjava.core.Vertx#close} but the completionHandler will be called when the close is complete * @return */ public Single rxClose() { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { close(fut); })); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but the completionHandler will be notified when the deployment is complete. *

* If the deployment is successful the result will contain a String representing the unique deployment ID of the * deployment. *

* This deployment ID can subsequently be used to undeploy the verticle. * @param name The identifier * @param completionHandler a handler which will be notified when the deployment is complete */ public void deployVerticle(String name, Handler> completionHandler) { delegate.deployVerticle(name, completionHandler); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but the completionHandler will be notified when the deployment is complete. *

* If the deployment is successful the result will contain a String representing the unique deployment ID of the * deployment. *

* This deployment ID can subsequently be used to undeploy the verticle. * @param name The identifier */ public void deployVerticle(String name) { deployVerticle(name, ar -> { }); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but the completionHandler will be notified when the deployment is complete. *

* If the deployment is successful the result will contain a String representing the unique deployment ID of the * deployment. *

* This deployment ID can subsequently be used to undeploy the verticle. * @param name The identifier * @return */ public Single rxDeployVerticle(String name) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { deployVerticle(name, fut); })); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but {@link io.vertx.core.DeploymentOptions} are provided to configure the * deployment. * @param name the name * @param options the deployment options. * @param completionHandler a handler which will be notified when the deployment is complete */ public void deployVerticle(String name, io.vertx.core.DeploymentOptions options, Handler> completionHandler) { delegate.deployVerticle(name, options, completionHandler); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but {@link io.vertx.core.DeploymentOptions} are provided to configure the * deployment. * @param name the name * @param options the deployment options. */ public void deployVerticle(String name, io.vertx.core.DeploymentOptions options) { deployVerticle(name, options, ar -> { }); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but {@link io.vertx.core.DeploymentOptions} are provided to configure the * deployment. * @param name the name * @param options the deployment options. * @return */ public Single rxDeployVerticle(String name, io.vertx.core.DeploymentOptions options) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { deployVerticle(name, options, fut); })); } /** * Like {@link io.vertx.rxjava.core.Vertx #undeploy(String)} but the completionHandler will be notified when the undeployment is complete. * @param deploymentID the deployment ID * @param completionHandler a handler which will be notified when the undeployment is complete */ public void undeploy(String deploymentID, Handler> completionHandler) { delegate.undeploy(deploymentID, completionHandler); } /** * Like {@link io.vertx.rxjava.core.Vertx #undeploy(String)} but the completionHandler will be notified when the undeployment is complete. * @param deploymentID the deployment ID */ public void undeploy(String deploymentID) { undeploy(deploymentID, ar -> { }); } /** * Like {@link io.vertx.rxjava.core.Vertx #undeploy(String)} but the completionHandler will be notified when the undeployment is complete. * @param deploymentID the deployment ID * @return */ public Single rxUndeploy(String deploymentID) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { undeploy(deploymentID, fut); })); } /** * Return a Set of deployment IDs for the currently deployed deploymentIDs. * @return Set of deployment IDs */ public Set deploymentIDs() { Set ret = delegate.deploymentIDs(); return ret; } /** * Is this Vert.x instance clustered? * @return true if clustered */ public boolean isClustered() { boolean ret = delegate.isClustered(); return ret; } /** * Safely execute some blocking code. *

* Executes the blocking code in the handler blockingCodeHandler using a thread from the worker pool. *

* When the code is complete the handler resultHandler will be called with the result on the original context * (e.g. on the original event loop of the caller). *

* A Future instance is passed into blockingCodeHandler. When the blocking code successfully completes, * the handler should call the {@link io.vertx.rxjava.core.Promise#complete} or {@link io.vertx.rxjava.core.Promise#complete} method, or the {@link io.vertx.rxjava.core.Promise#fail} * method if it failed. *

* In the blockingCodeHandler the current context remains the original context and therefore any task * scheduled in the blockingCodeHandler will be executed on the this context and not on the worker thread. *

* The blocking code should block for a reasonable amount of time (i.e no more than a few seconds). Long blocking operations * or polling operations (i.e a thread that spin in a loop polling events in a blocking fashion) are precluded. *

* When the blocking operation lasts more than the 10 seconds, a message will be printed on the console by the * blocked thread checker. *

* Long blocking operations should use a dedicated thread managed by the application, which can interact with * verticles using the event-bus or {@link io.vertx.rxjava.core.Context#runOnContext} * @param blockingCodeHandler handler representing the blocking code to run * @param ordered if true then if executeBlocking is called several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees * @param resultHandler handler that will be called when the blocking code is complete */ public void executeBlocking(Handler> blockingCodeHandler, boolean ordered, Handler> resultHandler) { delegate.executeBlocking(new Handler>() { public void handle(io.vertx.core.Promise event) { blockingCodeHandler.handle(io.vertx.rxjava.core.Promise.newInstance((io.vertx.core.Promise)event, TypeArg.unknown())); } }, ordered, resultHandler); } /** * Safely execute some blocking code. *

* Executes the blocking code in the handler blockingCodeHandler using a thread from the worker pool. *

* When the code is complete the handler resultHandler will be called with the result on the original context * (e.g. on the original event loop of the caller). *

* A Future instance is passed into blockingCodeHandler. When the blocking code successfully completes, * the handler should call the {@link io.vertx.rxjava.core.Promise#complete} or {@link io.vertx.rxjava.core.Promise#complete} method, or the {@link io.vertx.rxjava.core.Promise#fail} * method if it failed. *

* In the blockingCodeHandler the current context remains the original context and therefore any task * scheduled in the blockingCodeHandler will be executed on the this context and not on the worker thread. *

* The blocking code should block for a reasonable amount of time (i.e no more than a few seconds). Long blocking operations * or polling operations (i.e a thread that spin in a loop polling events in a blocking fashion) are precluded. *

* When the blocking operation lasts more than the 10 seconds, a message will be printed on the console by the * blocked thread checker. *

* Long blocking operations should use a dedicated thread managed by the application, which can interact with * verticles using the event-bus or {@link io.vertx.rxjava.core.Context#runOnContext} * @param blockingCodeHandler handler representing the blocking code to run * @param ordered if true then if executeBlocking is called several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees */ public void executeBlocking(Handler> blockingCodeHandler, boolean ordered) { executeBlocking(blockingCodeHandler, ordered, ar -> { }); } /** * Safely execute some blocking code. *

* Executes the blocking code in the handler blockingCodeHandler using a thread from the worker pool. *

* When the code is complete the handler resultHandler will be called with the result on the original context * (e.g. on the original event loop of the caller). *

* A Future instance is passed into blockingCodeHandler. When the blocking code successfully completes, * the handler should call the {@link io.vertx.rxjava.core.Promise#complete} or {@link io.vertx.rxjava.core.Promise#complete} method, or the {@link io.vertx.rxjava.core.Promise#fail} * method if it failed. *

* In the blockingCodeHandler the current context remains the original context and therefore any task * scheduled in the blockingCodeHandler will be executed on the this context and not on the worker thread. *

* The blocking code should block for a reasonable amount of time (i.e no more than a few seconds). Long blocking operations * or polling operations (i.e a thread that spin in a loop polling events in a blocking fashion) are precluded. *

* When the blocking operation lasts more than the 10 seconds, a message will be printed on the console by the * blocked thread checker. *

* Long blocking operations should use a dedicated thread managed by the application, which can interact with * verticles using the event-bus or {@link io.vertx.rxjava.core.Context#runOnContext} * @param blockingCodeHandler handler representing the blocking code to run * @param ordered if true then if executeBlocking is called several times on the same context, the executions for that context will be executed serially, not in parallel. if false then they will be no ordering guarantees * @return */ public Single rxExecuteBlocking(Handler> blockingCodeHandler, boolean ordered) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { executeBlocking(blockingCodeHandler, ordered, fut); })); } /** * Like {@link io.vertx.rxjava.core.Vertx#executeBlocking} called with ordered = true. * @param blockingCodeHandler * @param resultHandler */ public void executeBlocking(Handler> blockingCodeHandler, Handler> resultHandler) { delegate.executeBlocking(new Handler>() { public void handle(io.vertx.core.Promise event) { blockingCodeHandler.handle(io.vertx.rxjava.core.Promise.newInstance((io.vertx.core.Promise)event, TypeArg.unknown())); } }, resultHandler); } /** * Like {@link io.vertx.rxjava.core.Vertx#executeBlocking} called with ordered = true. * @param blockingCodeHandler */ public void executeBlocking(Handler> blockingCodeHandler) { executeBlocking(blockingCodeHandler, ar -> { }); } /** * Like {@link io.vertx.rxjava.core.Vertx#executeBlocking} called with ordered = true. * @param blockingCodeHandler * @return */ public Single rxExecuteBlocking(Handler> blockingCodeHandler) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { executeBlocking(blockingCodeHandler, fut); })); } /** * Like {@link io.vertx.rxjava.core.Vertx#createSharedWorkerExecutor} but with the {@link io.vertx.core.VertxOptions} poolSize. * @param name * @return */ public io.vertx.rxjava.core.WorkerExecutor createSharedWorkerExecutor(String name) { io.vertx.rxjava.core.WorkerExecutor ret = io.vertx.rxjava.core.WorkerExecutor.newInstance((io.vertx.core.WorkerExecutor)delegate.createSharedWorkerExecutor(name)); return ret; } /** * Like {@link io.vertx.rxjava.core.Vertx#createSharedWorkerExecutor} but with the {@link io.vertx.core.VertxOptions} maxExecuteTime. * @param name * @param poolSize * @return */ public io.vertx.rxjava.core.WorkerExecutor createSharedWorkerExecutor(String name, int poolSize) { io.vertx.rxjava.core.WorkerExecutor ret = io.vertx.rxjava.core.WorkerExecutor.newInstance((io.vertx.core.WorkerExecutor)delegate.createSharedWorkerExecutor(name, poolSize)); return ret; } /** * Like {@link io.vertx.rxjava.core.Vertx#createSharedWorkerExecutor} but with the . * @param name * @param poolSize * @param maxExecuteTime * @return */ public io.vertx.rxjava.core.WorkerExecutor createSharedWorkerExecutor(String name, int poolSize, long maxExecuteTime) { io.vertx.rxjava.core.WorkerExecutor ret = io.vertx.rxjava.core.WorkerExecutor.newInstance((io.vertx.core.WorkerExecutor)delegate.createSharedWorkerExecutor(name, poolSize, maxExecuteTime)); return ret; } /** * Create a named worker executor, the executor should be closed when it's not needed anymore to release * resources.

* * This method can be called mutiple times with the same name. Executors with the same name will share * the same worker pool. The worker pool size , max execute time and unit of max execute time are set when the worker pool is created and * won't change after.

* * The worker pool is released when all the {@link io.vertx.rxjava.core.WorkerExecutor} sharing the same name are closed. * @param name the name of the worker executor * @param poolSize the size of the pool * @param maxExecuteTime the value of max worker execute time * @param maxExecuteTimeUnit the value of unit of max worker execute time * @return the named worker executor */ public io.vertx.rxjava.core.WorkerExecutor createSharedWorkerExecutor(String name, int poolSize, long maxExecuteTime, java.util.concurrent.TimeUnit maxExecuteTimeUnit) { io.vertx.rxjava.core.WorkerExecutor ret = io.vertx.rxjava.core.WorkerExecutor.newInstance((io.vertx.core.WorkerExecutor)delegate.createSharedWorkerExecutor(name, poolSize, maxExecuteTime, maxExecuteTimeUnit)); return ret; } /** * @return whether the native transport is used */ public boolean isNativeTransportEnabled() { if (cached_3 != null) { return cached_3; } boolean ret = delegate.isNativeTransportEnabled(); cached_3 = ret; return ret; } /** * Set a default exception handler for {@link io.vertx.rxjava.core.Context}, set on at creation. * @param handler the exception handler * @return a reference to this, so the API can be used fluently */ public io.vertx.rxjava.core.Vertx exceptionHandler(Handler handler) { delegate.exceptionHandler(handler); return this; } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but the completionHandler will be notified when the deployment is complete. *

* If the deployment is successful the result will contain a string representing the unique deployment ID of the * deployment. *

* This deployment ID can subsequently be used to undeploy the verticle. * @param verticle the verticle instance to deploy * @param completionHandler a handler which will be notified when the deployment is complete */ public void deployVerticle(io.vertx.core.Verticle verticle, Handler> completionHandler) { delegate.deployVerticle(verticle, completionHandler); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but the completionHandler will be notified when the deployment is complete. *

* If the deployment is successful the result will contain a string representing the unique deployment ID of the * deployment. *

* This deployment ID can subsequently be used to undeploy the verticle. * @param verticle the verticle instance to deploy */ public void deployVerticle(io.vertx.core.Verticle verticle) { deployVerticle(verticle, ar -> { }); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but the completionHandler will be notified when the deployment is complete. *

* If the deployment is successful the result will contain a string representing the unique deployment ID of the * deployment. *

* This deployment ID can subsequently be used to undeploy the verticle. * @param verticle the verticle instance to deploy * @return */ public Single rxDeployVerticle(io.vertx.core.Verticle verticle) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { deployVerticle(verticle, fut); })); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but {@link io.vertx.core.DeploymentOptions} are provided to configure the * deployment. * @param verticle the verticle instance to deploy * @param options the deployment options. * @param completionHandler a handler which will be notified when the deployment is complete */ public void deployVerticle(io.vertx.core.Verticle verticle, io.vertx.core.DeploymentOptions options, Handler> completionHandler) { delegate.deployVerticle(verticle, options, completionHandler); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but {@link io.vertx.core.DeploymentOptions} are provided to configure the * deployment. * @param verticle the verticle instance to deploy * @param options the deployment options. */ public void deployVerticle(io.vertx.core.Verticle verticle, io.vertx.core.DeploymentOptions options) { deployVerticle(verticle, options, ar -> { }); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but {@link io.vertx.core.DeploymentOptions} are provided to configure the * deployment. * @param verticle the verticle instance to deploy * @param options the deployment options. * @return */ public Single rxDeployVerticle(io.vertx.core.Verticle verticle, io.vertx.core.DeploymentOptions options) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { deployVerticle(verticle, options, fut); })); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but {@link io.vertx.core.Verticle} instance is created by * invoking the verticleSupplier. *

* The supplier will be invoked as many times as {@link io.vertx.core.DeploymentOptions}. * It must not return the same instance twice. *

* Note that the supplier will be invoked on the caller thread. * @param verticleSupplier * @param options * @param completionHandler */ public void deployVerticle(java.util.function.Supplier verticleSupplier, io.vertx.core.DeploymentOptions options, Handler> completionHandler) { delegate.deployVerticle(verticleSupplier, options, completionHandler); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but {@link io.vertx.core.Verticle} instance is created by * invoking the verticleSupplier. *

* The supplier will be invoked as many times as {@link io.vertx.core.DeploymentOptions}. * It must not return the same instance twice. *

* Note that the supplier will be invoked on the caller thread. * @param verticleSupplier * @param options */ public void deployVerticle(java.util.function.Supplier verticleSupplier, io.vertx.core.DeploymentOptions options) { deployVerticle(verticleSupplier, options, ar -> { }); } /** * Like {@link io.vertx.rxjava.core.Vertx#deployVerticle} but {@link io.vertx.core.Verticle} instance is created by * invoking the verticleSupplier. *

* The supplier will be invoked as many times as {@link io.vertx.core.DeploymentOptions}. * It must not return the same instance twice. *

* Note that the supplier will be invoked on the caller thread. * @param verticleSupplier * @param options * @return */ public Single rxDeployVerticle(java.util.function.Supplier verticleSupplier, io.vertx.core.DeploymentOptions options) { return Single.create(new SingleOnSubscribeAdapter<>(fut -> { deployVerticle(verticleSupplier, options, fut); })); } /** * Register a VerticleFactory that can be used for deploying Verticles based on an identifier. * @param factory the factory to register */ public void registerVerticleFactory(io.vertx.core.spi.VerticleFactory factory) { delegate.registerVerticleFactory(factory); } /** * Unregister a VerticleFactory * @param factory the factory to unregister */ public void unregisterVerticleFactory(io.vertx.core.spi.VerticleFactory factory) { delegate.unregisterVerticleFactory(factory); } /** * Return the Set of currently registered verticle factories. * @return the set of verticle factories */ public Set verticleFactories() { Set ret = delegate.verticleFactories(); return ret; } /** * Return the Netty EventLoopGroup used by Vert.x * @return the EventLoopGroup */ public io.netty.channel.EventLoopGroup nettyEventLoopGroup() { io.netty.channel.EventLoopGroup ret = delegate.nettyEventLoopGroup(); return ret; } private io.vertx.rxjava.core.file.FileSystem cached_0; private io.vertx.rxjava.core.eventbus.EventBus cached_1; private io.vertx.rxjava.core.shareddata.SharedData cached_2; private java.lang.Boolean cached_3; public static Vertx newInstance(io.vertx.core.Vertx arg) { return arg != null ? new Vertx(arg) : null; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy