class Vertx extends Measured
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: io.vertx.scala.core.Vertx#vertx, io.vertx.scala.core.Vertx#vertx and io.vertx.scala.core.Vertx#clusteredVertx.
Please see the user manual for more detailed usage information.
- Alphabetic
- By Inheritance
- Vertx
- Measured
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new Vertx(_asJava: AnyRef)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava: AnyRef
-
def
cancelTimer(id: Long): Boolean
Cancels the timer with the specified
id
.Cancels the timer with the specified
id
. * @param id The id of the timer to cancel- returns
true if the timer was successfully cancelled, or false if the timer does not exist.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(completionHandler: Handler[AsyncResult[Unit]]): Unit
Like io.vertx.scala.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.
-
def
close(): Unit
Stop the the Vertx instance and release any resources held by it.
Stop the the Vertx instance and release any resources held by it.
The instance cannot be used after it has been closed.
The actual close is asynchronous and may not complete until after the call has returned.
-
def
closeFuture(): scala.concurrent.Future[Unit]
Like close but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
createDatagramSocket(): DatagramSocket
Create a datagram socket using default options * @return the socket
-
def
createDatagramSocket(options: DatagramSocketOptions): DatagramSocket
Create a datagram socket using the specified options * @param options the options to use see DatagramSocketOptions
Create a datagram socket using the specified options * @param options the options to use see DatagramSocketOptions
- returns
the socket
-
def
createDnsClient(options: DnsClientOptions): DnsClient
Create a DNS client to connect to a DNS server * @param options the client options see DnsClientOptions
Create a DNS client to connect to a DNS server * @param options the client options see DnsClientOptions
- returns
the DNS client
-
def
createDnsClient(): DnsClient
Create a DNS client to connect to the DNS server configured by VertxOptions
Create a DNS client to connect to the DNS server configured by VertxOptions
DNS client takes the first configured resolver address provided by
* @return the DNS client
-
def
createDnsClient(port: Int, host: String): DnsClient
Create a DNS client to connect to a DNS server at the specified host and port, with the default query timeout (5 seconds)
Create a DNS client to connect to a DNS server at the specified host and port, with the default query timeout (5 seconds)
- port
the port
- host
the host
- returns
the DNS client
-
def
createHttpClient(): HttpClient
Create a HTTP/HTTPS client using default options * @return the client
-
def
createHttpClient(options: HttpClientOptions): HttpClient
Create a HTTP/HTTPS client using the specified options * @param options the options to use see HttpClientOptions
Create a HTTP/HTTPS client using the specified options * @param options the options to use see HttpClientOptions
- returns
the client
-
def
createHttpServer(): HttpServer
Create an HTTP/HTTPS server using default options * @return the server
-
def
createHttpServer(options: HttpServerOptions): HttpServer
Create an HTTP/HTTPS server using the specified options * @param options the options to use see HttpServerOptions
Create an HTTP/HTTPS server using the specified options * @param options the options to use see HttpServerOptions
- returns
the server
-
def
createNetClient(): NetClient
Create a TCP/SSL client using default options * @return the client
-
def
createNetClient(options: NetClientOptions): NetClient
Create a TCP/SSL client using the specified options * @param options the options to use see NetClientOptions
Create a TCP/SSL client using the specified options * @param options the options to use see NetClientOptions
- returns
the client
-
def
createNetServer(): NetServer
Create a TCP/SSL server using default options * @return the server
-
def
createNetServer(options: NetServerOptions): NetServer
Create a TCP/SSL server using the specified options * @param options the options to use see NetServerOptions
Create a TCP/SSL server using the specified options * @param options the options to use see NetServerOptions
- returns
the server
-
def
createSharedWorkerExecutor(name: String, poolSize: Int, maxExecuteTime: Long, maxExecuteTimeUnit: TimeUnit): WorkerExecutor
Create a named worker executor, the executor should be closed when it's not needed anymore to release resources.
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 io.vertx.scala.core.WorkerExecutor sharing the same name are closed. * @param name the name of the worker executor
- poolSize
the size of the pool
- maxExecuteTime
the value of max worker execute time
- maxExecuteTimeUnit
the value of unit of max worker execute time
- returns
the named worker executor
-
def
createSharedWorkerExecutor(name: String, poolSize: Int, maxExecuteTime: Long): WorkerExecutor
Like io.vertx.scala.core.Vertx#createSharedWorkerExecutor but with the .
-
def
createSharedWorkerExecutor(name: String, poolSize: Int): WorkerExecutor
Like io.vertx.scala.core.Vertx#createSharedWorkerExecutor but with the VertxOptions
maxExecuteTime
. -
def
createSharedWorkerExecutor(name: String): WorkerExecutor
Like io.vertx.scala.core.Vertx#createSharedWorkerExecutor but with the VertxOptions
poolSize
. -
def
deployVerticle(name: String, options: DeploymentOptions, completionHandler: Handler[AsyncResult[String]]): Unit
Like io.vertx.scala.core.Vertx#deployVerticle but DeploymentOptions are provided to configure the deployment.
Like io.vertx.scala.core.Vertx#deployVerticle but DeploymentOptions are provided to configure the deployment. * @param name the name
- options
the deployment options. see DeploymentOptions
- completionHandler
a handler which will be notified when the deployment is complete
-
def
deployVerticle(name: String, options: DeploymentOptions): Unit
Like io.vertx.scala.core.Vertx#deployVerticle but DeploymentOptions are provided to configure the deployment.
Like io.vertx.scala.core.Vertx#deployVerticle but DeploymentOptions are provided to configure the deployment. * @param name the name
- options
the deployment options. see DeploymentOptions
-
def
deployVerticle(name: String, completionHandler: Handler[AsyncResult[String]]): Unit
Like io.vertx.scala.core.Vertx#deployVerticle but the completionHandler will be notified when the deployment is complete.
Like io.vertx.scala.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
- completionHandler
a handler which will be notified when the deployment is complete
-
def
deployVerticle(name: String): Unit
Deploy a verticle instance given a name.
Deploy a verticle instance given a name.
Given the name, Vert.x selects a instance to use to instantiate the verticle.
For the rules on how factories are selected please consult the user manual. * @param name the name.
-
def
deployVerticle(verticle: ScalaVerticle, options: DeploymentOptions): Unit
Like
#deployVerticle(Verticle)
butio.vertx.core.DeploymentOptions
are provided to configure the deployment.Like
#deployVerticle(Verticle)
butio.vertx.core.DeploymentOptions
are provided to configure the deployment.- verticle
the verticle instance to deploy
- options
the deployment options.
-
def
deployVerticle(verticle: ScalaVerticle): Unit
Deploy a verticle instance that you have created yourself.
Deploy a verticle instance that you have created yourself.
Vert.x will assign the verticle a context and start the verticle.
The actual deploy happens asynchronously and may not complete until after the call has returned.
- verticle
the verticle instance to deploy.
-
def
deployVerticleFuture(name: String, options: DeploymentOptions): scala.concurrent.Future[String]
Like deployVerticle but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
deployVerticleFuture(name: String): scala.concurrent.Future[String]
Like deployVerticle but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
deployVerticleFuture(verticle: ScalaVerticle, options: DeploymentOptions): scala.concurrent.Future[String]
Like deployVerticle but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
deployVerticleFuture(verticle: ScalaVerticle): scala.concurrent.Future[String]
Like deployVerticle but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
deploymentIDs(): Set[String]
Return a Set of deployment IDs for the currently deployed deploymentIDs.
Return a Set of deployment IDs for the currently deployed deploymentIDs. * @return Set of deployment IDs
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
eventBus(): EventBus
Get the event bus object.
Get the event bus object. There is a single instance of EventBus per Vertx instance. * @return the event bus object
-
def
exceptionHandler(handler: Handler[Throwable]): Vertx
Set a default exception handler for io.vertx.scala.core.Context, set on at creation.
Set a default exception handler for io.vertx.scala.core.Context, set on at creation. * @param handler the exception handler
- returns
a reference to this, so the API can be used fluently
-
def
executeBlocking[T](blockingFunction: () ⇒ T, ordered: Boolean = true): scala.concurrent.Future[T]
Safely execute some blocking code.
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 returned Future will be completed with the result.
- blockingFunction
function containing blocking code
- 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
- returns
a Future representing the result of the blocking operation
-
def
fileSystem(): FileSystem
Get the filesystem object.
Get the filesystem object. There is a single instance of FileSystem per Vertx instance. * @return the filesystem object
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getOrCreateContext(): Context
Gets the current context, or creates one if there isn't one * @return The current context (created if didn't exist)
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
isClustered(): Boolean
Is this Vert.x instance clustered? * @return true if clustered
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isMetricsEnabled(): Boolean
Whether the metrics are enabled for this measured object * @return
true
if metrics are enabled -
def
isNativeTransportEnabled(): Boolean
- returns
whether the native transport is used
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
periodicStream(delay: Long): TimeoutStream
Returns a periodic timer as a read stream.
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- returns
the periodic stream
-
def
runOnContext(action: Handler[Unit]): Unit
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.
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
-
def
setPeriodic(delay: Long, handler: Handler[Long]): Long
Set a periodic timer to fire every
delay
milliseconds, at which pointhandler
will be called with the id of the timer.Set a periodic timer to fire every
delay
milliseconds, at which pointhandler
will be called with the id of the timer. * @param delay the delay in milliseconds, after which the timer will fire- handler
the handler that will be called with the timer ID when the timer fires
- returns
the unique ID of the timer
-
def
setTimer(delay: Long, handler: Handler[Long]): Long
Set a one-shot timer to fire after
delay
milliseconds, at which pointhandler
will be called with the id of the timer.Set a one-shot timer to fire after
delay
milliseconds, at which pointhandler
will be called with the id of the timer. * @param delay the delay in milliseconds, after which the timer will fire- handler
the handler that will be called with the timer ID when the timer fires
- returns
the unique ID of the timer
-
def
sharedData(): SharedData
Get the shared data object.
Get the shared data object. There is a single instance of SharedData per Vertx instance. * @return the shared data object
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
timerStream(delay: Long): TimeoutStream
Returns a one-shot timer as a read stream.
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- returns
the timer stream
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
undeploy(deploymentID: String, completionHandler: Handler[AsyncResult[Unit]]): Unit
Like io.vertx.scala.core.Vertx but the completionHandler will be notified when the undeployment is complete.
Like io.vertx.scala.core.Vertx but the completionHandler will be notified when the undeployment is complete. * @param deploymentID the deployment ID
- completionHandler
a handler which will be notified when the undeployment is complete
-
def
undeploy(deploymentID: String): Unit
Undeploy a verticle deployment.
Undeploy a verticle deployment.
The actual undeployment happens asynchronously and may not complete until after the method has returned. * @param deploymentID the deployment ID
-
def
undeployFuture(deploymentID: String): scala.concurrent.Future[Unit]
Like undeploy but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )