|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vertx.groovy.core.Vertx
class Vertx
The control centre of vert.x
You should normally only use a single instance of this class throughout your application. If you are running in the vert.x container an instance will be provided to you.
If you are using vert.x embedded, you can create an instance using one of the static newVertx methods.
This class acts as a factory for TCP/SSL and HTTP/HTTPS servers and clients, SockJS servers, and provides an instance of the event bus, file system and shared data classes, as well as methods for setting and cancelling timers.
Constructor Summary | |
Vertx(VertxInternal jVertex)
|
Method Summary | |
---|---|
void
|
cancelTimer(long timerID)
Cancel the timer with the specified id. |
HttpClient
|
createHttpClient(java.util.Map props = null)
Create a HTTP/HTTPS client |
HttpServer
|
createHttpServer(java.util.Map props = null)
|
NetClient
|
createNetClient(java.util.Map props = null)
Create a TCP/SSL client |
NetServer
|
createNetServer(java.util.Map props = null)
Create a TCP/SSL server |
SockJSServer
|
createSockJSServer(HttpServer httpServer)
Create a SockJS server that wraps an HTTP server |
EventBus
|
getEventBus()
The event bus |
FileSystem
|
getFileSystem()
The File system object |
SharedData
|
getSharedData()
The shared data object |
boolean
|
isEventLoop()
Is the current thread an event loop thread? |
boolean
|
isWorker()
Is the current thread an worker thread? |
static Vertx
|
newVertx()
Create a non clustered Vertx instance |
static Vertx
|
newVertx(java.lang.String hostname)
Create a clustered Vertx instance listening for cluster connections on the default port 25500 |
static Vertx
|
newVertx(int port, java.lang.String hostname)
Create a clustered Vertx instance |
void
|
runOnLoop(groovy.lang.Closure handler)
Put the handler on the event queue for this loop so it will be run asynchronously ASAP after this event has been processed |
long
|
setPeriodic(long delay, groovy.lang.Closure handler)
Set a periodic timer to fire every delay milliseconds, at which point handler will be called with the id of the timer. |
long
|
setTimer(long delay, groovy.lang.Closure handler)
Set a one-shot timer to fire after delay milliseconds, at which point handler will be called with the id of the timer. |
Vertx
|
toJavaVertx()
|
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructor Detail |
---|
Vertx(VertxInternal jVertex)
Method Detail |
---|
void cancelTimer(long timerID)
HttpClient createHttpClient(java.util.Map props = null)
HttpServer createHttpServer(java.util.Map props = null)
NetClient createNetClient(java.util.Map props = null)
NetServer createNetServer(java.util.Map props = null)
SockJSServer createSockJSServer(HttpServer httpServer)
EventBus getEventBus()
FileSystem getFileSystem()
SharedData getSharedData()
boolean isEventLoop()
boolean isWorker()
static Vertx newVertx()
static Vertx newVertx(java.lang.String hostname)
hostname
- The hostname or ip address to listen for cluster connections
static Vertx newVertx(int port, java.lang.String hostname)
port
- The port to listen for cluster connectionshostname
- The hostname or ip address to listen for cluster connections
void runOnLoop(groovy.lang.Closure handler)
long setPeriodic(long delay, groovy.lang.Closure handler)
long setTimer(long delay, groovy.lang.Closure handler)
Vertx toJavaVertx()
Groovy Documentation