The rationale for this class is to avoid end-users to use the Vert.x internal API, and avoids common mistakes when dealing with Contexts and duplicated Contexts.
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Context | Returns: a new duplicated context if called from a Vert.x thread,null otherwise.Creates a new duplicated context, even if the current one is already a duplicated context. |
| public static Context | Returns: a new duplicated context created from the given context,null is the passed context is nullthe context context)Creates a new duplicated context, even if the passed one is already a duplicated context. |
| public static Context | Returns: the given context if it's a duplicated context, or a new duplicated context using the given one as root.the context, must not be context)nullGets or creates a duplicated context. |
| public static Context | Returns: the current context if it's a duplicated context, or a new duplicated context.the Vert.x instance to use to create the context if needed. Must not be vertx)nullGets or creates a duplicated context. |
| public static Context | Returns: the current context if it's a duplicated context, a new duplicated context using the given one as root,null if not called from a Vert.x thread.Gets or creates a duplicated context. |
| public static Context | Returns: the root context if the given context is a duplicated context, returns the given context otherwise.the context, must not be context)nullReturns the parent context from a given Vert.x context. |
| public static boolean | Returns: true if the given context is a duplicated context, false otherwise.the context, must not be context)nullChecks if the given context is a duplicated context. |
| public static boolean | Returns: true if the method is called from a duplicated context, false otherwise.Checks if the current context is a duplicated context. |
| VertxContext | back to summary |
|---|---|
| private VertxContext() | |
| createNewDuplicatedContext | back to summary |
|---|---|
| public static Context createNewDuplicatedContext() Creates a new duplicated context, even if the current one is already a duplicated context.
If the method is not called from a Vert.x thread, it returns | |
| createNewDuplicatedContext | back to summary |
|---|---|
| public static Context createNewDuplicatedContext(Context context) Creates a new duplicated context, even if the passed one is already a duplicated context.
If the passed context is | |
| getOrCreateDuplicatedContext | back to summary |
|---|---|
| public static Context getOrCreateDuplicatedContext(Context context) Gets or creates a duplicated context. If the given context is already a duplicated context, it returns this duplicated context. Otherwise, it creates a new duplicated context, using the given context as root context. | |
| getOrCreateDuplicatedContext | back to summary |
|---|---|
| public static Context getOrCreateDuplicatedContext(Vertx vertx) Gets or creates a duplicated context. If this method is called from a non-Vert.x thread (so, there is no current context), it creates a new (event loop) context and a duplicated context (and returns the duplicated context). If this method is called from a Vert.x thread (so, there is a current context), and if the current context is already a duplicated context, it returns the current duplicated context. It this method is called from a Vert.x thread (so, there is a current context), and if the current context is not a duplicated context, it creates a new duplicated context, using the current context as root context.
| |
| getOrCreateDuplicatedContext | back to summary |
|---|---|
| public static Context getOrCreateDuplicatedContext() Gets or creates a duplicated context.
If the method is not called from a Vert.x thread, it returns
| |
| getRootContext | back to summary |
|---|---|
| public static Context getRootContext(Context context) Returns the parent context from a given Vert.x context. A duplicate context returns the wrapped context otherwise the given context is returned. | |
| isDuplicatedContext | back to summary |
|---|---|
| public static boolean isDuplicatedContext(Context context) Checks if the given context is a duplicated context.
| |
| isOnDuplicatedContext | back to summary |
|---|---|
| public static boolean isOnDuplicatedContext() Checks if the current context is a duplicated context. If the method is called from a Vert.x thread, it retrieves the current context and checks if it's a duplicated context. Otherwise, it returns false.
| |