new Context()
- Source:
Methods
config() → {Object}
- Source:
Returns:
- Type
- Object
deploymentID() → {string}
- Source:
Returns:
- Type
- string
exceptionHandler(handler) → {Context}
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | the exception handler |
- Source:
Returns:
- Type
- Context
executeBlocking(blockingCodeHandler, ordered, resultHandler)
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 Future#complete or Future#complete method, or the Future#fail
method if it failed.
Parameters:
Name | Type | Description |
---|---|---|
blockingCodeHandler |
function | handler representing the blocking code to run |
ordered |
boolean | 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 |
resultHandler |
function | handler that will be called when the blocking code is complete |
- Source:
get(key) → {Object}
Parameters:
Name | Type | Description |
---|---|---|
key |
string | the key of the data |
- Source:
Returns:
- Type
- Object
getInstanceCount() → {number}
- Source:
Returns:
-
the number of instances of the verticle that were deployed in the deployment (if any) related to this context
-
- Type
- number
isEventLoopContext() → {boolean}
NOTE! when running blocking code using Vertx#executeBlocking from a standard (not worker) verticle, the context will still an event loop context and this will return true.
- Source:
Returns:
- Type
- boolean
isMultiThreadedWorkerContext() → {boolean}
- Source:
Returns:
- Type
- boolean
isWorkerContext() → {boolean}
NOTE! when running blocking code using Vertx#executeBlocking from a standard (not worker) verticle, the context will still an event loop context and this will return false.
- Source:
Returns:
- Type
- boolean
owner() → {Vertx}
- Source:
Returns:
-
The Vertx instance that created the context
-
- Type
- Vertx
processArgs() → {Array.<string>}
- Source:
Returns:
- Type
- Array.<string>
put(key, value)
This can be used to share data between different handlers that share a context
Parameters:
Name | Type | Description |
---|---|---|
key |
string | the key of the data |
value |
Object | the data |
- Source:
remove(key) → {boolean}
Parameters:
Name | Type | Description |
---|---|---|
key |
string | the key to remove |
- Source:
Returns:
- Type
- boolean
runOnContext(action)
Parameters:
Name | Type | Description |
---|---|---|
action |
function | the action to run |
- Source: