Package com.codingchili.core.context
Class SystemContext
java.lang.Object
com.codingchili.core.context.SystemContext
- All Implemented Interfaces:
- CoreContext
- Direct Known Subclasses:
- ContextMock,- StorageContext
Implementation of the CoreContext, each context gets its own worker pool.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsModifierConstructorDescriptionCreates a new vertx instance to be used for this context.protectedSystemContext(CoreContext context)Creates a new system context that shares vertx instance with the given context.
- 
Method SummaryModifier and TypeMethodDescription<T> voidblocking(io.vertx.core.Handler<io.vertx.core.Promise<T>> sync, boolean ordered, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> result)Call to execute the given blocking handler on a worker thread that is scoped to the current context.<T> voidblocking(io.vertx.core.Handler<io.vertx.core.Promise<T>> sync, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> result)Call to execute the given blocking handler on a worker thread that is scoped to the current context.io.vertx.core.eventbus.EventBusbus()voidcancel(long timer)Cancels a running timer.voidclose()Shuts down the context and underlying pools and connections.voidstatic voidclustered(io.vertx.core.Handler<io.vertx.core.AsyncResult<CoreContext>> handler)Creates a clustered instance of a context.io.vertx.core.Future<String>Instantiates an object of the given class identifier and determines the type that should be deployed.io.vertx.core.Future<String>handler(Supplier<CoreHandler> handler)Deploys a new handler in the cluster from given handler with a completion handler.io.vertx.core.Future<String>listener(Supplier<CoreListener> listener)Deploys the given verticle with a completion handler.metrics()Creates a new metric namespace using the registryName.voidperiodic(TimerSource timeout, io.vertx.core.Handler<Long> handler)Set a periodic timer that uses a timersource to adjust interval during runtime.io.vertx.core.Future<String>service(Supplier<CoreService> service)Deploys the given verticle with a completion handler.io.vertx.core.Future<io.vertx.core.CompositeFuture>stop()voidUndeploys a deployed handler by the deployment id.system()longSets a timer that executes the given handler after the given time.io.vertx.core.Vertxvertx()Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.codingchili.core.context.CoreContextfileSystem
- 
Field Details- 
vertxprotected io.vertx.core.Vertx vertx
 
- 
- 
Constructor Details- 
SystemContextpublic SystemContext()Creates a new vertx instance to be used for this context.
- 
SystemContextCreates a new system context that shares vertx instance with the given context.- Parameters:
- context- context to clone vertx instance from.
 
 
- 
- 
Method Details- 
clusteredpublic static void clustered(io.vertx.core.Handler<io.vertx.core.AsyncResult<CoreContext>> handler)Creates a clustered instance of a context.- Parameters:
- handler- called with the context on creation.
 
- 
metrics- Specified by:
- metricsin interface- CoreContext
- Returns:
- the metrics collector.
 
- 
metricsDescription copied from interface:CoreContextCreates a new metric namespace using the registryName.- Specified by:
- metricsin interface- CoreContext
- Parameters:
- registryName- the name of the registry to attach metrics to.
- Returns:
- a new metric collector using the default timer.
 
- 
buspublic io.vertx.core.eventbus.EventBus bus()- Specified by:
- busin interface- CoreContext
- Returns:
- get the EventBus attached to the vertx instance.
 
- 
system- Specified by:
- systemin interface- CoreContext
- Returns:
- the system configuration.
 
- 
periodicDescription copied from interface:CoreContextSet a periodic timer that uses a timersource to adjust interval during runtime.- Specified by:
- periodicin interface- CoreContext
- Parameters:
- timeout- a timer source that may change period during runtime.
- handler- the handler to be invoked when each interval ends.
 
- 
timerDescription copied from interface:CoreContextSets a timer that executes the given handler after the given time.- Specified by:
- timerin interface- CoreContext
- Parameters:
- ms- time unit in ms.
- handler- the handler to be invoken when the timer runs out.
- Returns:
- the id of the created timer so that it may be cancelled.
 
- 
cancelpublic void cancel(long timer)Description copied from interface:CoreContextCancels a running timer.- Specified by:
- cancelin interface- CoreContext
- Parameters:
- timer- the id of the timer to be stopped.
 
- 
deployDescription copied from interface:CoreContextInstantiates an object of the given class identifier and determines the type that should be deployed. May be aCoreHandlerCoreServiceCoreListeneror a plainVerticle.- Specified by:
- deployin interface- CoreContext
- Parameters:
- target- the target class to deploy.
- Returns:
- future completed on deployment.
 
- 
handlerDescription copied from interface:CoreContextDeploys a new handler in the cluster from given handler with a completion handler.- Specified by:
- handlerin interface- CoreContext
- Parameters:
- handler- the handler to be used to handle incoming requests.
- Returns:
- a future to be completed on deployment completion.
 
- 
listenerDescription copied from interface:CoreContextDeploys the given verticle with a completion handler.- Specified by:
- listenerin interface- CoreContext
- Parameters:
- listener- the verticle to be deployed.
- Returns:
- future completed on deployment completion.
 
- 
serviceDescription copied from interface:CoreContextDeploys the given verticle with a completion handler.- Specified by:
- servicein interface- CoreContext
- Parameters:
- service- the verticle to be deployed.
- Returns:
- future to be completed on deployment completion.
 
- 
stopDescription copied from interface:CoreContextUndeploys a deployed handler by the deployment id.- Specified by:
- stopin interface- CoreContext
- Parameters:
- deploymentId- the id of the deployment to undeploy.
 
- 
stoppublic io.vertx.core.Future<io.vertx.core.CompositeFuture> stop()- Specified by:
- stopin interface- CoreContext
 
- 
blockingpublic <T> void blocking(io.vertx.core.Handler<io.vertx.core.Promise<T>> sync, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> result)Description copied from interface:CoreContextCall to execute the given blocking handler on a worker thread that is scoped to the current context.- Specified by:
- blockingin interface- CoreContext
- Type Parameters:
- T- type parameter.
- Parameters:
- sync- a method that is blocking, to be executed on worker thread.
- result- handler for the result of the blocking execution.
 
- 
blockingpublic <T> void blocking(io.vertx.core.Handler<io.vertx.core.Promise<T>> sync, boolean ordered, io.vertx.core.Handler<io.vertx.core.AsyncResult<T>> result)Description copied from interface:CoreContextCall to execute the given blocking handler on a worker thread that is scoped to the current context.- Specified by:
- blockingin interface- CoreContext
- Type Parameters:
- T- type parameter for the result
- Parameters:
- sync- a handler that executes blocking code
- ordered- if true, indicates that the tasks must be completed in the same order as they are started.
- result- handler for the result that is called asynchronously
 
- 
logger- Specified by:
- loggerin interface- CoreContext
- Parameters:
- aClass- added as metadata to all logged events.
- Returns:
- get a new instance of a logger.
 
- 
closepublic void close()Description copied from interface:CoreContextShuts down the context and underlying pools and connections.- Specified by:
- closein interface- CoreContext
 
- 
close- Specified by:
- closein interface- CoreContext
- Parameters:
- handler- called when the context has closed or failed closing.
 
- 
vertxpublic io.vertx.core.Vertx vertx()- Specified by:
- vertxin interface- CoreContext
- Returns:
- the vertx instance.
 
 
-